Skip to contentSkip to conversation

ARM: tegra: dt: add L2 cache controller

PATCH Superseded Joseph Lo 2 participants 5 messages Oct 26, 2012 – Oct 29, 2012

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Joseph Lo

author
#0 lore raw

PATCH 1/2 ARM: tegra: dt: add L2 cache controller

Add L2 cache controller binding into DT for Tegra.

---
 arch/arm/boot/dts/tegra20.dtsi |    9 +++++++++
 arch/arm/boot/dts/tegra30.dtsi |    9 +++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)
arch/arm/boot/dts/tegra20.dtsi +9 -0
index 6934bca..be18361 100644
@@ -4,6 +4,15 @@
 	compatible = "nvidia,tegra20";
 	interrupt-parent = <&intc>;
 
+	L2: cache-controller at 50043000 {
+		compatible = "arm,pl310-cache";
+		reg = <0x50043000 0x1000>;
+		arm,data-latency = <5 5 2>;
+		arm,tag-latency = <4 4 2>;
+		cache-unified;
+		cache-level = <2>;
+	};
+
 	timer at 50004600 {
 		compatible = "arm,cortex-a9-twd-timer";
 		reg = <0x50040600 0x20>;
arch/arm/boot/dts/tegra30.dtsi +9 -0
index 81f5df4..71da933 100644
@@ -4,6 +4,15 @@
 	compatible = "nvidia,tegra30";
 	interrupt-parent = <&intc>;
 
+	L2: cache-controller at 50043000 {
+		compatible = "arm,pl310-cache";
+		reg = <0x50043000 0x1000>;
+		arm,data-latency = <6 6 2>;
+		arm,tag-latency = <5 5 2>;
+		cache-unified;
+		cache-level = <2>;
+	};
+
 	timer at 50004600 {
 		compatible = "arm,cortex-a9-twd-timer";
 		reg = <0x50040600 0x20>;
Signature · 1 line
1.7.0.4
author
#1 lore raw

PATCH 2/2 ARM: tegra: common: using OF api for L2 cache init

Moving L2 cache init to DT support.

---
 arch/arm/mach-tegra/common.c |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)
arch/arm/mach-tegra/common.c +4 -7
index 0e31f8c..a8f9175 100644
@@ -114,20 +114,17 @@ static __initdata struct tegra_clk_init_table tegra30_clk_init_table[] = {
 #endif
 
 
-static void __init tegra_init_cache(u32 tag_latency, u32 data_latency)
+static void __init tegra_init_cache(void)
 {
 #ifdef CONFIG_CACHE_L2X0
 	void __iomem *p = IO_ADDRESS(TEGRA_ARM_PERIF_BASE) + 0x3000;
 	u32 aux_ctrl, cache_type;
 
-	writel_relaxed(tag_latency, p + L2X0_TAG_LATENCY_CTRL);
-	writel_relaxed(data_latency, p + L2X0_DATA_LATENCY_CTRL);
-
 	cache_type = readl(p + L2X0_CACHE_TYPE);
 	aux_ctrl = (cache_type & 0x700) << (17-8);
 	aux_ctrl |= 0x6C000001;
 
-	l2x0_init(p, aux_ctrl, 0x8200c3fe);
+	l2x0_of_init(aux_ctrl, 0x8200c3fe);
 #endif
 
 }
@@ -139,7 +136,7 @@ void __init tegra20_init_early(void)
 	tegra_init_fuse();
 	tegra2_init_clocks();
 	tegra_clk_init_from_table(tegra20_clk_init_table);
-	tegra_init_cache(0x331, 0x441);
+	tegra_init_cache();
 	tegra_pmc_init();
 	tegra_powergate_init();
 	tegra20_hotplug_init();
@@ -152,7 +149,7 @@ void __init tegra30_init_early(void)
 	tegra_init_fuse();
 	tegra30_init_clocks();
 	tegra_clk_init_from_table(tegra30_clk_init_table);
-	tegra_init_cache(0x441, 0x551);
+	tegra_init_cache();
 	tegra_pmc_init();
 	tegra_powergate_init();
 	tegra30_hotplug_init();
Signature · 1 line
1.7.0.4
#2 lore raw

PATCH 1/2 ARM: tegra: dt: add L2 cache controller

In reply to Joseph Lo

arch/arm/boot/dts/tegra20.dtsi line 14

Quoted 12 lines · Joseph Lo

Add L2 cache controller binding into DT for Tegra.

arch/arm/boot/dts/tegra20.dtsi +8 -0
 
+	L2: cache-controller at 50043000 {
+		compatible = "arm,pl310-cache";
+		reg = <0x50043000 0x1000>;
+		arm,data-latency = <5 5 2>;
+		arm,tag-latency = <4 4 2>;
+		cache-unified;
+		cache-level = <2>;
+	};

Do you need to specify arm,filter-ranges here? It's certainly parsed by pl310_of_setup() and used if present, although I don't think we're programming the register in the existing code, so I guess we don't need it.

The L2 label above isn't necessary unless something references those nodes. Usually, that something is the cpu nodes' next-level-cache property. I don't suppose you could amend this series to also fill in Tegra's /cpus nodes in these files too?

Finally, is this series going to be a dependency for any of the cpuidle or other work you're submitting? I assume it's completely independent and hence I can throw it in any old branch in any order I feel like?

Thanks.

author
#3 lore raw

PATCH 1/2 ARM: tegra: dt: add L2 cache controller

Quoted 5 lines · Stephen Warren
Quoted 3 lines · Joseph Lo

Add L2 cache controller binding into DT for Tegra.

arch/arm/boot/dts/tegra20.dtsi +0 -0
Quoted 9 lines

arch/arm/boot/dts/tegra20.dtsi line 14

Quoted 8 lines
arch/arm/boot/dts/tegra20.dtsi +8 -0
+	L2: cache-controller at 50043000 {
+		compatible = "arm,pl310-cache";
+		reg = <0x50043000 0x1000>;
+		arm,data-latency = <5 5 2>;
+		arm,tag-latency = <4 4 2>;
+		cache-unified;
+		cache-level = <2>;
+	};

Stephen,

Thanks for review.

Quoted 4 lines

Do you need to specify arm,filter-ranges here? It's certainly parsed by pl310_of_setup() and used if present, although I don't think we're programming the register in the existing code, so I guess we don't need it.

Yes, we don't need it. Because there are HW reset value for it. We don't need to configure it.

Quoted 4 lines

The L2 label above isn't necessary unless something references those nodes. Usually, that something is the cpu nodes' next-level-cache property. I don't suppose you could amend this series to also fill in Tegra's /cpus nodes in these files too?

OK. Will remove the label.

Quoted 4 lines

Finally, is this series going to be a dependency for any of the cpuidle or other work you're submitting? I assume it's completely independent and hence I can throw it in any old branch in any order I feel like?

No. We need this before the "powered-down" cpuidle support. Because the L2 init function didn't help to hook the resume API to "outer_cache_fns" interface currently. If we don't apply this before the "powered-down" cpuidle, we will lost L2 support after one successful powered-down cpuidle sequence.

Thanks,
Joseph

#4 lore raw

PATCH 1/2 ARM: tegra: dt: add L2 cache controller

Quoted 3 lines · Joseph Lo
Quoted 2 lines · Stephen Warren
Quoted 1 line · Joseph Lo

Add L2 cache controller binding into DT for Tegra.

...

Quoted 9 lines
Quoted 3 lines

Finally, is this series going to be a dependency for any of the cpuidle or other work you're submitting? I assume it's completely independent and hence I can throw it in any old branch in any order I feel like?

No. We need this before the "powered-down" cpuidle support. Because the L2 init function didn't help to hook the resume API to "outer_cache_fns" interface currently. If we don't apply this before the "powered-down" cpuidle, we will lost L2 support after one successful powered-down cpuidle sequence.

OK, please do mention dependencies like this when posting the patches. Thanks.