aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Vorontsov <avorontsov@mvista.com>2011-07-06 08:45:09 -0400
committerAnton Vorontsov <avorontsov@mvista.com>2011-07-07 10:48:38 -0400
commit93e85d8e902e1a4468c6ade5c6ec3dd3055a489f (patch)
treed6ee8fdc4609b35f7b903d9b1e8cb07f4abe12db
parent00d2711d700ae77b5bb66ea7c73eaa2cf155fa97 (diff)
ARM: cns3xxx: Add support for L2 Cache Controller
CNS3xxx SOCs have L310-compatible cache controller, so let's use it. With this patch benchmarking with 'gzip' shows that performance is doubled, and I'm still able to boot full-fledged userland over NFS (using PCIe NIC), so the support should be pretty robust. p.s. While CNS3xxx reports that it has PL310, it still needs to wait on cache line operations, so we should not select 'CACHE_PL310', which is a micro-optimization that removes these waits for v7 CPUs. Someday we'd better rename CACHE_PL310 Kconfig option into NO_CACHE_WAIT or something less ambiguous. Signed-off-by: Anton Vorontsov <avorontsov@mvista.com>
-rw-r--r--arch/arm/mach-cns3xxx/cns3420vb.c2
-rw-r--r--arch/arm/mach-cns3xxx/core.c43
-rw-r--r--arch/arm/mach-cns3xxx/core.h6
-rw-r--r--arch/arm/mm/Kconfig2
4 files changed, 52 insertions, 1 deletions
diff --git a/arch/arm/mach-cns3xxx/cns3420vb.c b/arch/arm/mach-cns3xxx/cns3420vb.c
index 08e5c8759502..4b804baa5f80 100644
--- a/arch/arm/mach-cns3xxx/cns3420vb.c
+++ b/arch/arm/mach-cns3xxx/cns3420vb.c
@@ -170,6 +170,8 @@ static struct platform_device *cns3420_pdevs[] __initdata = {
170 170
171static void __init cns3420_init(void) 171static void __init cns3420_init(void)
172{ 172{
173 cns3xxx_l2x0_init();
174
173 platform_add_devices(cns3420_pdevs, ARRAY_SIZE(cns3420_pdevs)); 175 platform_add_devices(cns3420_pdevs, ARRAY_SIZE(cns3420_pdevs));
174 176
175 cns3xxx_ahci_init(); 177 cns3xxx_ahci_init();
diff --git a/arch/arm/mach-cns3xxx/core.c b/arch/arm/mach-cns3xxx/core.c
index da30078a80c1..941a308e1253 100644
--- a/arch/arm/mach-cns3xxx/core.c
+++ b/arch/arm/mach-cns3xxx/core.c
@@ -16,6 +16,7 @@
16#include <asm/mach/time.h> 16#include <asm/mach/time.h>
17#include <asm/mach/irq.h> 17#include <asm/mach/irq.h>
18#include <asm/hardware/gic.h> 18#include <asm/hardware/gic.h>
19#include <asm/hardware/cache-l2x0.h>
19#include <mach/cns3xxx.h> 20#include <mach/cns3xxx.h>
20#include "core.h" 21#include "core.h"
21 22
@@ -244,3 +245,45 @@ static void __init cns3xxx_timer_init(void)
244struct sys_timer cns3xxx_timer = { 245struct sys_timer cns3xxx_timer = {
245 .init = cns3xxx_timer_init, 246 .init = cns3xxx_timer_init,
246}; 247};
248
249#ifdef CONFIG_CACHE_L2X0
250
251void __init cns3xxx_l2x0_init(void)
252{
253 void __iomem *base = ioremap(CNS3XXX_L2C_BASE, SZ_4K);
254 u32 val;
255
256 if (WARN_ON(!base))
257 return;
258
259 /*
260 * Tag RAM Control register
261 *
262 * bit[10:8] - 1 cycle of write accesses latency
263 * bit[6:4] - 1 cycle of read accesses latency
264 * bit[3:0] - 1 cycle of setup latency
265 *
266 * 1 cycle of latency for setup, read and write accesses
267 */
268 val = readl(base + L2X0_TAG_LATENCY_CTRL);
269 val &= 0xfffff888;
270 writel(val, base + L2X0_TAG_LATENCY_CTRL);
271
272 /*
273 * Data RAM Control register
274 *
275 * bit[10:8] - 1 cycles of write accesses latency
276 * bit[6:4] - 1 cycles of read accesses latency
277 * bit[3:0] - 1 cycle of setup latency
278 *
279 * 1 cycle of latency for setup, read and write accesses
280 */
281 val = readl(base + L2X0_DATA_LATENCY_CTRL);
282 val &= 0xfffff888;
283 writel(val, base + L2X0_DATA_LATENCY_CTRL);
284
285 /* 32 KiB, 8-way, parity disable */
286 l2x0_init(base, 0x00540000, 0xfe000fff);
287}
288
289#endif /* CONFIG_CACHE_L2X0 */
diff --git a/arch/arm/mach-cns3xxx/core.h b/arch/arm/mach-cns3xxx/core.h
index ffeb3a8b73ba..fcd225343c61 100644
--- a/arch/arm/mach-cns3xxx/core.h
+++ b/arch/arm/mach-cns3xxx/core.h
@@ -13,6 +13,12 @@
13 13
14extern struct sys_timer cns3xxx_timer; 14extern struct sys_timer cns3xxx_timer;
15 15
16#ifdef CONFIG_CACHE_L2X0
17void __init cns3xxx_l2x0_init(void);
18#else
19static inline void cns3xxx_l2x0_init(void) {}
20#endif /* CONFIG_CACHE_L2X0 */
21
16void __init cns3xxx_map_io(void); 22void __init cns3xxx_map_io(void);
17void __init cns3xxx_init_irq(void); 23void __init cns3xxx_init_irq(void);
18void cns3xxx_power_off(void); 24void cns3xxx_power_off(void);
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index 0074b8dba793..cb26d49a8cd6 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -821,7 +821,7 @@ config CACHE_L2X0
821 depends on REALVIEW_EB_ARM11MP || MACH_REALVIEW_PB11MP || MACH_REALVIEW_PB1176 || \ 821 depends on REALVIEW_EB_ARM11MP || MACH_REALVIEW_PB11MP || MACH_REALVIEW_PB1176 || \
822 REALVIEW_EB_A9MP || SOC_IMX35 || SOC_IMX31 || MACH_REALVIEW_PBX || \ 822 REALVIEW_EB_A9MP || SOC_IMX35 || SOC_IMX31 || MACH_REALVIEW_PBX || \
823 ARCH_NOMADIK || ARCH_OMAP4 || ARCH_EXYNOS4 || ARCH_TEGRA || \ 823 ARCH_NOMADIK || ARCH_OMAP4 || ARCH_EXYNOS4 || ARCH_TEGRA || \
824 ARCH_U8500 || ARCH_VEXPRESS_CA9X4 || ARCH_SHMOBILE 824 ARCH_U8500 || ARCH_VEXPRESS_CA9X4 || ARCH_SHMOBILE || ARCH_CNS3XXX
825 default y 825 default y
826 select OUTER_CACHE 826 select OUTER_CACHE
827 select OUTER_CACHE_SYNC 827 select OUTER_CACHE_SYNC