aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>2019-06-05 13:32:50 -0400
committerVineet Gupta <vgupta@synopsys.com>2019-06-11 14:48:34 -0400
commitec9b4feb1e41587c15d43d237844193318389dc3 (patch)
tree4a7edbd9729692c1585fbe6f99f85c24494aa224
parent2bc42bfba9b247abd93991195b71f35a484531d1 (diff)
ARC: [plat-hsdk]: unify memory apertures configuration
HSDK SoC has memory bridge which allows to configure memory map for different AXI masters in runtime. As of today we adjust memory apertures configuration in U-boot so we have different configuration in case of loading kernel via U-boot and JTAG. It isn't really critical in case of existing platform configuration as configuration differs for <currently> unused address space regions or unused AXI masters. However we may face with this issue when we'll bringup new peripherals or touch their address space. Fix that by perform full configuration of memory bridge in HSDK platform code. Basically we simply copy memory bridge configuration code from U-boot. Acked-by: Alexey Brodkin <abrodkin@synopsys.com> Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
-rw-r--r--arch/arc/plat-hsdk/platform.c161
1 files changed, 153 insertions, 8 deletions
diff --git a/arch/arc/plat-hsdk/platform.c b/arch/arc/plat-hsdk/platform.c
index 2588b842407c..0e70e47358c6 100644
--- a/arch/arc/plat-hsdk/platform.c
+++ b/arch/arc/plat-hsdk/platform.c
@@ -35,8 +35,6 @@ static void __init hsdk_init_per_cpu(unsigned int cpu)
35 35
36#define ARC_PERIPHERAL_BASE 0xf0000000 36#define ARC_PERIPHERAL_BASE 0xf0000000
37#define CREG_BASE (ARC_PERIPHERAL_BASE + 0x1000) 37#define CREG_BASE (ARC_PERIPHERAL_BASE + 0x1000)
38#define CREG_PAE (CREG_BASE + 0x180)
39#define CREG_PAE_UPDATE (CREG_BASE + 0x194)
40 38
41#define SDIO_BASE (ARC_PERIPHERAL_BASE + 0xA000) 39#define SDIO_BASE (ARC_PERIPHERAL_BASE + 0xA000)
42#define SDIO_UHS_REG_EXT (SDIO_BASE + 0x108) 40#define SDIO_UHS_REG_EXT (SDIO_BASE + 0x108)
@@ -102,20 +100,167 @@ static void __init hsdk_enable_gpio_intc_wire(void)
102 iowrite32(GPIO_INT_CONNECTED_MASK, (void __iomem *) GPIO_INTEN); 100 iowrite32(GPIO_INT_CONNECTED_MASK, (void __iomem *) GPIO_INTEN);
103} 101}
104 102
105static void __init hsdk_init_early(void) 103enum hsdk_axi_masters {
104 M_HS_CORE = 0,
105 M_HS_RTT,
106 M_AXI_TUN,
107 M_HDMI_VIDEO,
108 M_HDMI_AUDIO,
109 M_USB_HOST,
110 M_ETHERNET,
111 M_SDIO,
112 M_GPU,
113 M_DMAC_0,
114 M_DMAC_1,
115 M_DVFS
116};
117
118#define UPDATE_VAL 1
119
120/*
121 * This is modified configuration of AXI bridge. Default settings
122 * are specified in "Table 111 CREG Address Decoder register reset values".
123 *
124 * AXI_M_m_SLV{0|1} - Slave Select register for master 'm'.
125 * Possible slaves are:
126 * - 0 => no slave selected
127 * - 1 => DDR controller port #1
128 * - 2 => SRAM controller
129 * - 3 => AXI tunnel
130 * - 4 => EBI controller
131 * - 5 => ROM controller
132 * - 6 => AXI2APB bridge
133 * - 7 => DDR controller port #2
134 * - 8 => DDR controller port #3
135 * - 9 => HS38x4 IOC
136 * - 10 => HS38x4 DMI
137 * AXI_M_m_OFFSET{0|1} - Addr Offset register for master 'm'
138 *
139 * Please read ARC HS Development IC Specification, section 17.2 for more
140 * information about apertures configuration.
141 *
142 * m master AXI_M_m_SLV0 AXI_M_m_SLV1 AXI_M_m_OFFSET0 AXI_M_m_OFFSET1
143 * 0 HS (CBU) 0x11111111 0x63111111 0xFEDCBA98 0x0E543210
144 * 1 HS (RTT) 0x77777777 0x77777777 0xFEDCBA98 0x76543210
145 * 2 AXI Tunnel 0x88888888 0x88888888 0xFEDCBA98 0x76543210
146 * 3 HDMI-VIDEO 0x77777777 0x77777777 0xFEDCBA98 0x76543210
147 * 4 HDMI-ADUIO 0x77777777 0x77777777 0xFEDCBA98 0x76543210
148 * 5 USB-HOST 0x77777777 0x77999999 0xFEDCBA98 0x76DCBA98
149 * 6 ETHERNET 0x77777777 0x77999999 0xFEDCBA98 0x76DCBA98
150 * 7 SDIO 0x77777777 0x77999999 0xFEDCBA98 0x76DCBA98
151 * 8 GPU 0x77777777 0x77777777 0xFEDCBA98 0x76543210
152 * 9 DMAC (port #1) 0x77777777 0x77777777 0xFEDCBA98 0x76543210
153 * 10 DMAC (port #2) 0x77777777 0x77777777 0xFEDCBA98 0x76543210
154 * 11 DVFS 0x00000000 0x60000000 0x00000000 0x00000000
155 */
156
157#define CREG_AXI_M_SLV0(m) ((void __iomem *)(CREG_BASE + 0x20 * (m)))
158#define CREG_AXI_M_SLV1(m) ((void __iomem *)(CREG_BASE + 0x20 * (m) + 0x04))
159#define CREG_AXI_M_OFT0(m) ((void __iomem *)(CREG_BASE + 0x20 * (m) + 0x08))
160#define CREG_AXI_M_OFT1(m) ((void __iomem *)(CREG_BASE + 0x20 * (m) + 0x0C))
161#define CREG_AXI_M_UPDT(m) ((void __iomem *)(CREG_BASE + 0x20 * (m) + 0x14))
162
163#define CREG_AXI_M_HS_CORE_BOOT ((void __iomem *)(CREG_BASE + 0x010))
164
165#define CREG_PAE ((void __iomem *)(CREG_BASE + 0x180))
166#define CREG_PAE_UPDT ((void __iomem *)(CREG_BASE + 0x194))
167
168static void __init hsdk_init_memory_bridge(void)
106{ 169{
170 u32 reg;
171
172 /*
173 * M_HS_CORE has one unique register - BOOT.
174 * We need to clean boot mirror (BOOT[1:0]) bits in them to avoid first
175 * aperture to be masked by 'boot mirror'.
176 */
177 reg = readl(CREG_AXI_M_HS_CORE_BOOT) & (~0x3);
178 writel(reg, CREG_AXI_M_HS_CORE_BOOT);
179 writel(0x11111111, CREG_AXI_M_SLV0(M_HS_CORE));
180 writel(0x63111111, CREG_AXI_M_SLV1(M_HS_CORE));
181 writel(0xFEDCBA98, CREG_AXI_M_OFT0(M_HS_CORE));
182 writel(0x0E543210, CREG_AXI_M_OFT1(M_HS_CORE));
183 writel(UPDATE_VAL, CREG_AXI_M_UPDT(M_HS_CORE));
184
185 writel(0x77777777, CREG_AXI_M_SLV0(M_HS_RTT));
186 writel(0x77777777, CREG_AXI_M_SLV1(M_HS_RTT));
187 writel(0xFEDCBA98, CREG_AXI_M_OFT0(M_HS_RTT));
188 writel(0x76543210, CREG_AXI_M_OFT1(M_HS_RTT));
189 writel(UPDATE_VAL, CREG_AXI_M_UPDT(M_HS_RTT));
190
191 writel(0x88888888, CREG_AXI_M_SLV0(M_AXI_TUN));
192 writel(0x88888888, CREG_AXI_M_SLV1(M_AXI_TUN));
193 writel(0xFEDCBA98, CREG_AXI_M_OFT0(M_AXI_TUN));
194 writel(0x76543210, CREG_AXI_M_OFT1(M_AXI_TUN));
195 writel(UPDATE_VAL, CREG_AXI_M_UPDT(M_AXI_TUN));
196
197 writel(0x77777777, CREG_AXI_M_SLV0(M_HDMI_VIDEO));
198 writel(0x77777777, CREG_AXI_M_SLV1(M_HDMI_VIDEO));
199 writel(0xFEDCBA98, CREG_AXI_M_OFT0(M_HDMI_VIDEO));
200 writel(0x76543210, CREG_AXI_M_OFT1(M_HDMI_VIDEO));
201 writel(UPDATE_VAL, CREG_AXI_M_UPDT(M_HDMI_VIDEO));
202
203 writel(0x77777777, CREG_AXI_M_SLV0(M_HDMI_AUDIO));
204 writel(0x77777777, CREG_AXI_M_SLV1(M_HDMI_AUDIO));
205 writel(0xFEDCBA98, CREG_AXI_M_OFT0(M_HDMI_AUDIO));
206 writel(0x76543210, CREG_AXI_M_OFT1(M_HDMI_AUDIO));
207 writel(UPDATE_VAL, CREG_AXI_M_UPDT(M_HDMI_AUDIO));
208
209 writel(0x77777777, CREG_AXI_M_SLV0(M_USB_HOST));
210 writel(0x77999999, CREG_AXI_M_SLV1(M_USB_HOST));
211 writel(0xFEDCBA98, CREG_AXI_M_OFT0(M_USB_HOST));
212 writel(0x76DCBA98, CREG_AXI_M_OFT1(M_USB_HOST));
213 writel(UPDATE_VAL, CREG_AXI_M_UPDT(M_USB_HOST));
214
215 writel(0x77777777, CREG_AXI_M_SLV0(M_ETHERNET));
216 writel(0x77999999, CREG_AXI_M_SLV1(M_ETHERNET));
217 writel(0xFEDCBA98, CREG_AXI_M_OFT0(M_ETHERNET));
218 writel(0x76DCBA98, CREG_AXI_M_OFT1(M_ETHERNET));
219 writel(UPDATE_VAL, CREG_AXI_M_UPDT(M_ETHERNET));
220
221 writel(0x77777777, CREG_AXI_M_SLV0(M_SDIO));
222 writel(0x77999999, CREG_AXI_M_SLV1(M_SDIO));
223 writel(0xFEDCBA98, CREG_AXI_M_OFT0(M_SDIO));
224 writel(0x76DCBA98, CREG_AXI_M_OFT1(M_SDIO));
225 writel(UPDATE_VAL, CREG_AXI_M_UPDT(M_SDIO));
226
227 writel(0x77777777, CREG_AXI_M_SLV0(M_GPU));
228 writel(0x77777777, CREG_AXI_M_SLV1(M_GPU));
229 writel(0xFEDCBA98, CREG_AXI_M_OFT0(M_GPU));
230 writel(0x76543210, CREG_AXI_M_OFT1(M_GPU));
231 writel(UPDATE_VAL, CREG_AXI_M_UPDT(M_GPU));
232
233 writel(0x77777777, CREG_AXI_M_SLV0(M_DMAC_0));
234 writel(0x77777777, CREG_AXI_M_SLV1(M_DMAC_0));
235 writel(0xFEDCBA98, CREG_AXI_M_OFT0(M_DMAC_0));
236 writel(0x76543210, CREG_AXI_M_OFT1(M_DMAC_0));
237 writel(UPDATE_VAL, CREG_AXI_M_UPDT(M_DMAC_0));
238
239 writel(0x77777777, CREG_AXI_M_SLV0(M_DMAC_1));
240 writel(0x77777777, CREG_AXI_M_SLV1(M_DMAC_1));
241 writel(0xFEDCBA98, CREG_AXI_M_OFT0(M_DMAC_1));
242 writel(0x76543210, CREG_AXI_M_OFT1(M_DMAC_1));
243 writel(UPDATE_VAL, CREG_AXI_M_UPDT(M_DMAC_1));
244
245 writel(0x00000000, CREG_AXI_M_SLV0(M_DVFS));
246 writel(0x60000000, CREG_AXI_M_SLV1(M_DVFS));
247 writel(0x00000000, CREG_AXI_M_OFT0(M_DVFS));
248 writel(0x00000000, CREG_AXI_M_OFT1(M_DVFS));
249 writel(UPDATE_VAL, CREG_AXI_M_UPDT(M_DVFS));
250
107 /* 251 /*
108 * PAE remapping for DMA clients does not work due to an RTL bug, so 252 * PAE remapping for DMA clients does not work due to an RTL bug, so
109 * CREG_PAE register must be programmed to all zeroes, otherwise it 253 * CREG_PAE register must be programmed to all zeroes, otherwise it
110 * will cause problems with DMA to/from peripherals even if PAE40 is 254 * will cause problems with DMA to/from peripherals even if PAE40 is
111 * not used. 255 * not used.
112 */ 256 */
257 writel(0x00000000, CREG_PAE);
258 writel(UPDATE_VAL, CREG_PAE_UPDT);
259}
113 260
114 /* Default is 1, which means "PAE offset = 4GByte" */ 261static void __init hsdk_init_early(void)
115 writel_relaxed(0, (void __iomem *) CREG_PAE); 262{
116 263 hsdk_init_memory_bridge();
117 /* Really apply settings made above */
118 writel(1, (void __iomem *) CREG_PAE_UPDATE);
119 264
120 /* 265 /*
121 * Switch SDIO external ciu clock divider from default div-by-8 to 266 * Switch SDIO external ciu clock divider from default div-by-8 to