]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - arch/arc/include/asm/mcip.h
ARCv2: SMP: Support ARConnect (MCIP) for Inter-Core-Interrupts et al
[karo-tx-linux.git] / arch / arc / include / asm / mcip.h
1 /*
2  * ARConnect IP Support (Multi core enabler: Cross core IPI, RTC ...)
3  *
4  * Copyright (C) 2014-15 Synopsys, Inc. (www.synopsys.com)
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  */
10
11 #ifndef __ASM_MCIP_H
12 #define __ASM_MCIP_H
13
14 #ifdef CONFIG_ISA_ARCV2
15
16 #include <asm/arcregs.h>
17
18 #define ARC_REG_MCIP_BCR        0x0d0
19 #define ARC_REG_MCIP_CMD        0x600
20 #define ARC_REG_MCIP_WDATA      0x601
21 #define ARC_REG_MCIP_READBACK   0x602
22
23 struct mcip_cmd {
24 #ifdef CONFIG_CPU_BIG_ENDIAN
25         unsigned int pad:8, param:16, cmd:8;
26 #else
27         unsigned int cmd:8, param:16, pad:8;
28 #endif
29
30 #define CMD_INTRPT_GENERATE_IRQ         0x01
31 #define CMD_INTRPT_GENERATE_ACK         0x02
32 #define CMD_INTRPT_READ_STATUS          0x03
33 #define CMD_INTRPT_CHECK_SOURCE         0x04
34
35 /* Semaphore Commands */
36 #define CMD_SEMA_CLAIM_AND_READ         0x11
37 #define CMD_SEMA_RELEASE                0x12
38
39 #define CMD_DEBUG_SET_MASK              0x34
40 #define CMD_DEBUG_SET_SELECT            0x36
41
42 #define CMD_IDU_ENABLE                  0x71
43 #define CMD_IDU_DISABLE                 0x72
44 #define CMD_IDU_SET_MODE                0x74
45 #define CMD_IDU_SET_DEST                0x76
46 #define CMD_IDU_SET_MASK                0x7C
47
48 #define IDU_M_TRIG_LEVEL                0x0
49 #define IDU_M_TRIG_EDGE                 0x1
50
51 #define IDU_M_DISTRI_RR                 0x0
52 #define IDU_M_DISTRI_DEST               0x2
53 };
54
55 /*
56  * MCIP programming model
57  *
58  * - Simple commands write {cmd:8,param:16} to MCIP_CMD aux reg
59  *   (param could be irq, common_irq, core_id ...)
60  * - More involved commands setup MCIP_WDATA with cmd specific data
61  *   before invoking the simple command
62  */
63 static inline void __mcip_cmd(unsigned int cmd, unsigned int param)
64 {
65         struct mcip_cmd buf;
66
67         buf.pad = 0;
68         buf.cmd = cmd;
69         buf.param = param;
70
71         WRITE_AUX(ARC_REG_MCIP_CMD, buf);
72 }
73
74 /*
75  * Setup additional data for a cmd
76  * Callers need to lock to ensure atomicity
77  */
78 static inline void __mcip_cmd_data(unsigned int cmd, unsigned int param,
79                                    unsigned int data)
80 {
81         write_aux_reg(ARC_REG_MCIP_WDATA, data);
82
83         __mcip_cmd(cmd, param);
84 }
85
86 extern void mcip_init_early_smp(void);
87 extern void mcip_init_smp(unsigned int cpu);
88
89 #endif
90
91 #endif