Skip to contentSkip to conversation

ARM: tegra20: Add Tegra Memory Controller(MC) driver

PATCH In review Hiroshi DOYU 7 participants 34 messages May 10, 2012 – Jun 4, 2012 9 messages not in the archive

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

PATCH 1/4 ARM: tegra20: Add Tegra Memory Controller(MC) driver

Tegra Memory Controller(MC) driver for Tegra20
Added to support MC General interrupts, mainly for IOMMU(GART).

---
 .../bindings/arm/tegra/nvidia,tegra20-mc.txt       |   16 ++
 arch/arm/mach-tegra/Kconfig                        |    2 +
 drivers/memory/Kconfig                             |    4 +
 drivers/memory/Makefile                            |    1 +
 drivers/memory/tegra20-mc.c                        |  262 ++++++++++++++++++++
 5 files changed, 285 insertions(+), 0 deletions(-)
Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-mc.txt new file +16 -0
new file mode 100644
index 0000000..c25a0a5
@@ -0,0 +1,16 @@
+NVIDIA Tegra20 MC(Memory Controller)
+
+Required properties:
+- compatible : "nvidia,tegra20-mc"
+- reg : Should contain 2 register ranges(address and length); see the
+  example below. Note that the MC registers are interleaved with the
+  GART registers, and hence must be represented as multiple ranges.
+- interrupts : Should contain MC General interrupt.
+
+Example:
+	mc {
+		compatible = "nvidia,tegra20-mc";
+		reg = <0x7000f000 0x024
+		       0x7000f03c 0x3c4>;
+		interrupts = <0 77 0x04>;
+	};
arch/arm/mach-tegra/Kconfig +2 -0
index 6a113a9..abaf5d0 100644
@@ -20,6 +20,8 @@ config ARCH_TEGRA_2x_SOC
 	select PL310_ERRATA_727915 if CACHE_L2X0
 	select PL310_ERRATA_769419 if CACHE_L2X0
 	select CPU_FREQ_TABLE if CPU_FREQ
+	select MEMORY
+	select TEGRA20_MC
 	help
 	  Support for NVIDIA Tegra AP20 and T20 processors, based on the
 	  ARM CortexA9MP CPU and the ARM PL310 L2 cache controller
drivers/memory/Kconfig +4 -0
index e0b3156..ebade16 100644
@@ -20,4 +20,8 @@ config TI_EMIF
 	  parameters and other settings during frequency, voltage and
 	  temperature changes
 
+config TEGRA20_MC
+	bool
+	depends on ARCH_TEGRA_2x_SOC
+
 endif
drivers/memory/Makefile +1 -0
index e27f80b..1f58518 100644
@@ -3,3 +3,4 @@
 #
 
 obj-$(CONFIG_TI_EMIF)		+= emif.o
+obj-$(CONFIG_TEGRA20_MC)	+= tegra20-mc.o
drivers/memory/tegra20-mc.c new file +262 -0

262 lines not on this page · raw message

Signature · 1 line
1.7.5.4
#1 lore raw

PATCH 2/4 ARM: dt: tegra20.dtsi: Add Memory Controller(MC) nodes

Add Tegra MC(Memory Controller) nodes for tegra20.dtsi.

---
 arch/arm/boot/dts/tegra20.dtsi |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
arch/arm/boot/dts/tegra20.dtsi +7 -0
index 24129fb..548b42e 100644
@@ -211,5 +211,12 @@
 		compatible = "nvidia,tegra20-ahb";
 		reg = <0x6000c004 0x10c>; /* AHB Arbitration + Gizmo Controller */
 	};
+
+	mc {
+		compatible = "nvidia,tegra20-mc";
+		reg = <0x7000f000 0x024
+		       0x7000f03c 0x3c4>;
+		interrupts = <0 77 0x04>;
+	};
 };
 
Signature · 1 line
1.7.5.4
#2 lore raw

Re: [PATCH 2/4] ARM: dt: tegra20.dtsi: Add Memory Controller(MC) nodes

Hi,

Tiny drive-by nit pick.

Quoted 13 lines · Hiroshi DOYU

Add Tegra MC(Memory Controller) nodes for tegra20.dtsi.

---
?arch/arm/boot/dts/tegra20.dtsi | ? ?7 +++++++
?1 files changed, 7 insertions(+), 0 deletions(-)

arch/arm/boot/dts/tegra20.dtsi +0 -0
index 24129fb..548b42e 100644
@@ -211,5 +211,12 @@
 ? ? ? ? ? ? ? ?compatible = "nvidia,tegra20-ahb";
Quoted 4 lines

? ? ? ? ? ? ? ?reg = <0x6000c004 0x10c>; /* AHB Arbitration + Gizmo Controller */ ? ? ? ?};
+
+ ? ? ? mc {

It's common to use a more plain english name here, so "memory-controller" would be a good name.

-Olof

#3 lore raw

Re: [PATCH 2/4] ARM: dt: tegra20.dtsi: Add Memory Controller(MC) nodes

Hi Olof,

Quoted 12 lines · On Wed, 16 May 2012 08:35:02 +0200 Olof Johansson <[email protected]> wrote:

Hi,

Tiny drive-by nit pick.

Quoted 7 lines · Hiroshi DOYU

Add Tegra MC(Memory Controller) nodes for tegra20.dtsi.

---
?arch/arm/boot/dts/tegra20.dtsi | ? ?7 +++++++
?1 files changed, 7 insertions(+), 0 deletions(-)

Quoted 13 lines
Quoted 10 lines
arch/arm/boot/dts/tegra20.dtsi +0 -0
index 24129fb..548b42e 100644
@@ -211,5 +211,12 @@
 ? ? ? ? ? ? ? ?compatible = "nvidia,tegra20-ahb";

? ? ? ? ? ? ? ?reg = <0x6000c004 0x10c>; /* AHB Arbitration + Gizmo Controller */ ? ? ? ?};
+
+ ? ? ? mc {

It's common to use a more plain english name here, so "memory-controller" would be a good name.

Agree. Seems to be common as below. Fix patches follows, which can be squashed if possible.

$% grep memory-controller arch/arm/boot/dts/*
arch/arm/boot/dts/prima2-cb.dts: memory-controller at 90000000 {

arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts:    memory-controller at 2b0a0000 {
arch/arm/boot/dts/vexpress-v2p-ca15-tc1.dts:    memory-controller at 7ffd0000 {
arch/arm/boot/dts/vexpress-v2p-ca5s.dts:        memory-controller at 2a150000 {
arch/arm/boot/dts/vexpress-v2p-ca5s.dts:        memory-controller at 2a190000 {

arch/arm/boot/dts/vexpress-v2p-ca9.dts: memory-controller at 100e0000 { arch/arm/boot/dts/vexpress-v2p-ca9.dts: memory-controller at 100e1000 {

A message that is not in the archive (sent off-list or not yet received): 20120516095107.3510cb39d0f9cd2527e0bf1e-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org

#5 lore raw

PATCH 1/2 ARM: dt: tegra{20,30}.dtsi: Rename "MC" to "Memory Controller"

Use a more plain english name.

---
 arch/arm/boot/dts/tegra20.dtsi |    2 +-
 arch/arm/boot/dts/tegra30.dtsi |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/tegra20.dtsi +1 -1
index d1e6e24..e22c69f 100644
@@ -218,7 +218,7 @@
 		reg = <0x6000c004 0x10c>; /* AHB Arbitration + Gizmo Controller */
 	};
 
-	mc {
+	memory-controller {
 		compatible = "nvidia,tegra20-mc";
 		reg = <0x7000f000 0x024
 		       0x7000f03c 0x3c4>;
arch/arm/boot/dts/tegra30.dtsi +1 -1
index e9792ac..d845d31 100644
@@ -230,7 +230,7 @@
 		reg = <0x6000c004 0x14c>; /* AHB Arbitration + Gizmo Controller */
 	};
 
-	mc {
+	memory-controller {
 		compatible = "nvidia,tegra30-mc";
 		reg = <0x7000f000 0x010
 		       0x7000f03c 0x1b4
Signature · 1 line
1.7.5.4

A message that is not in the archive (sent off-list or not yet received): 1337151226-7266-1-git-send-email-hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org

#7 lore raw

PATCH 2/2 ARM: tegra{20,30}: Rename "MC" to "Memory Controller"

Use a more plain english name.

---
 .../bindings/arm/tegra/nvidia,tegra20-mc.txt       |    2 +-
 .../bindings/arm/tegra/nvidia,tegra30-mc.txt       |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-mc.txt +1 -1
index c25a0a5..ea6d6b4 100644
@@ -8,7 +8,7 @@ Required properties:
 - interrupts : Should contain MC General interrupt.
 
 Example:
-	mc {
+	memory-controller {
 		compatible = "nvidia,tegra20-mc";
 		reg = <0x7000f000 0x024
 		       0x7000f03c 0x3c4>;
Documentation/devicetree/bindings/arm/tegra/nvidia,tegra30-mc.txt +1 -1
index e47e73f..bdf1a61 100644
@@ -8,7 +8,7 @@ Required properties:
 - interrupts : Should contain MC General interrupt.
 
 Example:
-	mc {
+	memory-controller {
 		compatible = "nvidia,tegra30-mc";
 		reg = <0x7000f000 0x010
 		       0x7000f03c 0x1b4
Signature · 1 line
1.7.5.4
#8 lore raw

PATCH v2 1/1 ARM: dt: tegra{20,30}.dtsi: Rename "MC" to "Memory Controller"

In reply to a message not in the archive

Use a more plain english name.

---
Rebased onto next-20120516 for easy apply.

---
 arch/arm/boot/dts/tegra20.dtsi |    2 +-
 arch/arm/boot/dts/tegra30.dtsi |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/tegra20.dtsi +1 -1
index 26f4299..3d678fa 100644
@@ -164,7 +164,7 @@
 		reg = <0x7000e400 0x400>;
 	};
 
-	mc {
+	memory-controller {
 		compatible = "nvidia,tegra20-mc";
 		reg = <0x7000f000 0x024
 		       0x7000f03c 0x3c4>;
arch/arm/boot/dts/tegra30.dtsi +1 -1
index 95fa6e3c..5ebf10c 100644
@@ -167,7 +167,7 @@
 		reg = <0x7000e400 0x400>;
 	};
 
-	mc {
+	memory-controller {
 		compatible = "nvidia,tegra30-mc";
 		reg = <0x7000f000 0x010
 		       0x7000f03c 0x1b4
Signature · 1 line
1.7.5.4

A message that is not in the archive (sent off-list or not yet received): 1337172241-28677-1-git-send-email-hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org

#10 lore raw

Re: [v2 1/1] ARM: dt: tegra{20,30}.dtsi: Rename "MC" to "Memory Controller"

Quoted 1 line · Hiroshi DOYU

Use a more plain english name.

It's probably too late taking this cosmetic change for 3.5.

There is also an "emc" node that probably should be renamed to memory-controller too. In that case, since there will be two memory-controller nodes, you'll need to add the unit address ("@xxxxxxxx") back on the end of both the node names.

Can I get a patch series that does all that and updates the binding documentation for both MC and EMC? Probably separate patches for MC and EMC.

Thanks.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#12 lore raw

Re: [v2 1/1] ARM: dt: tegra{20,30}.dtsi: Rename "MC" to "Memory Controller"

Stephen Warren <[email protected]> wrote @ Wed, 16 May 2012 17:49:27 +0200:

Quoted 5 lines · Hiroshi DOYU
Quoted 1 line

Use a more plain english name.

It's probably too late taking this cosmetic change for 3.5.

Quoted 7 lines

There is also an "emc" node that probably should be renamed to memory-controller too. In that case, since there will be two memory-controller nodes, you'll need to add the unit address ("@xxxxxxxx") back on the end of both the node names.

Can I get a patch series that does all that and updates the binding documentation for both MC and EMC? Probably separate patches for MC and EMC.

Sure. How should we deal with "emc" for emc-table in seaboard?

$% grep -n emc arch/arm/boot/dts/*
arch/arm/boot/dts/prima2-cb.dts:87: compatible = "sirf,prima2-memc";
arch/arm/boot/dts/tegra20.dtsi:180: emc {
arch/arm/boot/dts/tegra20.dtsi:181: compatible = "nvidia,tegra20-emc";
arch/arm/boot/dts/tegra-seaboard.dts:337: emc {
arch/arm/boot/dts/tegra-seaboard.dts:338: emc-table@190000 {
arch/arm/boot/dts/tegra-seaboard.dts:340: compatible = "nvidia,tegra20-emc-table";
arch/arm/boot/dts/tegra-seaboard.dts:342: nvidia,emc-registers = <0x0000000c 0x00000026
arch/arm/boot/dts/tegra-seaboard.dts:356: emc-table@380000 {
arch/arm/boot/dts/tegra-seaboard.dts:358: compatible = "nvidia,tegra20-emc-table";
arch/arm/boot/dts/tegra-seaboard.dts:360: nvidia,emc-registers = <0x00000017 0x0000004b

A message that is not in the archive (sent off-list or not yet received): 20120516.201540.1972877673672045065.hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org

#14 lore raw

Re: [v2 1/1] ARM: dt: tegra{20,30}.dtsi: Rename "MC" to "Memory Controller"

Quoted 12 lines · Hiroshi Doyu

Stephen Warren <[email protected]> wrote @ Wed, 16 May 2012 17:49:27 +0200:

Quoted 10 lines · Hiroshi DOYU
Quoted 1 line

Use a more plain english name.

It's probably too late taking this cosmetic change for 3.5.

There is also an "emc" node that probably should be renamed to memory-controller too. In that case, since there will be two memory-controller nodes, you'll need to add the unit address ("@xxxxxxxx") back on the end of both the node names.

Quoted 7 lines
Quoted 2 lines

Can I get a patch series that does all that and updates the binding documentation for both MC and EMC? Probably separate patches for MC and EMC.

Sure. How should we deal with "emc" for emc-table in seaboard?

arch/arm/boot/dts/tegra-seaboard.dts:337: emc {
arch/arm/boot/dts/tegra-seaboard.dts:338: emc-table@190000 {

I'd be inclined to leave that as-is. Olof, any objections?

By the way, be sure to base your patch on the very latest Tegra tree or linux-next; I did a lot of .dts cleanup in the last couple days.

Thanks.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#16 lore raw

Re: [v2 1/1] ARM: dt: tegra{20,30}.dtsi: Rename "MC" to "Memory Controller"

Quoted 16 lines · Stephen Warren
Quoted 15 lines · Hiroshi Doyu

Stephen Warren <[email protected]> wrote @ Wed, 16 May 2012 17:49:27 +0200:

Quoted 12 lines · Hiroshi DOYU
Quoted 1 line

Use a more plain english name.

It's probably too late taking this cosmetic change for 3.5.

There is also an "emc" node that probably should be renamed to memory-controller too. In that case, since there will be two memory-controller nodes, you'll need to add the unit address ("@xxxxxxxx") back on the end of both the node names.

Can I get a patch series that does all that and updates the binding documentation for both MC and EMC? Probably separate patches for MC and EMC.

Quoted 6 lines
Quoted 4 lines

Sure. How should we deal with "emc" for emc-table in seaboard?

arch/arm/boot/dts/tegra-seaboard.dts:337:       emc { arch/arm/boot/dts/tegra-seaboard.dts:338:               emc-table@190000 {

I'd be inclined to leave that as-is. Olof, any objections?

Yeah, it's the term normally used for the tables so it makes sense to keep it.

-Olof

A message that is not in the archive (sent off-list or not yet received): CAOesGMhw5hJSF96FBuENnwx2=ACyAYwX6uny9zQeTsimcebF8A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#18 lore raw

PATCH 1/4 ARM: dt: tegra{20,30}.dtsi: Rename "mc" to "memory-controller"

Use a more plain english name.

---
changelog: Add address postfix.

---
 arch/arm/boot/dts/tegra20.dtsi |    2 +-
 arch/arm/boot/dts/tegra30.dtsi |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/tegra20.dtsi +1 -1
index 26f4299..77725bc 100644
@@ -164,7 +164,7 @@
 		reg = <0x7000e400 0x400>;
 	};
 
-	mc {
+	memory-controller@0x7000f000 {
 		compatible = "nvidia,tegra20-mc";
 		reg = <0x7000f000 0x024
 		       0x7000f03c 0x3c4>;
arch/arm/boot/dts/tegra30.dtsi +1 -1
index 95fa6e3c..01bb1b4 100644
@@ -167,7 +167,7 @@
 		reg = <0x7000e400 0x400>;
 	};
 
-	mc {
+	memory-controller@0x7000f000 {
 		compatible = "nvidia,tegra30-mc";
 		reg = <0x7000f000 0x010
 		       0x7000f03c 0x1b4
Signature · 1 line
1.7.5.4

A message that is not in the archive (sent off-list or not yet received): 1337233667-23770-1-git-send-email-hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org

#20 lore raw

PATCH 2/4 ARM: tegra{20,30}: Rename "mc" to "memory-controller"

Use a more plain english name.

---
changelog: Add address postfix.

---
 .../bindings/arm/tegra/nvidia,tegra20-mc.txt       |    2 +-
 .../bindings/arm/tegra/nvidia,tegra30-mc.txt       |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/arm/tegra/nvidia,tegra20-mc.txt +1 -1
index c25a0a5..866d934 100644
@@ -8,7 +8,7 @@ Required properties:
 - interrupts : Should contain MC General interrupt.
 
 Example:
-	mc {
+	memory-controller@0x7000f000 {
 		compatible = "nvidia,tegra20-mc";
 		reg = <0x7000f000 0x024
 		       0x7000f03c 0x3c4>;
Documentation/devicetree/bindings/arm/tegra/nvidia,tegra30-mc.txt +1 -1
index e47e73f..f8da3f6 100644
@@ -8,7 +8,7 @@ Required properties:
 - interrupts : Should contain MC General interrupt.
 
 Example:
-	mc {
+	memory-controller@0x7000f000 {
 		compatible = "nvidia,tegra30-mc";
 		reg = <0x7000f000 0x010
 		       0x7000f03c 0x1b4
Signature · 1 line
1.7.5.4
#21 lore raw

PATCH 3/4 ARM: dt: tegra20.dtsi: Rename "emc" to "memory-controller"

In reply to a message not in the archive

Use a more plain english name.

---
 arch/arm/boot/dts/tegra20.dtsi |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/boot/dts/tegra20.dtsi +1 -1
index 77725bc..a214574 100644
@@ -177,7 +177,7 @@
 		       0x58000000 0x02000000>;	/* GART aperture */
 	};
 
-	emc {
+	memory-controller@0x7000f400 {
 		compatible = "nvidia,tegra20-emc";
 		reg = <0x7000f400 0x200>;
 		#address-cells = <1>;
Signature · 1 line
1.7.5.4
#22 lore raw

PATCH 4/4 ARM: tegra20: Rename "emc" to "memory-controller"

In reply to a message not in the archive

Use a more plain english name.

---
 .../devicetree/bindings/arm/tegra/emc.txt          |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Documentation/devicetree/bindings/arm/tegra/emc.txt +1 -1
index 09335f8..4c33b29 100644
@@ -15,7 +15,7 @@ Child device nodes describe the memory settings for different configurations and
 
 Example:
 
-	emc@7000f400 {
+	memory-controller@7000f400 {
 		#address-cells = < 1 >;
 		#size-cells = < 0 >;
 		compatible = "nvidia,tegra20-emc";
Signature · 1 line
1.7.5.4
#24 lore raw

Re: [PATCH 1/4] ARM: dt: tegra{20,30}.dtsi: Rename "mc" to "memory-controller"

In reply to a message not in the archive
Quoted 1 line · Hiroshi DOYU

Use a more plain english name.

Applied the series for 3.6, with a minor fixup to revert the addition of the redundant unit address on the Tegra30 memory-controller node, since there's only 1 node of that name there for now.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#26 lore raw

Re: [PATCH 1/4] ARM: dt: tegra{20,30}.dtsi: Rename "mc" to "memory-controller"

Quoted 6 lines · Stephen Warren
Quoted 1 line · Hiroshi DOYU

Use a more plain english name.

Applied the series for 3.6, with a minor fixup to revert the addition of the redundant unit address on the Tegra30 memory-controller node, since there's only 1 node of that name there for now.

... and another fixup to rename the emc node in tegra-seaboard.dts as well as tegra20.dtsi.

#27 lore raw

PATCH 3/4 ARM: tegra30: Add Tegra Memory Controller(MC) driver

In reply to Hiroshi DOYU

Tegra Memory Controller(MC) driver for Tegra30
Added to support MC General interrupts, mainly for IOMMU(SMMU).

---
 .../bindings/arm/tegra/nvidia,tegra30-mc.txt       |   18 +
 arch/arm/mach-tegra/Kconfig                        |    2 +
 drivers/memory/Kconfig                             |    4 +
 drivers/memory/Makefile                            |    1 +
 drivers/memory/tegra30-mc.c                        |  391 ++++++++++++++++++++
 5 files changed, 416 insertions(+), 0 deletions(-)
Documentation/devicetree/bindings/arm/tegra/nvidia,tegra30-mc.txt new file +18 -0
new file mode 100644
index 0000000..e47e73f
@@ -0,0 +1,18 @@
+NVIDIA Tegra30 MC(Memory Controller)
+
+Required properties:
+- compatible : "nvidia,tegra30-mc"
+- reg : Should contain 4 register ranges(address and length); see the
+  example below. Note that the MC registers are interleaved with the
+  SMMU registers, and hence must be represented as multiple ranges.
+- interrupts : Should contain MC General interrupt.
+
+Example:
+	mc {
+		compatible = "nvidia,tegra30-mc";
+		reg = <0x7000f000 0x010
+		       0x7000f03c 0x1b4
+		       0x7000f200 0x028
+		       0x7000f284 0x17c>;
+		interrupts = <0 77 0x04>;
+	};
arch/arm/mach-tegra/Kconfig +2 -0
index abaf5d0..16fe065 100644
@@ -43,6 +43,8 @@ config ARCH_TEGRA_3x_SOC
 	select ARM_ERRATA_764369
 	select PL310_ERRATA_769419 if CACHE_L2X0
 	select CPU_FREQ_TABLE if CPU_FREQ
+	select MEMORY
+	select TEGRA30_MC
 	help
 	  Support for NVIDIA Tegra T30 processor family, based on the
 	  ARM CortexA9MP CPU and the ARM PL310 L2 cache controller
drivers/memory/Kconfig +4 -0
index ebade16..42e6d66 100644
@@ -24,4 +24,8 @@ config TEGRA20_MC
 	bool
 	depends on ARCH_TEGRA_2x_SOC
 
+config TEGRA30_MC
+	bool
+	depends on ARCH_TEGRA_3x_SOC
+
 endif
drivers/memory/Makefile +1 -0
index 1f58518..42b3ce9 100644
@@ -4,3 +4,4 @@
 
 obj-$(CONFIG_TI_EMIF)		+= emif.o
 obj-$(CONFIG_TEGRA20_MC)	+= tegra20-mc.o
+obj-$(CONFIG_TEGRA30_MC)	+= tegra30-mc.o
drivers/memory/tegra30-mc.c new file +391 -0

391 lines not on this page · raw message

Signature · 1 line
1.7.5.4
#28 lore raw

Re: [PATCH 3/4] ARM: tegra30: Add Tegra Memory Controller(MC) driver

Quoted 2 lines · Hiroshi DOYU

Tegra Memory Controller(MC) driver for Tegra30
Added to support MC General interrupts, mainly for IOMMU(SMMU).

I'll apply this, but:

Quoted 5 lines
drivers/memory/tegra30-mc.c new file +5 -0
+static inline u32 mc_readl(struct tegra30_mc *mc, u32 offs)
+{
+	if (offs < 0x10)
+		return readl(mc->regs[0] + offs);
+	BUG_ON(offs < 0x3c);

drivers/memory/tegra30-mc.c line 106

Quoted 10 lines
drivers/memory/tegra30-mc.c new file +10 -0
+	if (offs < 0x1f0)
+		return readl(mc->regs[1] + offs - 0x3c);
+	BUG_ON(offs < 0x200);
+	if (offs < 0x228)
+		return readl(mc->regs[2] + offs - 0x200);
+	BUG_ON(offs < 0x284);
+	if (offs < 0x400)
+		return readl(mc->regs[3] + offs - 0x284);
+	BUG();
+}

That's a lot of BUG* calls. Same thing with the 1/4 patch in this series.

We really should not have a BUG call in any driver, as you just stopped the whole system. I can understand this being there for debugging when you create the code originally, but as these are things no one should ever be able to hit now, you should remove them, right?

Care to write a follow-on patch removing all of these BUG_ON and BUG calls in this and the drivers/memory/tegra20-mc.c driver?

thanks,

greg k-h

#29 lore raw

Re: [PATCH 3/4] ARM: tegra30: Add Tegra Memory Controller(MC) driver

Hi Greg,

From: Greg Kroah-Hartman <[email protected]>
Subject: Re: [PATCH 3/4] ARM: tegra30: Add Tegra Memory Controller(MC) driver
Date: Thu, 10 May 2012 23:46:04 +0200
Message-ID: <[email protected]>

Quoted 5 lines · Hiroshi DOYU
Quoted 2 lines

Tegra Memory Controller(MC) driver for Tegra30
Added to support MC General interrupts, mainly for IOMMU(SMMU).

I'll apply this, but:

Thanks.

Quoted 19 lines
Quoted 5 lines
drivers/memory/tegra30-mc.c new file +5 -0
+static inline u32 mc_readl(struct tegra30_mc *mc, u32 offs)
+{
+	if (offs < 0x10)
+		return readl(mc->regs[0] + offs);
+	BUG_ON(offs < 0x3c);

drivers/memory/tegra30-mc.c line 106

Quoted 10 lines
drivers/memory/tegra30-mc.c new file +10 -0
+	if (offs < 0x1f0)
+		return readl(mc->regs[1] + offs - 0x3c);
+	BUG_ON(offs < 0x200);
+	if (offs < 0x228)
+		return readl(mc->regs[2] + offs - 0x200);
+	BUG_ON(offs < 0x284);
+	if (offs < 0x400)
+		return readl(mc->regs[3] + offs - 0x284);
+	BUG();
+}

That's a lot of BUG* calls. Same thing with the 1/4 patch in this series.

Quoted 7 lines

We really should not have a BUG call in any driver, as you just stopped the whole system. I can understand this being there for debugging when you create the code originally, but as these are things no one should ever be able to hit now, you should remove them, right?

Care to write a follow-on patch removing all of these BUG_ON and BUG calls in this and the drivers/memory/tegra20-mc.c driver?

Ok, they are replying to this email.

#30 lore raw

PATCH 1/2 ARM: tegra20: MC: Remove unnecessary BUG*()

Accessing interleaved MC register offsets/ranges are verified. BUG*()s in accessors can be removed.

---
 drivers/memory/tegra20-mc.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)
drivers/memory/tegra20-mc.c +0 -4
index c0bfffa..6832604 100644
@@ -55,10 +55,8 @@ static inline u32 mc_readl(struct tegra20_mc *mc, u32 offs)
 {
 	if (offs < 0x24)
 		return readl(mc->regs[0] + offs);
-	BUG_ON(offs < 0x3c);
 	if (offs < 0x400)
 		return readl(mc->regs[1] + offs - 0x3c);
-	BUG();
 }
 
 static inline void mc_writel(struct tegra20_mc *mc, u32 val, u32 offs)
@@ -67,12 +65,10 @@ static inline void mc_writel(struct tegra20_mc *mc, u32 val, u32 offs)
 		writel(val, mc->regs[0] + offs);
 		return;
 	}
-	BUG_ON(offs < 0x3c);
 	if (offs < 0x400) {
 		writel(val, mc->regs[1] + offs - 0x3c);
 		return;
 	}
-	BUG();
 }
 
 static const char * const tegra20_mc_client[] = {
Signature · 1 line
1.7.5.4
#31 lore raw

PATCH 2/2 ARM: tegra30: MC: Remove unnecessary BUG*()

Accessing interleaved MC register offsets/ranges are verified. BUG*()s in accessors can be removed.

---
 drivers/memory/tegra30-mc.c |    8 --------
 1 files changed, 0 insertions(+), 8 deletions(-)
drivers/memory/tegra30-mc.c +0 -8
index c982125..4905cd8 100644
@@ -93,16 +93,12 @@ static inline u32 mc_readl(struct tegra30_mc *mc, u32 offs)
 {
 	if (offs < 0x10)
 		return readl(mc->regs[0] + offs);
-	BUG_ON(offs < 0x3c);
 	if (offs < 0x1f0)
 		return readl(mc->regs[1] + offs - 0x3c);
-	BUG_ON(offs < 0x200);
 	if (offs < 0x228)
 		return readl(mc->regs[2] + offs - 0x200);
-	BUG_ON(offs < 0x284);
 	if (offs < 0x400)
 		return readl(mc->regs[3] + offs - 0x284);
-	BUG();
 }
 
 static inline void mc_writel(struct tegra30_mc *mc, u32 val, u32 offs)
@@ -111,22 +107,18 @@ static inline void mc_writel(struct tegra30_mc *mc, u32 val, u32 offs)
 		writel(val, mc->regs[0] + offs);
 		return;
 	}
-	BUG_ON(offs < 0x3c);
 	if (offs < 0x1f0) {
 		writel(val, mc->regs[1] + offs - 0x3c);
 		return;
 	}
-	BUG_ON(offs < 0x200);
 	if (offs < 0x228) {
 		writel(val, mc->regs[2] + offs - 0x200);
 		return;
 	}
-	BUG_ON(offs < 0x284);
 	if (offs < 0x400) {
 		writel(val, mc->regs[3] + offs - 0x284);
 		return;
 	}
-	BUG();
 }
 
 static const char * const tegra30_mc_client[] = {
Signature · 1 line
1.7.5.4
#32 lore raw

PATCH v2 1/2 ARM: tegra20: MC: Remove unnecessary BUG*()

Accessing interleaved MC register offsets/ranges are verified. BUG*()s in accessors can be removed.

---
 drivers/memory/tegra20-mc.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
drivers/memory/tegra20-mc.c +6 -6
index c0bfffa..2a437e9 100644
@@ -53,12 +53,14 @@ struct tegra20_mc {
 
 static inline u32 mc_readl(struct tegra20_mc *mc, u32 offs)
 {
+	u32 val = 0;
+
 	if (offs < 0x24)
-		return readl(mc->regs[0] + offs);
-	BUG_ON(offs < 0x3c);
+		val = readl(mc->regs[0] + offs);
 	if (offs < 0x400)
-		return readl(mc->regs[1] + offs - 0x3c);
-	BUG();
+		val = readl(mc->regs[1] + offs - 0x3c);
+
+	return val;
 }
 
 static inline void mc_writel(struct tegra20_mc *mc, u32 val, u32 offs)
@@ -67,12 +69,10 @@ static inline void mc_writel(struct tegra20_mc *mc, u32 val, u32 offs)
 		writel(val, mc->regs[0] + offs);
 		return;
 	}
-	BUG_ON(offs < 0x3c);
 	if (offs < 0x400) {
 		writel(val, mc->regs[1] + offs - 0x3c);
 		return;
 	}
-	BUG();
 }
 
 static const char * const tegra20_mc_client[] = {
Signature · 1 line
1.7.5.4
#33 lore raw

PATCH v2 2/2 ARM: tegra30: MC: Remove unnecessary BUG*()

Accessing interleaved MC register offsets/ranges are verified. BUG*()s in accessors can be removed.

---
 drivers/memory/tegra30-mc.c |   20 ++++++++------------
 1 files changed, 8 insertions(+), 12 deletions(-)
drivers/memory/tegra30-mc.c +8 -12
index c982125..ec9fc78 100644
@@ -91,18 +91,18 @@ struct tegra30_mc {
 
 static inline u32 mc_readl(struct tegra30_mc *mc, u32 offs)
 {
+	u32 val = 0;
+
 	if (offs < 0x10)
-		return readl(mc->regs[0] + offs);
-	BUG_ON(offs < 0x3c);
+		val = readl(mc->regs[0] + offs);
 	if (offs < 0x1f0)
-		return readl(mc->regs[1] + offs - 0x3c);
-	BUG_ON(offs < 0x200);
+		val = readl(mc->regs[1] + offs - 0x3c);
 	if (offs < 0x228)
-		return readl(mc->regs[2] + offs - 0x200);
-	BUG_ON(offs < 0x284);
+		val = readl(mc->regs[2] + offs - 0x200);
 	if (offs < 0x400)
-		return readl(mc->regs[3] + offs - 0x284);
-	BUG();
+		val = readl(mc->regs[3] + offs - 0x284);
+
+	return val;
 }
 
 static inline void mc_writel(struct tegra30_mc *mc, u32 val, u32 offs)
@@ -111,22 +111,18 @@ static inline void mc_writel(struct tegra30_mc *mc, u32 val, u32 offs)
 		writel(val, mc->regs[0] + offs);
 		return;
 	}
-	BUG_ON(offs < 0x3c);
 	if (offs < 0x1f0) {
 		writel(val, mc->regs[1] + offs - 0x3c);
 		return;
 	}
-	BUG_ON(offs < 0x200);
 	if (offs < 0x228) {
 		writel(val, mc->regs[2] + offs - 0x200);
 		return;
 	}
-	BUG_ON(offs < 0x284);
 	if (offs < 0x400) {
 		writel(val, mc->regs[3] + offs - 0x284);
 		return;
 	}
-	BUG();
 }
 
 static const char * const tegra30_mc_client[] = {
Signature · 1 line
1.7.5.4
#34 lore raw

PATCH 4/4 ARM: dt: tegra30.dtsi: Add Memory Controller(MC) nodes

In reply to Hiroshi DOYU

Add Tegra MC(Memory Controller) nodes for tegra30.dtsi.

---
 arch/arm/boot/dts/tegra30.dtsi |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
arch/arm/boot/dts/tegra30.dtsi +9 -0
index 9d650fb..167ccbc 100644
@@ -229,4 +229,13 @@
 		compatible = "nvidia,tegra30-ahb";
 		reg = <0x6000c004 0x14c>; /* AHB Arbitration + Gizmo Controller */
 	};
+
+	mc {
+		compatible = "nvidia,tegra30-mc";
+		reg = <0x7000f000 0x010
+		       0x7000f03c 0x1b4
+		       0x7000f200 0x028
+		       0x7000f284 0x17c>;
+		interrupts = <0 77 0x04>;
+	};
 };
Signature · 1 line
1.7.5.4
#35 lore raw
In reply to Hiroshi DOYU
Quoted 2 lines · Hiroshi DOYU

Tegra Memory Controller(MC) driver for Tegra20
Added to support MC General interrupts, mainly for IOMMU(GART).

Greg, you appear to have been commiting all of drivers/memory. I assume you'll take patches 1 and 3 in this series, and I will take 2 and 4 through the Tegra tree? I can take them all through the Tegra tree if you want. Taking the .dts patches through your tree might cause conflicts in 3.6, since I anticipate some DT-wide cleanup in 3.6.

Hiroshi, one question below (same for patch 3)

arch/arm/mach-tegra/Kconfig config ARCH_TEGRA_2x_SOC · line 24

Quoted 8 lines
arch/arm/mach-tegra/Kconfig +2 -0
@@ -20,6 +20,8 @@ config ARCH_TEGRA_2x_SOC
 	select PL310_ERRATA_727915 if CACHE_L2X0
 	select PL310_ERRATA_769419 if CACHE_L2X0
 	select CPU_FREQ_TABLE if CPU_FREQ
+	select MEMORY
+	select TEGRA20_MC

Does ARCH_TEGRA_2x_SOC /have/ to select these?

I'd be inclined to drop the change to mach-tegra/Kconfig. As rationale, the code works fine without the driver right now. You'd need to make config TEGRA*_MC user-visible/selectable though.

You could replace this change with a patch to tegra_defconfig which enables MEMORY and TEGRA*_MC, or perhaps make config TEGRA20_MC default y.

What are people's thoughts here?

Aside from this, the series looks fine to me.

#36 lore raw
Quoted 8 lines · Stephen Warren
Quoted 2 lines · Hiroshi DOYU

Tegra Memory Controller(MC) driver for Tegra20
Added to support MC General interrupts, mainly for IOMMU(GART).

Greg, you appear to have been commiting all of drivers/memory. I assume you'll take patches 1 and 3 in this series, and I will take 2 and 4 through the Tegra tree? I can take them all through the Tegra tree if you want.

I think you will get a conflict if you take the memory ones in your tree, so I will take those two, thanks.

greg k-h

#37 lore raw
In reply to Stephen Warren

Hi Greg, Stephen,

Quoted 23 lines · On Thu, 10 May 2012 19:23:55 +0200 Stephen Warren <[email protected]> wrote:
Quoted 2 lines · Hiroshi DOYU

Tegra Memory Controller(MC) driver for Tegra20
Added to support MC General interrupts, mainly for IOMMU(GART).

Greg, you appear to have been commiting all of drivers/memory. I assume you'll take patches 1 and 3 in this series, and I will take 2 and 4 through the Tegra tree? I can take them all through the Tegra tree if you want. Taking the .dts patches through your tree might cause conflicts in 3.6, since I anticipate some DT-wide cleanup in 3.6.

Hiroshi, one question below (same for patch 3)

arch/arm/mach-tegra/Kconfig config ARCH_TEGRA_2x_SOC · line 24

Quoted 8 lines
arch/arm/mach-tegra/Kconfig +2 -0
@@ -20,6 +20,8 @@ config ARCH_TEGRA_2x_SOC
 	select PL310_ERRATA_727915 if CACHE_L2X0
 	select PL310_ERRATA_769419 if CACHE_L2X0
 	select CPU_FREQ_TABLE if CPU_FREQ
+	select MEMORY
+	select TEGRA20_MC

Does ARCH_TEGRA_2x_SOC /have/ to select these?

Quoted 6 lines

I'd be inclined to drop the change to mach-tegra/Kconfig. As rationale, the code works fine without the driver right now. You'd need to make config TEGRA*_MC user-visible/selectable though.

You could replace this change with a patch to tegra_defconfig which enables MEMORY and TEGRA*_MC, or perhaps make config TEGRA20_MC default y.

I'm sending the fixup patches, following this mail, since Greg has already put the original patches in queue. I think that the following fixup patches could be squashed into the original ones. The fixup patches are:

[PATCH 1/3] ARM: tegra20: Make MC optional in Kconfig [PATCH 2/3] ARM: tegra30: Make MC optional in Kconfig [PATCH 3/3] ARM: tegra: Make TEGRA{20,30}_MC selectable in defconfig

Let me know if it's better to resend the complete patches again.

#38 lore raw

PATCH 1/3 ARM: tegra20: Make MC optional in Kconfig

For bare minimal system.

---
 arch/arm/mach-tegra/Kconfig |    2 --
 drivers/memory/Kconfig      |    8 +++++++-
 2 files changed, 7 insertions(+), 3 deletions(-)
arch/arm/mach-tegra/Kconfig +0 -2
index 16fe065..8b6b181 100644
@@ -20,8 +20,6 @@ config ARCH_TEGRA_2x_SOC
 	select PL310_ERRATA_727915 if CACHE_L2X0
 	select PL310_ERRATA_769419 if CACHE_L2X0
 	select CPU_FREQ_TABLE if CPU_FREQ
-	select MEMORY
-	select TEGRA20_MC
 	help
 	  Support for NVIDIA Tegra AP20 and T20 processors, based on the
 	  ARM CortexA9MP CPU and the ARM PL310 L2 cache controller
drivers/memory/Kconfig +7 -1
index 42e6d66..efc6b36 100644
@@ -21,8 +21,14 @@ config TI_EMIF
 	  temperature changes
 
 config TEGRA20_MC
-	bool
+	bool "Tegra20 Memory Controller(MC) driver"
+	default y
 	depends on ARCH_TEGRA_2x_SOC
+	help
+	  This driver is for the Memory Controller(MC) module available
+	  in Tegra20 SoCs, mainly for a address translation fault
+	  analysis, especially for IOMMU/GART(Graphics Address
+	  Relocation Table) module.
 
 config TEGRA30_MC
 	bool
Signature · 1 line
1.7.5.4
#39 lore raw

PATCH 2/3 ARM: tegra30: Make MC optional in Kconfig

For bare minimal system.

---
 arch/arm/mach-tegra/Kconfig |    2 --
 drivers/memory/Kconfig      |    8 +++++++-
 2 files changed, 7 insertions(+), 3 deletions(-)
arch/arm/mach-tegra/Kconfig +0 -2
index 8b6b181..6a113a9 100644
@@ -41,8 +41,6 @@ config ARCH_TEGRA_3x_SOC
 	select ARM_ERRATA_764369
 	select PL310_ERRATA_769419 if CACHE_L2X0
 	select CPU_FREQ_TABLE if CPU_FREQ
-	select MEMORY
-	select TEGRA30_MC
 	help
 	  Support for NVIDIA Tegra T30 processor family, based on the
 	  ARM CortexA9MP CPU and the ARM PL310 L2 cache controller
drivers/memory/Kconfig +7 -1
index efc6b36..067f311 100644
@@ -31,7 +31,13 @@ config TEGRA20_MC
 	  Relocation Table) module.
 
 config TEGRA30_MC
-	bool
+	bool "Tegra30 Memory Controller(MC) driver"
+	default y
 	depends on ARCH_TEGRA_3x_SOC
+	help
+	  This driver is for the Memory Controller(MC) module available
+	  in Tegra30 SoCs, mainly for a address translation fault
+	  analysis, especially for IOMMU/SMMU(System Memory Management
+	  Unit) module.
 
 endif
Signature · 1 line
1.7.5.4
#40 lore raw

PATCH 3/3 ARM: tegra: Make TEGRA{20,30}_MC selectable in defconfig

In reply to Hiroshi DOYU

CONFIG_TEGRA{20,30}_MC depends on CONFIG_MEMORY.

---
 arch/arm/configs/tegra_defconfig |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/configs/tegra_defconfig +1 -0
index 7a90abb..639778d 100644
@@ -149,6 +149,7 @@ CONFIG_KEYBOARD_NVEC=y
 CONFIG_SERIO_NVEC_PS2=y
 CONFIG_TEGRA_IOMMU_GART=y
 CONFIG_TEGRA_IOMMU_SMMU=y
+CONFIG_MEMORY=y
 CONFIG_IIO=y
 CONFIG_EXT2_FS=y
 CONFIG_EXT2_FS_XATTR=y
Signature · 1 line
1.7.5.4