aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin/kernel/cplb-nompu/cplbinit.c
diff options
context:
space:
mode:
authorGraf Yang <graf.yang@analog.com>2008-11-18 04:48:22 -0500
committerBryan Wu <cooloney@kernel.org>2008-11-18 04:48:22 -0500
commitb8a989893cbdeb6c97a7b5af5f38fb0e480235f9 (patch)
tree658cf6df93dac687f0d6b94111d0f53b3dd0177c /arch/blackfin/kernel/cplb-nompu/cplbinit.c
parent6b3087c64a92a36ae20d33479b4df6d7afc910d4 (diff)
Blackfin arch: SMP supporting patchset: Blackfin CPLB 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 Blackfin CPLB related code Signed-off-by: Graf Yang <graf.yang@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org>
Diffstat (limited to 'arch/blackfin/kernel/cplb-nompu/cplbinit.c')
-rw-r--r--arch/blackfin/kernel/cplb-nompu/cplbinit.c89
1 files changed, 33 insertions, 56 deletions
diff --git a/arch/blackfin/kernel/cplb-nompu/cplbinit.c b/arch/blackfin/kernel/cplb-nompu/cplbinit.c
index 2debc900e246..8966c706b71a 100644
--- a/arch/blackfin/kernel/cplb-nompu/cplbinit.c
+++ b/arch/blackfin/kernel/cplb-nompu/cplbinit.c
@@ -27,46 +27,20 @@
27#include <asm/cplb.h> 27#include <asm/cplb.h>
28#include <asm/cplbinit.h> 28#include <asm/cplbinit.h>
29 29
30#define CPLB_MEM CONFIG_MAX_MEM_SIZE 30u_long icplb_tables[NR_CPUS][CPLB_TBL_ENTRIES+1];
31 31u_long dcplb_tables[NR_CPUS][CPLB_TBL_ENTRIES+1];
32/*
33* Number of required data CPLB switchtable entries
34* MEMSIZE / 4 (we mostly install 4M page size CPLBs
35* approx 16 for smaller 1MB page size CPLBs for allignment purposes
36* 1 for L1 Data Memory
37* possibly 1 for L2 Data Memory
38* 1 for CONFIG_DEBUG_HUNT_FOR_ZERO
39* 1 for ASYNC Memory
40*/
41#define MAX_SWITCH_D_CPLBS (((CPLB_MEM / 4) + 16 + 1 + 1 + 1 \
42 + ASYNC_MEMORY_CPLB_COVERAGE) * 2)
43
44/*
45* Number of required instruction CPLB switchtable entries
46* MEMSIZE / 4 (we mostly install 4M page size CPLBs
47* approx 12 for smaller 1MB page size CPLBs for allignment purposes
48* 1 for L1 Instruction Memory
49* possibly 1 for L2 Instruction Memory
50* 1 for CONFIG_DEBUG_HUNT_FOR_ZERO
51*/
52#define MAX_SWITCH_I_CPLBS (((CPLB_MEM / 4) + 12 + 1 + 1 + 1) * 2)
53
54
55u_long icplb_table[MAX_CPLBS + 1];
56u_long dcplb_table[MAX_CPLBS + 1];
57 32
58#ifdef CONFIG_CPLB_SWITCH_TAB_L1 33#ifdef CONFIG_CPLB_SWITCH_TAB_L1
59# define PDT_ATTR __attribute__((l1_data)) 34#define PDT_ATTR __attribute__((l1_data))
60#else 35#else
61# define PDT_ATTR 36#define PDT_ATTR
62#endif 37#endif
63 38
64u_long ipdt_table[MAX_SWITCH_I_CPLBS + 1] PDT_ATTR; 39u_long ipdt_tables[NR_CPUS][MAX_SWITCH_I_CPLBS+1] PDT_ATTR;
65u_long dpdt_table[MAX_SWITCH_D_CPLBS + 1] PDT_ATTR; 40u_long dpdt_tables[NR_CPUS][MAX_SWITCH_D_CPLBS+1] PDT_ATTR;
66
67#ifdef CONFIG_CPLB_INFO 41#ifdef CONFIG_CPLB_INFO
68u_long ipdt_swapcount_table[MAX_SWITCH_I_CPLBS] PDT_ATTR; 42u_long ipdt_swapcount_tables[NR_CPUS][MAX_SWITCH_I_CPLBS] PDT_ATTR;
69u_long dpdt_swapcount_table[MAX_SWITCH_D_CPLBS] PDT_ATTR; 43u_long dpdt_swapcount_tables[NR_CPUS][MAX_SWITCH_D_CPLBS] PDT_ATTR;
70#endif 44#endif
71 45
72struct s_cplb { 46struct s_cplb {
@@ -93,8 +67,8 @@ static struct cplb_desc cplb_data[] = {
93 .name = "Zero Pointer Guard Page", 67 .name = "Zero Pointer Guard Page",
94 }, 68 },
95 { 69 {
96 .start = L1_CODE_START, 70 .start = 0, /* dyanmic */
97 .end = L1_CODE_START + L1_CODE_LENGTH, 71 .end = 0, /* dynamic */
98 .psize = SIZE_4M, 72 .psize = SIZE_4M,
99 .attr = INITIAL_T | SWITCH_T | I_CPLB, 73 .attr = INITIAL_T | SWITCH_T | I_CPLB,
100 .i_conf = L1_IMEMORY, 74 .i_conf = L1_IMEMORY,
@@ -103,8 +77,8 @@ static struct cplb_desc cplb_data[] = {
103 .name = "L1 I-Memory", 77 .name = "L1 I-Memory",
104 }, 78 },
105 { 79 {
106 .start = L1_DATA_A_START, 80 .start = 0, /* dynamic */
107 .end = L1_DATA_B_START + L1_DATA_B_LENGTH, 81 .end = 0, /* dynamic */
108 .psize = SIZE_4M, 82 .psize = SIZE_4M,
109 .attr = INITIAL_T | SWITCH_T | D_CPLB, 83 .attr = INITIAL_T | SWITCH_T | D_CPLB,
110 .i_conf = 0, 84 .i_conf = 0,
@@ -117,6 +91,16 @@ static struct cplb_desc cplb_data[] = {
117 .name = "L1 D-Memory", 91 .name = "L1 D-Memory",
118 }, 92 },
119 { 93 {
94 .start = L2_START,
95 .end = L2_START + L2_LENGTH,
96 .psize = SIZE_1M,
97 .attr = L2_ATTR,
98 .i_conf = L2_IMEMORY,
99 .d_conf = L2_DMEMORY,
100 .valid = (L2_LENGTH > 0),
101 .name = "L2 Memory",
102 },
103 {
120 .start = 0, 104 .start = 0,
121 .end = 0, /* dynamic */ 105 .end = 0, /* dynamic */
122 .psize = 0, 106 .psize = 0,
@@ -165,16 +149,6 @@ static struct cplb_desc cplb_data[] = {
165 .name = "Asynchronous Memory Banks", 149 .name = "Asynchronous Memory Banks",
166 }, 150 },
167 { 151 {
168 .start = L2_START,
169 .end = L2_START + L2_LENGTH,
170 .psize = SIZE_1M,
171 .attr = SWITCH_T | I_CPLB | D_CPLB,
172 .i_conf = L2_IMEMORY,
173 .d_conf = L2_DMEMORY,
174 .valid = (L2_LENGTH > 0),
175 .name = "L2 Memory",
176 },
177 {
178 .start = BOOT_ROM_START, 152 .start = BOOT_ROM_START,
179 .end = BOOT_ROM_START + BOOT_ROM_LENGTH, 153 .end = BOOT_ROM_START + BOOT_ROM_LENGTH,
180 .psize = SIZE_1M, 154 .psize = SIZE_1M,
@@ -310,7 +284,7 @@ __fill_data_cplbtab(struct cplb_tab *t, int i, u32 a_start, u32 a_end)
310 } 284 }
311} 285}
312 286
313void __init generate_cplb_tables(void) 287void __init generate_cplb_tables_cpu(unsigned int cpu)
314{ 288{
315 289
316 u16 i, j, process; 290 u16 i, j, process;
@@ -322,8 +296,8 @@ void __init generate_cplb_tables(void)
322 296
323 printk(KERN_INFO "NOMPU: setting up cplb tables for global access\n"); 297 printk(KERN_INFO "NOMPU: setting up cplb tables for global access\n");
324 298
325 cplb.init_i.size = MAX_CPLBS; 299 cplb.init_i.size = CPLB_TBL_ENTRIES;
326 cplb.init_d.size = MAX_CPLBS; 300 cplb.init_d.size = CPLB_TBL_ENTRIES;
327 cplb.switch_i.size = MAX_SWITCH_I_CPLBS; 301 cplb.switch_i.size = MAX_SWITCH_I_CPLBS;
328 cplb.switch_d.size = MAX_SWITCH_D_CPLBS; 302 cplb.switch_d.size = MAX_SWITCH_D_CPLBS;
329 303
@@ -332,11 +306,15 @@ void __init generate_cplb_tables(void)
332 cplb.switch_i.pos = 0; 306 cplb.switch_i.pos = 0;
333 cplb.switch_d.pos = 0; 307 cplb.switch_d.pos = 0;
334 308
335 cplb.init_i.tab = icplb_table; 309 cplb.init_i.tab = icplb_tables[cpu];
336 cplb.init_d.tab = dcplb_table; 310 cplb.init_d.tab = dcplb_tables[cpu];
337 cplb.switch_i.tab = ipdt_table; 311 cplb.switch_i.tab = ipdt_tables[cpu];
338 cplb.switch_d.tab = dpdt_table; 312 cplb.switch_d.tab = dpdt_tables[cpu];
339 313
314 cplb_data[L1I_MEM].start = get_l1_code_start_cpu(cpu);
315 cplb_data[L1I_MEM].end = cplb_data[L1I_MEM].start + L1_CODE_LENGTH;
316 cplb_data[L1D_MEM].start = get_l1_data_a_start_cpu(cpu);
317 cplb_data[L1D_MEM].end = get_l1_data_b_start_cpu(cpu) + L1_DATA_B_LENGTH;
340 cplb_data[SDRAM_KERN].end = memory_end; 318 cplb_data[SDRAM_KERN].end = memory_end;
341 319
342#ifdef CONFIG_MTD_UCLINUX 320#ifdef CONFIG_MTD_UCLINUX
@@ -459,6 +437,5 @@ void __init generate_cplb_tables(void)
459 cplb.switch_d.tab[cplb.switch_d.pos] = -1; 437 cplb.switch_d.tab[cplb.switch_d.pos] = -1;
460 438
461} 439}
462
463#endif 440#endif
464 441