Skip to contentSkip to conversation

ARM: shmobile: r8a7740/armadillo: Migrate to generic l2c OF

PATCH Superseded Geert Uytterhoeven 3 participants 12 messages Feb 4, 2015

Subsystems (5)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Geert Uytterhoeven

author maintainer
#0 lore raw

v2 cover ARM: shmobile: r8a7740/armadillo: Migrate to generic l2c OF

Hi Simon, Magnus,

This patch series migrates the DT-based generic r8a7740 platform and the armadillo legacy platform from calling l2x0_of_init() to the generic l2c OF initialization.

Changes in v2:
- Fix interrupt reference in DT,
- Describe L2 better in DT,
- Keep only {,~}L2C_AUX_CTRL_SHARED_OVERRIDE in machine_desc.l2c_aux_{val,mask}, as there's no DT property for this.
- Add L1 cache to DT.

Dependencies:
- The first patch depends on r8a7740 DT PM Domain support (tag renesas-dt2-for-v3.20 in Simon's repository),
- Although there are separate patches for dtsi, SoC code, and board code, there are dependencies among the individual patches:
- patches 2, 3, and 5 depend on patch 1,
- patch 4 depends on patches 2 and 3 (and thus 1).

Note that this conversion should be done on sh73a0, r8a7778, and r8a7779, too.

This was tested on armadillo-legacy and armadillo-multiplatform.

Thanks!

Geert Uytterhoeven (5):
ARM: shmobile: r8a7740 dtsi: Add cache-controller node
ARM: shmobile: r8a7740: Migrate to generic l2c OF initialization
ARM: shmobile: armadillo legacy: Migrate to generic l2c OF
initialization
ARM: shmobile: r8a7740: Remove mapping of L2 cache controller
registers
ARM: shmobile: r8a7740: Add L1 cache information to CPU node

 arch/arm/boot/dts/r8a7740.dtsi                 | 24 ++++++++++++++++++++++++
 arch/arm/mach-shmobile/board-armadillo800eva.c |  8 ++------
 arch/arm/mach-shmobile/setup-r8a7740.c         | 18 ++----------------
 3 files changed, 28 insertions(+), 22 deletions(-)
Signature · 12 lines
1.9.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds
author maintainer
#1 lore raw

PATCH v2 1/5 ARM: shmobile: r8a7740 dtsi: Add cache-controller node

Add the missing cache-controller node. This will allow migration to the generic l2c OF initialization.

The L2 cache is an ARM L2C-310 (r3p1-150rel0), of size 256 KiB (32 KiB x 8 ways).

---
This depends on "ARM: shmobile: r8a7740 dtsi: Add PM domain support" due to the pd_a3sm reference.

v2:
- Fix interrupt (should be 3 cells, not 1),
- Describe cache better.

---
 arch/arm/boot/dts/r8a7740.dtsi | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/arm/boot/dts/r8a7740.dtsi +15 -0
index 83c1c3ca1b8f1400..c84a99931e30304c 100644
@@ -37,6 +37,21 @@
 		      <0xc2000000 0x1000>;
 	};
 
+	L2: cache-controller {
+		compatible = "arm,pl310-cache";
+		reg = <0xf0100000 0x1000>;
+		interrupts = <0 84 IRQ_TYPE_LEVEL_HIGH>;
+		power-domains = <&pd_a3sm>;
+		arm,data-latency = <3 3 3>;
+		arm,tag-latency = <2 2 2>;
+		cache-unified;
+		cache-level = <2>;
+		cache-size = <0x40000>;
+		cache-sets = <1024>;
+		cache-block-size = <32>;
+		cache-line-size = <32>;
+	};
+
 	dbsc3: memory-controller at fe400000 {
 		compatible = "renesas,dbsc3-r8a7740";
 		reg = <0xfe400000 0x400>;
Signature · 1 line
1.9.1
author maintainer
#2 lore raw

PATCH v2 2/5 ARM: shmobile: r8a7740: Migrate to generic l2c OF initialization

In reply to Geert Uytterhoeven

Migrate the generic r8a7740 platform from calling l2x0_of_init() to the generic l2c OF initialization.

---
v2
- Keep only {,~}L2C_AUX_CTRL_SHARED_OVERRIDE

---
 arch/arm/mach-shmobile/setup-r8a7740.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
arch/arm/mach-shmobile/setup-r8a7740.c +2 -4
index d191cf4197313482..3ebd4dfc8e853a9b 100644
@@ -835,10 +835,6 @@ static void __init r8a7740_generic_init(void)
 {
 	r8a7740_meram_workaround();
 
-#ifdef CONFIG_CACHE_L2X0
-	/* Shared attribute override enable, 32K*8way */
-	l2x0_init(IOMEM(0xf0002000), 0x00400000, 0xc20f0fff);
-#endif
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 }
 
@@ -855,6 +851,8 @@ static const char *r8a7740_boards_compat_dt[] __initdata = {
 };
 
 DT_MACHINE_START(R8A7740_DT, "Generic R8A7740 (Flattened Device Tree)")
+	.l2c_aux_val	= L2C_AUX_CTRL_SHARED_OVERRIDE,
+	.l2c_aux_mask	= ~L2C_AUX_CTRL_SHARED_OVERRIDE,
 	.map_io		= r8a7740_map_io,
 	.init_early	= shmobile_init_delay,
 	.init_irq	= r8a7740_init_irq_of,
Signature · 1 line
1.9.1
#3 lore raw

PATCH v2 2/5 ARM: shmobile: r8a7740: Migrate to generic l2c OF initialization

arch/arm/mach-shmobile/setup-r8a7740.c static const char *r8a7740_boards_compat_dt[] __initdata = { · line 858

Quoted 6 lines · On Wednesday 04 February 2015 15:15:12 Geert Uytterhoeven wrote:

DT_MACHINE_START(R8A7740_DT, "Generic R8A7740 (Flattened Device Tree)")

arch/arm/mach-shmobile/setup-r8a7740.c +2 -0
+       .l2c_aux_val    = L2C_AUX_CTRL_SHARED_OVERRIDE,
+       .l2c_aux_mask   = ~L2C_AUX_CTRL_SHARED_OVERRIDE,
        .map_io         = r8a7740_map_io,
        .init_early     = shmobile_init_delay,
        .init_irq       = r8a7740_init_irq_of,

+Russell

I'd hope we could avoid having any overrides in here that are not specified in DT. I can never remember what we discussed about particular bits in the past though. Is this bit something we could add a binding for, or could we make it enabled by default?

I assume you have to add it because the boot loader sets the wrong default, right?

Arnd

#4 lore raw

PATCH v2 2/5 ARM: shmobile: r8a7740: Migrate to generic l2c OF initialization

Hi Arnd,

Quoted 10 lines · Arnd Bergmann

arch/arm/mach-shmobile/setup-r8a7740.c static const char *r8a7740_boards_compat_dt[] __initdata = { · line 858

Quoted 6 lines · On Wednesday 04 February 2015 15:15:12 Geert Uytterhoeven wrote:

DT_MACHINE_START(R8A7740_DT, "Generic R8A7740 (Flattened Device Tree)")

arch/arm/mach-shmobile/setup-r8a7740.c +2 -0
+       .l2c_aux_val    = L2C_AUX_CTRL_SHARED_OVERRIDE,
+       .l2c_aux_mask   = ~L2C_AUX_CTRL_SHARED_OVERRIDE,
        .map_io         = r8a7740_map_io,
        .init_early     = shmobile_init_delay,
        .init_irq       = r8a7740_init_irq_of,

+Russell

Quoted 7 lines

I'd hope we could avoid having any overrides in here that are not specified in DT. I can never remember what we discussed about particular bits in the past though. Is this bit something we could add a binding for, or could we make it enabled by default?

I assume you have to add it because the boot loader sets the wrong default, right?

Indeed. Note that I only try to preserve the register value before and after migrating to generic l2c OF initialization. I did read (part of) the pl310 documentation, but it's still not clear to me if we really need L2C_AUX_CTRL_SHARED_OVERRIDE. Perhaps this was just copied from somewhere else without much afterthought?

The previous version was in thread
http://lists.infradead.org/pipermail/linux-arm-kernel/2015-January/318328.html

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#5 lore raw

PATCH v2 2/5 ARM: shmobile: r8a7740: Migrate to generic l2c OF initialization

Quoted 6 lines · On Wednesday 04 February 2015 15:43:43 Geert Uytterhoeven wrote:

Indeed. Note that I only try to preserve the register value before and after migrating to generic l2c OF initialization. I did read (part of) the pl310 documentation, but it's still not clear to me if we really need L2C_AUX_CTRL_SHARED_OVERRIDE. Perhaps this was just copied from somewhere else without much afterthought?

Have you checked what the hardware/bootloader actually sets in that bit?

Maybe you can remove that override completely and the initial Linux default was just set to the same that is already set on powerup?

Arnd

#6 lore raw

PATCH v2 2/5 ARM: shmobile: r8a7740: Migrate to generic l2c OF initialization

Hi Arnd,

Quoted 9 lines · Arnd Bergmann
Quoted 6 lines · On Wednesday 04 February 2015 15:43:43 Geert Uytterhoeven wrote:

Indeed. Note that I only try to preserve the register value before and after migrating to generic l2c OF initialization. I did read (part of) the pl310 documentation, but it's still not clear to me if we really need L2C_AUX_CTRL_SHARED_OVERRIDE. Perhaps this was just copied from somewhere else without much afterthought?

Have you checked what the hardware/bootloader actually sets in that bit?

Yes, it boots with 0x02040000, i.e. L2C_AUX_CTRL_SHARED_OVERRIDE (bit 22) is not set.

After the l2c driver is finished with it, it contains 0x46440001.

Quoted 2 lines

Maybe you can remove that override completely and the initial Linux default was just set to the same that is already set on powerup?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#7 lore raw

PATCH v2 2/5 ARM: shmobile: r8a7740: Migrate to generic l2c OF initialization

Quoted 9 lines · On Wednesday 04 February 2015 18:04:57 Geert Uytterhoeven wrote:
Quoted 8 lines · Arnd Bergmann
Quoted 6 lines · On Wednesday 04 February 2015 15:43:43 Geert Uytterhoeven wrote:

Indeed. Note that I only try to preserve the register value before and after migrating to generic l2c OF initialization. I did read (part of) the pl310 documentation, but it's still not clear to me if we really need L2C_AUX_CTRL_SHARED_OVERRIDE. Perhaps this was just copied from somewhere else without much afterthought?

Quoted 6 lines
Quoted 1 line

Have you checked what the hardware/bootloader actually sets in that bit?

Yes, it boots with 0x02040000, i.e. L2C_AUX_CTRL_SHARED_OVERRIDE (bit 22) is not set.

After the l2c driver is finished with it, it contains 0x46440001.

I see. I guess someone understand the effect of this flag. Does it make a difference on the machine you are looking at?

I've read the spec at http://infocenter.arm.com/help/topic/com.arm.doc.ddi0246a/DDI0246A_l2cc_pl310_r0p0_trm.pdf
on the topic but couldn't make sense of it to understand whether a
particular setting might be required for specific hardware or might
be a performance optimization.

Arnd

#8 lore raw

PATCH v2 2/5 ARM: shmobile: r8a7740: Migrate to generic l2c OF initialization

Hi Arnd,

Quoted 12 lines · Arnd Bergmann
Quoted 11 lines · On Wednesday 04 February 2015 18:04:57 Geert Uytterhoeven wrote:
Quoted 9 lines · Arnd Bergmann
Quoted 6 lines · On Wednesday 04 February 2015 15:43:43 Geert Uytterhoeven wrote:

Indeed. Note that I only try to preserve the register value before and after migrating to generic l2c OF initialization. I did read (part of) the pl310 documentation, but it's still not clear to me if we really need L2C_AUX_CTRL_SHARED_OVERRIDE. Perhaps this was just copied from somewhere else without much afterthought?

Have you checked what the hardware/bootloader actually sets in that bit?

Quoted 7 lines
Quoted 4 lines

Yes, it boots with 0x02040000, i.e. L2C_AUX_CTRL_SHARED_OVERRIDE (bit 22) is not set.

After the l2c driver is finished with it, it contains 0x46440001.

I see. I guess someone understand the effect of this flag. Does it make a difference on the machine you are looking at?

Nope. I booted it without, too. No obvious differences.

Quoted 4 lines

I've read the spec at http://infocenter.arm.com/help/topic/com.arm.doc.ddi0246a/DDI0246A_l2cc_pl310_r0p0_trm.pdf
on the topic but couldn't make sense of it to understand whether a
particular setting might be required for specific hardware or might
be a performance optimization.

Thanks! Ah, so I'm not alone...

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

author maintainer
#9 lore raw

PATCH v2 3/5 ARM: shmobile: armadillo legacy: Migrate to generic l2c OF initialization

In reply to Geert Uytterhoeven

Migrate the generic r8a7740 platform from calling l2x0_of_init() to the generic l2c OF initialization.

---
v2
- Keep only {,~}L2C_AUX_CTRL_SHARED_OVERRIDE

---
 arch/arm/mach-shmobile/board-armadillo800eva.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
arch/arm/mach-shmobile/board-armadillo800eva.c +2 -6
index 6d949f1c850bda8b..c3261dc2fc009db5 100644
@@ -1309,12 +1309,6 @@ static void __init eva_init(void)
 		sdhi1 = &sdhi1_device;
 	}
 
-
-#ifdef CONFIG_CACHE_L2X0
-	/* Shared attribute override enable, 32K*8way */
-	l2x0_init(IOMEM(0xf0002000), 0x00400000, 0xc20f0fff);
-#endif
-
 	i2c_register_board_info(0, i2c0_devices, ARRAY_SIZE(i2c0_devices));
 	i2c_register_board_info(2, i2c2_devices, ARRAY_SIZE(i2c2_devices));
 
@@ -1355,6 +1349,8 @@ static const char *eva_boards_compat_dt[] __initdata = {
 };
 
 DT_MACHINE_START(ARMADILLO800EVA_DT, "armadillo800eva")
+	.l2c_aux_val	= L2C_AUX_CTRL_SHARED_OVERRIDE,
+	.l2c_aux_mask	= ~L2C_AUX_CTRL_SHARED_OVERRIDE,
 	.map_io		= r8a7740_map_io,
 	.init_early	= r8a7740_add_early_devices,
 	.init_irq	= r8a7740_init_irq_of,
Signature · 1 line
1.9.1
author maintainer
#10 lore raw

PATCH v2 4/5 ARM: shmobile: r8a7740: Remove mapping of L2 cache controller registers

In reply to Geert Uytterhoeven

Now all r8a7740-based platforms have been migrated to the generic l2c OF initialization, it's no longer needed to map the L2 cache controller registers from .map_io().

---
v2:
- No changes.

---
 arch/arm/mach-shmobile/setup-r8a7740.c | 12 ------------
 1 file changed, 12 deletions(-)
arch/arm/mach-shmobile/setup-r8a7740.c +0 -12
index 3ebd4dfc8e853a9b..ab005e2a0cde6892 100644
@@ -51,18 +51,6 @@ static struct map_desc r8a7740_io_desc[] __initdata = {
 		.length		= 160 << 20,
 		.type		= MT_DEVICE_NONSHARED
 	},
-#ifdef CONFIG_CACHE_L2X0
-	/*
-	 * for l2x0_init()
-	 * 0xf0100000-0xf0101000 -> 0xf0002000-0xf0003000
-	 */
-	{
-		.virtual	= 0xf0002000,
-		.pfn		= __phys_to_pfn(0xf0100000),
-		.length		= PAGE_SIZE,
-		.type		= MT_DEVICE_NONSHARED
-	},
-#endif
 };
 
 void __init r8a7740_map_io(void)
Signature · 1 line
1.9.1
author maintainer
#11 lore raw

PATCH v2 5/5 ARM: shmobile: r8a7740: Add L1 cache information to CPU node

In reply to Geert Uytterhoeven

Describe the L1 cache in the CPU node:
- L1 instruction cache: 32 KiB (8 KiB x 4 ways),
- L1 data cache: 32 KiB (8 KiB x 4 ways).

Add a link to the L2 cache.

---
v2:
- New.

---
 arch/arm/boot/dts/r8a7740.dtsi | 9 +++++++++
 1 file changed, 9 insertions(+)
arch/arm/boot/dts/r8a7740.dtsi +9 -0
index c84a99931e30304c..81c26cf63ba0e78d 100644
@@ -26,6 +26,15 @@
 			reg = <0x0>;
 			clock-frequency = <800000000>;
 			power-domains = <&pd_a3sm>;
+			i-cache-size = <0x8000>;
+			i-cache-sets = <256>;
+			i-cache-block-size = <32>;
+			i-cache-line-size = <32>;
+			d-cache-size = <0x8000>;
+			d-cache-sets = <256>;
+			d-cache-block-size = <32>;
+			d-cache-line-size = <32>;
+			next-level-cache = <&L2>;
 		};
 	};
 
Signature · 1 line
1.9.1