diff options
author | Graf Yang <graf.yang@analog.com> | 2009-01-07 10:14:39 -0500 |
---|---|---|
committer | Bryan Wu <cooloney@kernel.org> | 2009-01-07 10:14:39 -0500 |
commit | c51b4488cd5bff08ed5690a8f303ff7f0894da2a (patch) | |
tree | 1f6a2919e011b033ba5177efe3a612f4ebebb4b5 /arch/blackfin/mach-bf561/include | |
parent | 2de73e71c298842db814556379cbe25f5c14691e (diff) |
Blackfin arch: SMP supporting patchset: BF561 related code
Blackfin dual core BF561 processor can support SMP like features.
https://docs.blackfin.uclinux.org/doku.php?id=linux-kernel:smp-like
In this patch, we provide SMP extend to BF561 kernel code
Signed-off-by: Graf Yang <graf.yang@analog.com>
Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Diffstat (limited to 'arch/blackfin/mach-bf561/include')
-rw-r--r-- | arch/blackfin/mach-bf561/include/mach/blackfin.h | 4 | ||||
-rw-r--r-- | arch/blackfin/mach-bf561/include/mach/defBF561.h | 3 | ||||
-rw-r--r-- | arch/blackfin/mach-bf561/include/mach/mem_map.h | 120 | ||||
-rw-r--r-- | arch/blackfin/mach-bf561/include/mach/smp.h | 22 |
4 files changed, 149 insertions, 0 deletions
diff --git a/arch/blackfin/mach-bf561/include/mach/blackfin.h b/arch/blackfin/mach-bf561/include/mach/blackfin.h index 0ea8666e6764..f79f6626b7ec 100644 --- a/arch/blackfin/mach-bf561/include/mach/blackfin.h +++ b/arch/blackfin/mach-bf561/include/mach/blackfin.h | |||
@@ -66,8 +66,12 @@ | |||
66 | 66 | ||
67 | #define bfin_read_SIC_IMASK(x) bfin_read32(SICA_IMASK0 + (x << 2)) | 67 | #define bfin_read_SIC_IMASK(x) bfin_read32(SICA_IMASK0 + (x << 2)) |
68 | #define bfin_write_SIC_IMASK(x, val) bfin_write32((SICA_IMASK0 + (x << 2)), val) | 68 | #define bfin_write_SIC_IMASK(x, val) bfin_write32((SICA_IMASK0 + (x << 2)), val) |
69 | #define bfin_read_SICB_IMASK(x) bfin_read32(SICB_IMASK0 + (x << 2)) | ||
70 | #define bfin_write_SICB_IMASK(x, val) bfin_write32((SICB_IMASK0 + (x << 2)), val) | ||
69 | #define bfin_read_SIC_ISR(x) bfin_read32(SICA_ISR0 + (x << 2)) | 71 | #define bfin_read_SIC_ISR(x) bfin_read32(SICA_ISR0 + (x << 2)) |
70 | #define bfin_write_SIC_ISR(x, val) bfin_write32((SICA_ISR0 + (x << 2)), val) | 72 | #define bfin_write_SIC_ISR(x, val) bfin_write32((SICA_ISR0 + (x << 2)), val) |
73 | #define bfin_read_SICB_ISR(x) bfin_read32(SICB_ISR0 + (x << 2)) | ||
74 | #define bfin_write_SICB_ISR(x, val) bfin_write32((SICB_ISR0 + (x << 2)), val) | ||
71 | 75 | ||
72 | #define BFIN_UART_NR_PORTS 1 | 76 | #define BFIN_UART_NR_PORTS 1 |
73 | 77 | ||
diff --git a/arch/blackfin/mach-bf561/include/mach/defBF561.h b/arch/blackfin/mach-bf561/include/mach/defBF561.h index 4eca2026bb92..d7c509759659 100644 --- a/arch/blackfin/mach-bf561/include/mach/defBF561.h +++ b/arch/blackfin/mach-bf561/include/mach/defBF561.h | |||
@@ -912,6 +912,9 @@ | |||
912 | #define ACTIVE_PLLDISABLED 0x0004 /* Processor In Active Mode With PLL Disabled */ | 912 | #define ACTIVE_PLLDISABLED 0x0004 /* Processor In Active Mode With PLL Disabled */ |
913 | #define PLL_LOCKED 0x0020 /* PLL_LOCKCNT Has Been Reached */ | 913 | #define PLL_LOCKED 0x0020 /* PLL_LOCKCNT Has Been Reached */ |
914 | 914 | ||
915 | /* SICA_SYSCR Masks */ | ||
916 | #define COREB_SRAM_INIT 0x0020 | ||
917 | |||
915 | /* SWRST Mask */ | 918 | /* SWRST Mask */ |
916 | #define SYSTEM_RESET 0x0007 /* Initiates a system software reset */ | 919 | #define SYSTEM_RESET 0x0007 /* Initiates a system software reset */ |
917 | #define DOUBLE_FAULT_A 0x0008 /* Core A Double Fault Causes Reset */ | 920 | #define DOUBLE_FAULT_A 0x0008 /* Core A Double Fault Causes Reset */ |
diff --git a/arch/blackfin/mach-bf561/include/mach/mem_map.h b/arch/blackfin/mach-bf561/include/mach/mem_map.h index f1d4c0637bd2..488c3bda65bf 100644 --- a/arch/blackfin/mach-bf561/include/mach/mem_map.h +++ b/arch/blackfin/mach-bf561/include/mach/mem_map.h | |||
@@ -85,4 +85,124 @@ | |||
85 | #define L1_SCRATCH_START COREA_L1_SCRATCH_START | 85 | #define L1_SCRATCH_START COREA_L1_SCRATCH_START |
86 | #define L1_SCRATCH_LENGTH 0x1000 | 86 | #define L1_SCRATCH_LENGTH 0x1000 |
87 | 87 | ||
88 | #ifndef __ASSEMBLY__ | ||
89 | |||
90 | #ifdef CONFIG_SMP | ||
91 | |||
92 | #define get_l1_scratch_start_cpu(cpu) \ | ||
93 | ({ unsigned long __addr; \ | ||
94 | __addr = (cpu) ? COREB_L1_SCRATCH_START : COREA_L1_SCRATCH_START;\ | ||
95 | __addr; }) | ||
96 | |||
97 | #define get_l1_code_start_cpu(cpu) \ | ||
98 | ({ unsigned long __addr; \ | ||
99 | __addr = (cpu) ? COREB_L1_CODE_START : COREA_L1_CODE_START; \ | ||
100 | __addr; }) | ||
101 | |||
102 | #define get_l1_data_a_start_cpu(cpu) \ | ||
103 | ({ unsigned long __addr; \ | ||
104 | __addr = (cpu) ? COREB_L1_DATA_A_START : COREA_L1_DATA_A_START;\ | ||
105 | __addr; }) | ||
106 | |||
107 | #define get_l1_data_b_start_cpu(cpu) \ | ||
108 | ({ unsigned long __addr; \ | ||
109 | __addr = (cpu) ? COREB_L1_DATA_B_START : COREA_L1_DATA_B_START;\ | ||
110 | __addr; }) | ||
111 | |||
112 | #define get_l1_scratch_start() get_l1_scratch_start_cpu(blackfin_core_id()) | ||
113 | #define get_l1_code_start() get_l1_code_start_cpu(blackfin_core_id()) | ||
114 | #define get_l1_data_a_start() get_l1_data_a_start_cpu(blackfin_core_id()) | ||
115 | #define get_l1_data_b_start() get_l1_data_b_start_cpu(blackfin_core_id()) | ||
116 | |||
117 | #else /* !CONFIG_SMP */ | ||
118 | #define get_l1_scratch_start_cpu(cpu) L1_SCRATCH_START | ||
119 | #define get_l1_code_start_cpu(cpu) L1_CODE_START | ||
120 | #define get_l1_data_a_start_cpu(cpu) L1_DATA_A_START | ||
121 | #define get_l1_data_b_start_cpu(cpu) L1_DATA_B_START | ||
122 | #define get_l1_scratch_start() L1_SCRATCH_START | ||
123 | #define get_l1_code_start() L1_CODE_START | ||
124 | #define get_l1_data_a_start() L1_DATA_A_START | ||
125 | #define get_l1_data_b_start() L1_DATA_B_START | ||
126 | #endif /* !CONFIG_SMP */ | ||
127 | |||
128 | #else /* __ASSEMBLY__ */ | ||
129 | |||
130 | /* | ||
131 | * The following macros both return the address of the PDA for the | ||
132 | * current core. | ||
133 | * | ||
134 | * In its first safe (and hairy) form, the macro neither clobbers any | ||
135 | * register aside of the output Preg, nor uses the stack, since it | ||
136 | * could be called with an invalid stack pointer, or the current stack | ||
137 | * space being uncovered by any CPLB (e.g. early exception handling). | ||
138 | * | ||
139 | * The constraints on the second form are a bit relaxed, and the code | ||
140 | * is allowed to use the specified Dreg for determining the PDA | ||
141 | * address to be returned into Preg. | ||
142 | */ | ||
143 | #ifdef CONFIG_SMP | ||
144 | #define GET_PDA_SAFE(preg) \ | ||
145 | preg.l = lo(DSPID); \ | ||
146 | preg.h = hi(DSPID); \ | ||
147 | preg = [preg]; \ | ||
148 | preg = preg << 2; \ | ||
149 | preg = preg << 2; \ | ||
150 | preg = preg << 2; \ | ||
151 | preg = preg << 2; \ | ||
152 | preg = preg << 2; \ | ||
153 | preg = preg << 2; \ | ||
154 | preg = preg << 2; \ | ||
155 | preg = preg << 2; \ | ||
156 | preg = preg << 2; \ | ||
157 | preg = preg << 2; \ | ||
158 | preg = preg << 2; \ | ||
159 | preg = preg << 2; \ | ||
160 | if cc jump 2f; \ | ||
161 | cc = preg == 0x0; \ | ||
162 | preg.l = _cpu_pda; \ | ||
163 | preg.h = _cpu_pda; \ | ||
164 | if !cc jump 3f; \ | ||
165 | 1: \ | ||
166 | /* preg = 0x0; */ \ | ||
167 | cc = !cc; /* restore cc to 0 */ \ | ||
168 | jump 4f; \ | ||
169 | 2: \ | ||
170 | cc = preg == 0x0; \ | ||
171 | preg.l = _cpu_pda; \ | ||
172 | preg.h = _cpu_pda; \ | ||
173 | if cc jump 4f; \ | ||
174 | /* preg = 0x1000000; */ \ | ||
175 | cc = !cc; /* restore cc to 1 */ \ | ||
176 | 3: \ | ||
177 | preg = [preg]; \ | ||
178 | 4: | ||
179 | |||
180 | #define GET_PDA(preg, dreg) \ | ||
181 | preg.l = lo(DSPID); \ | ||
182 | preg.h = hi(DSPID); \ | ||
183 | dreg = [preg]; \ | ||
184 | preg.l = _cpu_pda; \ | ||
185 | preg.h = _cpu_pda; \ | ||
186 | cc = bittst(dreg, 0); \ | ||
187 | if !cc jump 1f; \ | ||
188 | preg = [preg]; \ | ||
189 | 1: \ | ||
190 | |||
191 | #define GET_CPUID(preg, dreg) \ | ||
192 | preg.l = lo(DSPID); \ | ||
193 | preg.h = hi(DSPID); \ | ||
194 | dreg = [preg]; \ | ||
195 | dreg = ROT dreg BY -1; \ | ||
196 | dreg = CC; | ||
197 | |||
198 | #else | ||
199 | #define GET_PDA_SAFE(preg) \ | ||
200 | preg.l = _cpu_pda; \ | ||
201 | preg.h = _cpu_pda; | ||
202 | |||
203 | #define GET_PDA(preg, dreg) GET_PDA_SAFE(preg) | ||
204 | #endif /* CONFIG_SMP */ | ||
205 | |||
206 | #endif /* __ASSEMBLY__ */ | ||
207 | |||
88 | #endif /* _MEM_MAP_533_H_ */ | 208 | #endif /* _MEM_MAP_533_H_ */ |
diff --git a/arch/blackfin/mach-bf561/include/mach/smp.h b/arch/blackfin/mach-bf561/include/mach/smp.h new file mode 100644 index 000000000000..f9e65ebe81b2 --- /dev/null +++ b/arch/blackfin/mach-bf561/include/mach/smp.h | |||
@@ -0,0 +1,22 @@ | |||
1 | #ifndef _MACH_BF561_SMP | ||
2 | #define _MACH_BF561_SMP | ||
3 | |||
4 | struct task_struct; | ||
5 | |||
6 | void platform_init_cpus(void); | ||
7 | |||
8 | void platform_prepare_cpus(unsigned int max_cpus); | ||
9 | |||
10 | int platform_boot_secondary(unsigned int cpu, struct task_struct *idle); | ||
11 | |||
12 | void platform_secondary_init(unsigned int cpu); | ||
13 | |||
14 | void platform_request_ipi(int (*handler)(int, void *)); | ||
15 | |||
16 | void platform_send_ipi(cpumask_t callmap); | ||
17 | |||
18 | void platform_send_ipi_cpu(unsigned int cpu); | ||
19 | |||
20 | void platform_clear_ipi(unsigned int cpu); | ||
21 | |||
22 | #endif /* !_MACH_BF561_SMP */ | ||