Skip to contentSkip to conversation

ARM: S5PC210: Set the common L2 cache configurations

PATCH New Kyungmin Park 2 participants 3 messages Sep 30, 2010 – Oct 5, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 3/3 ARM: S5PC210: Set the common L2 cache configurations

From: Kyungmin Park <[email protected]>

S5PC210 has PL310 1MiB L2 cache.
It uses the optimized data & tag latency and also enable the prefetch.

---
 arch/arm/mach-s5pv310/cpu.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
arch/arm/mach-s5pv310/cpu.c +19 -0
index e5b261a..b50312e 100644
@@ -15,6 +15,7 @@
 #include <asm/mach/irq.h>
 
 #include <asm/proc-fns.h>
+#include <asm/hardware/cache-l2x0.h>
 
 #include <plat/cpu.h>
 #include <plat/clock.h>
@@ -121,6 +122,24 @@ static int __init s5pv310_core_init(void)
 
 core_initcall(s5pv310_core_init);
 
+static int __init s5pv310_init_cache(void)
+{
+#ifdef CONFIG_CACHE_L2X0
+	void __iomem *p = S5P_VA_L2CC;
+
+	/* TAG,  Data latency control */
+	writel(0x110, p + L2X0_TAG_LATENCY_CTRL);
+	writel(0x110, p + L2X0_DATA_LATENCY_CTRL);
+
+	/* L2 cache prefetch control */
+	writel(0x30000007, p + L2X0_PREFETCH_CTRL);
+
+	l2x0_init(p, 0x3C070001, 0xC200FFFF);
+#endif
+	return 0;
+}
+early_initcall(s5pv310_init_cache);
+
 int __init s5pv310_init(void)
 {
 	printk(KERN_INFO "S5PV310: Initializing architecture\n");
Signature · 1 line
1.5.3.3
#1 lore raw

PATCH v2 3/3 ARM: S5PC210: Set the common L2 cache configurations

Quoted 24 lines · Kyungmin Park

From: Kyungmin Park <[email protected]>

S5PC210 has PL310 1MiB L2 cache.
It uses the optimized data & tag latency and also enable the prefetch.

---
 arch/arm/mach-s5pv310/cpu.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
arch/arm/mach-s5pv310/cpu.c +1 -0
index e5b261a..b50312e 100644
@@ -15,6 +15,7 @@
 #include <asm/mach/irq.h>
 
 #include <asm/proc-fns.h>
+#include <asm/hardware/cache-l2x0.h>
 
 #include <plat/cpu.h>
 #include <plat/clock.h>

arch/arm/mach-s5pv310/cpu.c static int __init s5pv310_core_init(void) · line 125

Quoted 4 lines
arch/arm/mach-s5pv310/cpu.c +1 -0
@@ -121,6 +122,24 @@ static int __init s5pv310_core_init(void)
 
 core_initcall(s5pv310_core_init);
 
+static int __init s5pv310_init_cache(void)

It would be helpful that could use more detailed function name like s5pv310_l2x0_cache_init().

arch/arm/mach-s5pv310/cpu.c static int __init s5pv310_core_init(void) · line 132

Quoted 7 lines
arch/arm/mach-s5pv310/cpu.c +7 -0
+{
+#ifdef CONFIG_CACHE_L2X0
+	void __iomem *p = S5P_VA_L2CC;
+
+	/* TAG,  Data latency control */
+	writel(0x110, p + L2X0_TAG_LATENCY_CTRL);
+	writel(0x110, p + L2X0_DATA_LATENCY_CTRL);

I still thinking, __raw_writel is more suitable here... Because no need to add barriers between each write here.

arch/arm/mach-s5pv310/cpu.c static int __init s5pv310_core_init(void) · line 137

Quoted 5 lines
arch/arm/mach-s5pv310/cpu.c +5 -0
+
+	/* L2 cache prefetch control */
+	writel(0x30000007, p + L2X0_PREFETCH_CTRL);
+
+	l2x0_init(p, 0x3C070001, 0xC200FFFF);

0x7C070001 is better...or should be?...because it is for early write response.
I think need it for optimization...so please change it.

And it'd better if you could add PL310(L2 cache controller) power control here.
It can help to reduce power consumption.

arch/arm/mach-s5pv310/cpu.c static int __init s5pv310_core_init(void) · line 142

Quoted 5 lines
arch/arm/mach-s5pv310/cpu.c +5 -0
+#endif
+	return 0;
+}
+early_initcall(s5pv310_init_cache);
+

And in my opinion, following format is better even if do not consider the coding-style.
Because if not defined CACHE_L2X0, no need to add empty function into early_initcall().

#ifdef CONFIG_CACHE_L2X0
static int __init s5pv310_l2x0_cache_init(void)
{

/* */

	return 0;
}

early_initcall(s5p_l2x0_cache_init);
#endif

arch/arm/mach-s5pv310/cpu.c static int __init s5pv310_core_init(void)

Quoted 4 lines
arch/arm/mach-s5pv310/cpu.c +0 -1
 int __init s5pv310_init(void)
 {
 	printk(KERN_INFO "S5PV310: Initializing architecture\n");
--

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

#2 lore raw

PATCH v2 3/3 ARM: S5PC210: Set the common L2 cache configurations

Quoted 33 lines · Kukjin Kim
Quoted 24 lines · Kyungmin Park

From: Kyungmin Park <[email protected]>

S5PC210 has PL310 1MiB L2 cache.
It uses the optimized data & tag latency and also enable the prefetch.

---
?arch/arm/mach-s5pv310/cpu.c | ? 19 +++++++++++++++++++ ?1 files changed, 19 insertions(+), 0 deletions(-)

arch/arm/mach-s5pv310/cpu.c +0 -0
index e5b261a..b50312e 100644
@@ -15,6 +15,7 @@

?#include <asm/mach/irq.h>

?#include <asm/proc-fns.h>
+#include <asm/hardware/cache-l2x0.h>

?#include <plat/cpu.h>
?#include <plat/clock.h>

arch/arm/mach-s5pv310/cpu.c static int __init s5pv310_core_init(void) · line 125

Quoted 4 lines
arch/arm/mach-s5pv310/cpu.c +1 -0
@@ -121,6 +122,24 @@ static int __init s5pv310_core_init(void)
 
 ?core_initcall(s5pv310_core_init);
 
+static int __init s5pv310_init_cache(void)

It would be helpful that could use more detailed function name like s5pv310_l2x0_cache_init().

Quoted 10 lines

arch/arm/mach-s5pv310/cpu.c static int __init s5pv310_core_init(void) · line 132

Quoted 7 lines
arch/arm/mach-s5pv310/cpu.c +7 -0
+{
+#ifdef CONFIG_CACHE_L2X0
+ ? ? void __iomem *p = S5P_VA_L2CC;
+
+ ? ? /* TAG, ?Data latency control */
+ ? ? writel(0x110, p + L2X0_TAG_LATENCY_CTRL);
+ ? ? writel(0x110, p + L2X0_DATA_LATENCY_CTRL);

I still thinking, __raw_writel is more suitable here... Because no need to add barriers between each write here.

I think It's micro optimization.

Quoted 10 lines

arch/arm/mach-s5pv310/cpu.c static int __init s5pv310_core_init(void) · line 137

Quoted 6 lines
arch/arm/mach-s5pv310/cpu.c +5 -0
+
+ ? ? /* L2 cache prefetch control */
+ ? ? writel(0x30000007, p + L2X0_PREFETCH_CTRL);
+
+ ? ? l2x0_init(p, 0x3C070001, 0xC200FFFF);

0x7C070001 is better...or should be?...because it is for early write response.
I think need it for optimization...so please change it.

Send the official documents, At the latest Info. LSI said it's no performance gain at there.

Quoted 43 lines

And it'd better if you could add PL310(L2 cache controller) power control here.
It can help to reduce power consumption.

arch/arm/mach-s5pv310/cpu.c static int __init s5pv310_core_init(void) · line 142

Quoted 5 lines
arch/arm/mach-s5pv310/cpu.c +5 -0
+#endif
+ ? ? return 0;
+}
+early_initcall(s5pv310_init_cache);
+

And in my opinion, following format is better even if do not consider the coding-style.
Because if not defined CACHE_L2X0, no need to add empty function into early_initcall().

#ifdef CONFIG_CACHE_L2X0
static int __init s5pv310_l2x0_cache_init(void)
{

/* */

? ? ? ?return 0;
}
early_initcall(s5p_l2x0_cache_init);
#endif

arch/arm/mach-s5pv310/cpu.c static int __init s5pv310_core_init(void)

Quoted 4 lines
arch/arm/mach-s5pv310/cpu.c +0 -1
 ?int __init s5pv310_init(void)
 ?{
 ? ? ? printk(KERN_INFO "S5PV310: Initializing architecture\n");
--

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.