diff options
author | Vineet Gupta <vgupta@synopsys.com> | 2016-02-16 02:06:18 -0500 |
---|---|---|
committer | Vineet Gupta <vgupta@synopsys.com> | 2016-02-18 07:00:18 -0500 |
commit | a150b085b66c87bd4d362a523cb85ce2b0a2d77b (patch) | |
tree | 0a6cfee16ca44e87267e0f73d846930458aa28c0 /arch/arc/kernel/setup.c | |
parent | 98341f7dc9d9080d7999654ab589657272559b04 (diff) |
ARCv2: boot report CCMs (Closely Coupled Memories)
- ARCv2 uses a seperate BCR for {I,D}CCM base address:
ARCompact encoded both base/size in same BCR
- Size encoding in common BCR is different for ARCompact/ARCv2
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Diffstat (limited to 'arch/arc/kernel/setup.c')
-rw-r--r-- | arch/arc/kernel/setup.c | 78 |
1 files changed, 50 insertions, 28 deletions
diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c index 28dba569edd4..cdc821df1809 100644 --- a/arch/arc/kernel/setup.c +++ b/arch/arc/kernel/setup.c | |||
@@ -42,6 +42,53 @@ struct task_struct *_current_task[NR_CPUS]; /* For stack switching */ | |||
42 | 42 | ||
43 | struct cpuinfo_arc cpuinfo_arc700[NR_CPUS]; | 43 | struct cpuinfo_arc cpuinfo_arc700[NR_CPUS]; |
44 | 44 | ||
45 | static void read_decode_ccm_bcr(struct cpuinfo_arc *cpu) | ||
46 | { | ||
47 | if (is_isa_arcompact()) { | ||
48 | struct bcr_iccm_arcompact iccm; | ||
49 | struct bcr_dccm_arcompact dccm; | ||
50 | |||
51 | READ_BCR(ARC_REG_ICCM_BUILD, iccm); | ||
52 | if (iccm.ver) { | ||
53 | cpu->iccm.sz = 4096 << iccm.sz; /* 8K to 512K */ | ||
54 | cpu->iccm.base_addr = iccm.base << 16; | ||
55 | } | ||
56 | |||
57 | READ_BCR(ARC_REG_DCCM_BUILD, dccm); | ||
58 | if (dccm.ver) { | ||
59 | unsigned long base; | ||
60 | cpu->dccm.sz = 2048 << dccm.sz; /* 2K to 256K */ | ||
61 | |||
62 | base = read_aux_reg(ARC_REG_DCCM_BASE_BUILD); | ||
63 | cpu->dccm.base_addr = base & ~0xF; | ||
64 | } | ||
65 | } else { | ||
66 | struct bcr_iccm_arcv2 iccm; | ||
67 | struct bcr_dccm_arcv2 dccm; | ||
68 | unsigned long region; | ||
69 | |||
70 | READ_BCR(ARC_REG_ICCM_BUILD, iccm); | ||
71 | if (iccm.ver) { | ||
72 | cpu->iccm.sz = 256 << iccm.sz00; /* 512B to 16M */ | ||
73 | if (iccm.sz00 == 0xF && iccm.sz01 > 0) | ||
74 | cpu->iccm.sz <<= iccm.sz01; | ||
75 | |||
76 | region = read_aux_reg(ARC_REG_AUX_ICCM); | ||
77 | cpu->iccm.base_addr = region & 0xF0000000; | ||
78 | } | ||
79 | |||
80 | READ_BCR(ARC_REG_DCCM_BUILD, dccm); | ||
81 | if (dccm.ver) { | ||
82 | cpu->dccm.sz = 256 << dccm.sz0; | ||
83 | if (dccm.sz0 == 0xF && dccm.sz1 > 0) | ||
84 | cpu->dccm.sz <<= dccm.sz1; | ||
85 | |||
86 | region = read_aux_reg(ARC_REG_AUX_DCCM); | ||
87 | cpu->dccm.base_addr = region & 0xF0000000; | ||
88 | } | ||
89 | } | ||
90 | } | ||
91 | |||
45 | static void read_arc_build_cfg_regs(void) | 92 | static void read_arc_build_cfg_regs(void) |
46 | { | 93 | { |
47 | struct bcr_perip uncached_space; | 94 | struct bcr_perip uncached_space; |
@@ -76,36 +123,11 @@ static void read_arc_build_cfg_regs(void) | |||
76 | cpu->extn.swap = read_aux_reg(ARC_REG_SWAP_BCR) ? 1 : 0; /* 1,3 */ | 123 | cpu->extn.swap = read_aux_reg(ARC_REG_SWAP_BCR) ? 1 : 0; /* 1,3 */ |
77 | cpu->extn.crc = read_aux_reg(ARC_REG_CRC_BCR) ? 1 : 0; | 124 | cpu->extn.crc = read_aux_reg(ARC_REG_CRC_BCR) ? 1 : 0; |
78 | cpu->extn.minmax = read_aux_reg(ARC_REG_MIXMAX_BCR) > 1 ? 1 : 0; /* 2 */ | 125 | cpu->extn.minmax = read_aux_reg(ARC_REG_MIXMAX_BCR) > 1 ? 1 : 0; /* 2 */ |
79 | |||
80 | /* Note that we read the CCM BCRs independent of kernel config | ||
81 | * This is to catch the cases where user doesn't know that | ||
82 | * CCMs are present in hardware build | ||
83 | */ | ||
84 | { | ||
85 | struct bcr_iccm iccm; | ||
86 | struct bcr_dccm dccm; | ||
87 | struct bcr_dccm_base dccm_base; | ||
88 | unsigned int bcr_32bit_val; | ||
89 | |||
90 | bcr_32bit_val = read_aux_reg(ARC_REG_ICCM_BCR); | ||
91 | if (bcr_32bit_val) { | ||
92 | iccm = *((struct bcr_iccm *)&bcr_32bit_val); | ||
93 | cpu->iccm.base_addr = iccm.base << 16; | ||
94 | cpu->iccm.sz = 0x2000 << (iccm.sz - 1); | ||
95 | } | ||
96 | |||
97 | bcr_32bit_val = read_aux_reg(ARC_REG_DCCM_BCR); | ||
98 | if (bcr_32bit_val) { | ||
99 | dccm = *((struct bcr_dccm *)&bcr_32bit_val); | ||
100 | cpu->dccm.sz = 0x800 << (dccm.sz); | ||
101 | |||
102 | READ_BCR(ARC_REG_DCCMBASE_BCR, dccm_base); | ||
103 | cpu->dccm.base_addr = dccm_base.addr << 8; | ||
104 | } | ||
105 | } | ||
106 | |||
107 | READ_BCR(ARC_REG_XY_MEM_BCR, cpu->extn_xymem); | 126 | READ_BCR(ARC_REG_XY_MEM_BCR, cpu->extn_xymem); |
108 | 127 | ||
128 | /* Read CCM BCRs for boot reporting even if not enabled in Kconfig */ | ||
129 | read_decode_ccm_bcr(cpu); | ||
130 | |||
109 | read_decode_mmu_bcr(); | 131 | read_decode_mmu_bcr(); |
110 | read_decode_cache_bcr(); | 132 | read_decode_cache_bcr(); |
111 | 133 | ||