Skip to contentSkip to conversation

memory: tegra: Add Tegra234 support

PATCH Superseded Thierry Reding 2 participants 11 messages Dec 10, 2021 – Dec 13, 2021

Subsystems (4)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover memory: tegra: Add Tegra234 support

From: Thierry Reding <[email protected]>

Hi,

this series adds support to the Tegra memory controller driver for the version found on the new Tegra234 SoC. It is mostly similar to that on earlier chips, except that the memory clients differ.

This also updates the device tree binding with a missing property and ensures that all versions of the memory controller device tree nodes can be properly validated.

Finally, the device trees for Tegra234 are updated and memory client nodes are hooked up to the memory controller via interconnect properties. Once the bindings are reviewed I plan to apply patches 4-6 to the Tegra tree.

Changes in v2:
- addressed all review comments on the DT schema
- most of the conditionals weren't necessary because I found out that all three generations end up using the same set of interrupts for MC and EMC and we were assigning them wrongly
- added one patch to fix the Tegra194 EMC interrupt

Thierry

Thierry Reding (6):
dt-bindings: memory: tegra: Document #interconnect-cells property
dt-bindings: memory: tegra: Add Tegra234 support
memory: tegra: Add Tegra234 support
arm64: tegra: Add EMC general interrupt on Tegra194
arm64: tegra: Add memory controller on Tegra234
arm64: tegra: Hook up MMC and BPMP to memory controller

 .../nvidia,tegra186-mc.yaml                   | 98 ++++++++++++++++---
 arch/arm64/boot/dts/nvidia/tegra194.dtsi      |  1 +
 arch/arm64/boot/dts/nvidia/tegra234.dtsi      | 57 +++++++++++
 drivers/memory/tegra/Makefile                 |  1 +
 drivers/memory/tegra/mc.c                     |  3 +
 drivers/memory/tegra/mc.h                     |  7 +-
 drivers/memory/tegra/tegra186-emc.c           |  3 +
 drivers/memory/tegra/tegra234.c               | 81 +++++++++++++++
 include/dt-bindings/clock/tegra234-clock.h    |  9 ++
 include/dt-bindings/memory/tegra234-mc.h      | 32 ++++++
 10 files changed, 280 insertions(+), 12 deletions(-)
 create mode 100644 drivers/memory/tegra/tegra234.c
 create mode 100644 include/dt-bindings/memory/tegra234-mc.h
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/6 dt-bindings: memory: tegra: Document #interconnect-cells property

From: Thierry Reding <[email protected]>

The #interconnect-cells properties are required to hook up memory clients to the MC/EMC in interconnects properties. Add a description for these properties.

Also, allow multiple reg and interrupt entries required by Tegra194 and later.

---
Changes in v2:
- drop incomplete BPMP snippet from example
- explicitly set minItems for reg property
- describe MC and EMC general interrupts

 .../nvidia,tegra186-mc.yaml                   | 78 ++++++++++++++++---
 1 file changed, 67 insertions(+), 11 deletions(-)
Documentation/devicetree/bindings/memory-controllers/nvidia,tegra186-mc.yaml +67 -11
index 611bda38d187..b496564b1bdf 100644
@@ -33,10 +33,12 @@ properties:
           - nvidia,tegra194-mc
 
   reg:
-    maxItems: 1
+    minItems: 1
+    maxItems: 3
 
   interrupts:
-    maxItems: 1
+    items:
+      - description: MC general interrupt
 
   "#address-cells":
     const: 2
@@ -48,6 +50,9 @@ properties:
 
   dma-ranges: true
 
+  "#interconnect-cells":
+    const: 1
+
 patternProperties:
   "^external-memory-controller@[0-9a-f]+$":
     description:
@@ -65,10 +70,12 @@ patternProperties:
               - nvidia,tegra194-emc
 
       reg:
-        maxItems: 1
+        minItems: 1
+        maxItems: 2
 
       interrupts:
-        maxItems: 1
+        items:
+          - description: EMC general interrupt
 
       clocks:
         items:
@@ -78,11 +85,65 @@ patternProperties:
         items:
           - const: emc
 
+      "#interconnect-cells":
+        const: 0
+
       nvidia,bpmp:
         $ref: /schemas/types.yaml#/definitions/phandle
         description:
           phandle of the node representing the BPMP
 
+    allOf:
+      - if:
+          properties:
+            compatible:
+              const: nvidia,tegra186-emc
+        then:
+          properties:
+            reg:
+              maxItems: 1
+
+      - if:
+          properties:
+            compatible:
+              const: nvidia,tegra194-emc
+        then:
+          properties:
+            reg:
+              minItems: 2
+
+    additionalProperties: false
+
+    required:
+      - compatible
+      - reg
+      - interrupts
+      - clocks
+      - clock-names
+      - "#interconnect-cells"
+      - nvidia,bpmp
+
+allOf:
+  - if:
+      properties:
+        compatible:
+          const: nvidia,tegra186-mc
+    then:
+      properties:
+        reg:
+          maxItems: 1
+
+  - if:
+      properties:
+        compatible:
+          const: nvidia,tegra194-mc
+    then:
+      properties:
+        reg:
+          minItems: 3
+
+additionalProperties: false
+
 required:
   - compatible
   - reg
@@ -90,8 +151,6 @@ required:
   - "#address-cells"
   - "#size-cells"
 
-additionalProperties: false
-
 examples:
   - |
     #include <dt-bindings/clock/tegra186-clock.h>
@@ -124,12 +183,9 @@ examples:
                 clocks = <&bpmp TEGRA186_CLK_EMC>;
                 clock-names = "emc";
 
+                #interconnect-cells = <0>;
+
                 nvidia,bpmp = <&bpmp>;
             };
         };
     };
-
-    bpmp: bpmp {
-        compatible = "nvidia,tegra186-bpmp";
-        #clock-cells = <1>;
-    };
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH v2 1/6] dt-bindings: memory: tegra: Document #interconnect-cells property

Quoted 8 lines · Thierry Reding

From: Thierry Reding <[email protected]>

The #interconnect-cells properties are required to hook up memory clients to the MC/EMC in interconnects properties. Add a description for these properties.

Also, allow multiple reg and interrupt entries required by Tegra194 and later.

I think number of interrupts is fixed and you do not change them for newer SoC, so the message is a little bit not precise. Also the subject does not it the patch - maybe something like - "adjust properties for Tegra196"?

Quoted 11 lines

---
Changes in v2:
- drop incomplete BPMP snippet from example
- explicitly set minItems for reg property
- describe MC and EMC general interrupts

 .../nvidia,tegra186-mc.yaml                   | 78 ++++++++++++++++---
 1 file changed, 67 insertions(+), 11 deletions(-)

Best regards,
Krzysztof

#3 lore raw

Re: [PATCH v2 1/6] dt-bindings: memory: tegra: Document #interconnect-cells property

Quoted 7 lines · Krzysztof Kozlowski
Quoted 6 lines · Thierry Reding

From: Thierry Reding <[email protected]>

The #interconnect-cells properties are required to hook up memory clients to the MC/EMC in interconnects properties. Add a description for these properties.

Quoted 7 lines
Quoted 2 lines

Also, allow multiple reg and interrupt entries required by Tegra194 and later.

I think number of interrupts is fixed and you do not change them for newer SoC, so the message is a little bit not precise. Also the subject does not it the patch - maybe something like - "adjust properties for Tegra196"?

Yeah, I forgot to update the commit message after making the changes in v2. I'll send out v3 with an updated commit message.

Thanks,
Thierry

#4 lore raw

PATCH v2 2/6 dt-bindings: memory: tegra: Add Tegra234 support

In reply to Thierry Reding

From: Thierry Reding <[email protected]>

Document the variant of the memory controller and external memory controllers found on Tegra234 and add some memory client and SMMU stream ID definitions for use in device tree files.

---
Changes in v2:
- conditionally set minItems for reg properties

 .../nvidia,tegra186-mc.yaml                   | 20 ++++++++++++
 include/dt-bindings/clock/tegra234-clock.h    |  9 ++++++
 include/dt-bindings/memory/tegra234-mc.h      | 32 +++++++++++++++++++
 3 files changed, 61 insertions(+)
 create mode 100644 include/dt-bindings/memory/tegra234-mc.h
Documentation/devicetree/bindings/memory-controllers/nvidia,tegra186-mc.yaml +20 -0
index b496564b1bdf..13c4c82fd0d3 100644
@@ -31,6 +31,7 @@ properties:
       - enum:
           - nvidia,tegra186-mc
           - nvidia,tegra194-mc
+          - nvidia,tegra234-mc
 
   reg:
     minItems: 1
@@ -68,6 +69,7 @@ patternProperties:
           - enum:
               - nvidia,tegra186-emc
               - nvidia,tegra194-emc
+              - nvidia,tegra234-emc
 
       reg:
         minItems: 1
@@ -112,6 +114,15 @@ patternProperties:
             reg:
               minItems: 2
 
+      - if:
+          properties:
+            compatible:
+              const: nvidia,tegra234-emc
+        then:
+          properties:
+            reg:
+              minItems: 2
+
     additionalProperties: false
 
     required:
@@ -142,6 +153,15 @@ allOf:
         reg:
           minItems: 3
 
+  - if:
+      properties:
+        compatible:
+          const: nvidia,tegra234-mc
+    then:
+      properties:
+        reg:
+          minItems: 3
+
 additionalProperties: false
 
 required:
include/dt-bindings/clock/tegra234-clock.h +9 -0
index 21ed0c732fb9..8d7e66e1b6ef 100644
@@ -9,6 +9,15 @@
  * @defgroup bpmp_clock_ids Clock ID's
  * @{
  */
+/**
+ * @brief controls the EMC clock frequency.
+ * @details Doing a clk_set_rate on this clock will select the
+ * appropriate clock source, program the source rate and execute a
+ * specific sequence to switch to the new clock source for both memory
+ * controllers. This can be used to control the balance between memory
+ * throughput and memory controller power.
+ */
+#define TEGRA234_CLK_EMC			31U
 /** @brief output of gate CLK_ENB_FUSE */
 #define TEGRA234_CLK_FUSE			40U
 /** @brief output of mux controlled by CLK_RST_CONTROLLER_CLK_SOURCE_SDMMC4 */
include/dt-bindings/memory/tegra234-mc.h new file +32 -0
new file mode 100644
index 000000000000..2662f70c15c6
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */
+
+#ifndef DT_BINDINGS_MEMORY_TEGRA234_MC_H
+#define DT_BINDINGS_MEMORY_TEGRA234_MC_H
+
+/* special clients */
+#define TEGRA234_SID_INVALID		0x00
+#define TEGRA234_SID_PASSTHROUGH	0x7f
+
+
+/* NISO1 stream IDs */
+#define TEGRA234_SID_SDMMC4	0x02
+#define TEGRA234_SID_BPMP	0x10
+
+/*
+ * memory client IDs
+ */
+
+/* sdmmcd memory read client */
+#define TEGRA234_MEMORY_CLIENT_SDMMCRAB 0x63
+/* sdmmcd memory write client */
+#define TEGRA234_MEMORY_CLIENT_SDMMCWAB 0x67
+/* BPMP read client */
+#define TEGRA234_MEMORY_CLIENT_BPMPR 0x93
+/* BPMP write client */
+#define TEGRA234_MEMORY_CLIENT_BPMPW 0x94
+/* BPMPDMA read client */
+#define TEGRA234_MEMORY_CLIENT_BPMPDMAR 0x95
+/* BPMPDMA write client */
+#define TEGRA234_MEMORY_CLIENT_BPMPDMAW 0x96
+
+#endif
Signature · 1 line
2.34.1
#5 lore raw

Re: [PATCH v2 2/6] dt-bindings: memory: tegra: Add Tegra234 support

Quoted 18 lines · Thierry Reding

From: Thierry Reding <[email protected]>

Document the variant of the memory controller and external memory controllers found on Tegra234 and add some memory client and SMMU stream ID definitions for use in device tree files.

---
Changes in v2:
- conditionally set minItems for reg properties

 .../nvidia,tegra186-mc.yaml                   | 20 ++++++++++++
 include/dt-bindings/clock/tegra234-clock.h    |  9 ++++++
 include/dt-bindings/memory/tegra234-mc.h      | 32 +++++++++++++++++++
 3 files changed, 61 insertions(+)
 create mode 100644 include/dt-bindings/memory/tegra234-mc.h

(...)

Quoted 28 lines

/** @brief output of mux controlled by CLK_RST_CONTROLLER_CLK_SOURCE_SDMMC4 */

include/dt-bindings/memory/tegra234-mc.h new file +21 -0
new file mode 100644
index 000000000000..2662f70c15c6
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */
+
+#ifndef DT_BINDINGS_MEMORY_TEGRA234_MC_H
+#define DT_BINDINGS_MEMORY_TEGRA234_MC_H
+
+/* special clients */
+#define TEGRA234_SID_INVALID		0x00
+#define TEGRA234_SID_PASSTHROUGH	0x7f
+
+
+/* NISO1 stream IDs */
+#define TEGRA234_SID_SDMMC4	0x02
+#define TEGRA234_SID_BPMP	0x10
+
+/*
+ * memory client IDs
+ */
+
+/* sdmmcd memory read client */
+#define TEGRA234_MEMORY_CLIENT_SDMMCRAB 0x63
+/* sdmmcd memory write client */

include/dt-bindings/memory/tegra234-mc.h line 31

Quoted 10 lines
include/dt-bindings/memory/tegra234-mc.h new file +10 -0
+#define TEGRA234_MEMORY_CLIENT_SDMMCWAB 0x67
+/* BPMP read client */
+#define TEGRA234_MEMORY_CLIENT_BPMPR 0x93
+/* BPMP write client */
+#define TEGRA234_MEMORY_CLIENT_BPMPW 0x94
+/* BPMPDMA read client */
+#define TEGRA234_MEMORY_CLIENT_BPMPDMAR 0x95
+/* BPMPDMA write client */
+#define TEGRA234_MEMORY_CLIENT_BPMPDMAW 0x96
+

This header is needed by the driver and DTS patches. One of us can apply it and provide to the other via stable-tag. I think Arnd and Olof prefer if headers are coming with DTS and are provided to other trees, so maybe you will take the bindings and provide a tag for me for the driver?

Best regards,
Krzysztof

#6 lore raw

Re: [PATCH v2 2/6] dt-bindings: memory: tegra: Add Tegra234 support

Quoted 57 lines · Krzysztof Kozlowski
Quoted 18 lines · Thierry Reding

From: Thierry Reding <[email protected]>

Document the variant of the memory controller and external memory controllers found on Tegra234 and add some memory client and SMMU stream ID definitions for use in device tree files.

---
Changes in v2:
- conditionally set minItems for reg properties

 .../nvidia,tegra186-mc.yaml                   | 20 ++++++++++++
 include/dt-bindings/clock/tegra234-clock.h    |  9 ++++++
 include/dt-bindings/memory/tegra234-mc.h      | 32 +++++++++++++++++++
 3 files changed, 61 insertions(+)
 create mode 100644 include/dt-bindings/memory/tegra234-mc.h

(...)

Quoted 35 lines

/** @brief output of mux controlled by CLK_RST_CONTROLLER_CLK_SOURCE_SDMMC4 */

include/dt-bindings/memory/tegra234-mc.h new file +28 -0
new file mode 100644
index 000000000000..2662f70c15c6
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */
+
+#ifndef DT_BINDINGS_MEMORY_TEGRA234_MC_H
+#define DT_BINDINGS_MEMORY_TEGRA234_MC_H
+
+/* special clients */
+#define TEGRA234_SID_INVALID		0x00
+#define TEGRA234_SID_PASSTHROUGH	0x7f
+
+
+/* NISO1 stream IDs */
+#define TEGRA234_SID_SDMMC4	0x02
+#define TEGRA234_SID_BPMP	0x10
+
+/*
+ * memory client IDs
+ */
+
+/* sdmmcd memory read client */
+#define TEGRA234_MEMORY_CLIENT_SDMMCRAB 0x63
+/* sdmmcd memory write client */
+#define TEGRA234_MEMORY_CLIENT_SDMMCWAB 0x67
+/* BPMP read client */
+#define TEGRA234_MEMORY_CLIENT_BPMPR 0x93
+/* BPMP write client */
+#define TEGRA234_MEMORY_CLIENT_BPMPW 0x94
+/* BPMPDMA read client */
+#define TEGRA234_MEMORY_CLIENT_BPMPDMAR 0x95
Quoted 8 lines

include/dt-bindings/memory/tegra234-mc.h line 31

Quoted 3 lines
include/dt-bindings/memory/tegra234-mc.h new file +3 -0
+/* BPMPDMA write client */
+#define TEGRA234_MEMORY_CLIENT_BPMPDMAW 0x96
+

This header is needed by the driver and DTS patches. One of us can apply it and provide to the other via stable-tag. I think Arnd and Olof prefer if headers are coming with DTS and are provided to other trees, so maybe you will take the bindings and provide a tag for me for the driver?

Yeah, once you're happy with the series (I've just sent out an updated v3) I can apply this to the Tegra tree and send you a stable tag to pull into your tree.

Thierry

#7 lore raw

PATCH v2 3/6 memory: tegra: Add Tegra234 support

In reply to Thierry Reding

From: Thierry Reding <[email protected]>

The memory controller and external memory controller found on Tegra234 is similar to the version found on earlier SoCs but supports a number of new memory clients.

Add initial memory client definitions for the Tegra234 so that the SMMU stream ID override registers can be properly programmed at boot time.

---
 drivers/memory/tegra/Makefile       |  1 +
 drivers/memory/tegra/mc.c           |  3 ++
 drivers/memory/tegra/mc.h           |  7 ++-
 drivers/memory/tegra/tegra186-emc.c |  3 ++
 drivers/memory/tegra/tegra234.c     | 81 +++++++++++++++++++++++++++++
 5 files changed, 94 insertions(+), 1 deletion(-)
 create mode 100644 drivers/memory/tegra/tegra234.c
drivers/memory/tegra/Makefile +1 -0
index c992e87782d2..1df0b43e40b1 100644
@@ -9,6 +9,7 @@ tegra-mc-$(CONFIG_ARCH_TEGRA_132_SOC) += tegra124.o
 tegra-mc-$(CONFIG_ARCH_TEGRA_210_SOC) += tegra210.o
 tegra-mc-$(CONFIG_ARCH_TEGRA_186_SOC) += tegra186.o
 tegra-mc-$(CONFIG_ARCH_TEGRA_194_SOC) += tegra186.o tegra194.o
+tegra-mc-$(CONFIG_ARCH_TEGRA_194_SOC) += tegra186.o tegra234.o
 
 obj-$(CONFIG_TEGRA_MC) += tegra-mc.o
 
drivers/memory/tegra/mc.c +3 -0
index 44b4a4080920..bf3abb6d8354 100644
@@ -44,6 +44,9 @@ static const struct of_device_id tegra_mc_of_match[] = {
 #endif
 #ifdef CONFIG_ARCH_TEGRA_194_SOC
 	{ .compatible = "nvidia,tegra194-mc", .data = &tegra194_mc_soc },
+#endif
+#ifdef CONFIG_ARCH_TEGRA_234_SOC
+	{ .compatible = "nvidia,tegra234-mc", .data = &tegra234_mc_soc },
 #endif
 	{ /* sentinel */ }
 };
drivers/memory/tegra/mc.h +6 -1
index 1e492989c363..062886e94c04 100644
@@ -137,6 +137,10 @@ extern const struct tegra_mc_soc tegra186_mc_soc;
 extern const struct tegra_mc_soc tegra194_mc_soc;
 #endif
 
+#ifdef CONFIG_ARCH_TEGRA_234_SOC
+extern const struct tegra_mc_soc tegra234_mc_soc;
+#endif
+
 #if defined(CONFIG_ARCH_TEGRA_3x_SOC) || \
     defined(CONFIG_ARCH_TEGRA_114_SOC) || \
     defined(CONFIG_ARCH_TEGRA_124_SOC) || \
@@ -147,7 +151,8 @@ extern const struct tegra_mc_ops tegra30_mc_ops;
 #endif
 
 #if defined(CONFIG_ARCH_TEGRA_186_SOC) || \
-    defined(CONFIG_ARCH_TEGRA_194_SOC)
+    defined(CONFIG_ARCH_TEGRA_194_SOC) || \
+    defined(CONFIG_ARCH_TEGRA_234_SOC)
 extern const struct tegra_mc_ops tegra186_mc_ops;
 #endif
 
drivers/memory/tegra/tegra186-emc.c +3 -0
index 746c4ef2c0af..54b47ca33483 100644
@@ -272,6 +272,9 @@ static const struct of_device_id tegra186_emc_of_match[] = {
 #endif
 #if defined(CONFIG_ARCH_TEGRA_194_SOC)
 	{ .compatible = "nvidia,tegra194-emc" },
+#endif
+#if defined(CONFIG_ARCH_TEGRA_234_SOC)
+	{ .compatible = "nvidia,tegra234-emc" },
 #endif
 	{ /* sentinel */ }
 };
drivers/memory/tegra/tegra234.c new file +81 -0

81 lines not on this page · raw message

Signature · 1 line
2.34.1
#8 lore raw

PATCH v2 4/6 arm64: tegra: Add EMC general interrupt on Tegra194

In reply to Thierry Reding

From: Thierry Reding <[email protected]>

Add the missing EMC general interrupt for the external memory controller on Tegra194.

---
Changes in v2:
- new patch to add the missing EMC general interrupt on Tegra194

 arch/arm64/boot/dts/nvidia/tegra194.dtsi | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/nvidia/tegra194.dtsi +1 -0
index 8d29b7fdb044..ee668902dd6c 100644
@@ -593,6 +593,7 @@ emc: external-memory-controller@2c60000 {
 				compatible = "nvidia,tegra194-emc";
 				reg = <0x0 0x02c60000 0x0 0x90000>,
 				      <0x0 0x01780000 0x0 0x80000>;
+				interrupts = <GIC_SPI 224 IRQ_TYPE_LEVEL_HIGH>;
 				clocks = <&bpmp TEGRA194_CLK_EMC>;
 				clock-names = "emc";
 
Signature · 1 line
2.34.1
#9 lore raw

PATCH v2 5/6 arm64: tegra: Add memory controller on Tegra234

In reply to Thierry Reding

From: Thierry Reding <[email protected]>

This adds the memory controller and the embedded external memory controller found on the Tegra234 SoC.

---
Changes in v2:
- move EMC general interrupt from MC to EMC

 arch/arm64/boot/dts/nvidia/tegra234.dtsi | 49 ++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
arch/arm64/boot/dts/nvidia/tegra234.dtsi +49 -0
index f8061b452046..a75b21c6a521 100644
@@ -4,6 +4,7 @@
 #include <dt-bindings/gpio/tegra234-gpio.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 #include <dt-bindings/mailbox/tegra186-hsp.h>
+#include <dt-bindings/memory/tegra234-mc.h>
 #include <dt-bindings/reset/tegra234-reset.h>
 
 / {
@@ -85,6 +86,54 @@ gpio: gpio@2200000 {
 			gpio-controller;
 		};
 
+		mc: memory-controller@2c00000 {
+			compatible = "nvidia,tegra234-mc";
+			reg = <0x02c00000 0x100000>,
+			      <0x02b80000 0x040000>,
+			      <0x01700000 0x100000>;
+			interrupts = <GIC_SPI 223 IRQ_TYPE_LEVEL_HIGH>;
+			#interconnect-cells = <1>;
+			status = "okay";
+
+			#address-cells = <2>;
+			#size-cells = <2>;
+
+			ranges = <0x01700000 0x0 0x01700000 0x0 0x100000>,
+				 <0x02b80000 0x0 0x02b80000 0x0 0x040000>,
+				 <0x02c00000 0x0 0x02c00000 0x0 0x100000>;
+
+			/*
+			 * Bit 39 of addresses passing through the memory
+			 * controller selects the XBAR format used when memory
+			 * is accessed. This is used to transparently access
+			 * memory in the XBAR format used by the discrete GPU
+			 * (bit 39 set) or Tegra (bit 39 clear).
+			 *
+			 * As a consequence, the operating system must ensure
+			 * that bit 39 is never used implicitly, for example
+			 * via an I/O virtual address mapping of an IOMMU. If
+			 * devices require access to the XBAR switch, their
+			 * drivers must set this bit explicitly.
+			 *
+			 * Limit the DMA range for memory clients to [38:0].
+			 */
+			dma-ranges = <0x0 0x0 0x0 0x80 0x0>;
+
+			emc: external-memory-controller@2c60000 {
+				compatible = "nvidia,tegra234-emc";
+				reg = <0x0 0x02c60000 0x0 0x90000>,
+				      <0x0 0x01780000 0x0 0x80000>;
+				interrupts = <GIC_SPI 224 IRQ_TYPE_LEVEL_HIGH>;
+				clocks = <&bpmp TEGRA234_CLK_EMC>;
+				clock-names = "emc";
+				status = "okay";
+
+				#interconnect-cells = <0>;
+
+				nvidia,bpmp = <&bpmp>;
+			};
+		};
+
 		uarta: serial@3100000 {
 			compatible = "nvidia,tegra234-uart", "nvidia,tegra20-uart";
 			reg = <0x03100000 0x10000>;
Signature · 1 line
2.34.1
#10 lore raw

PATCH v2 6/6 arm64: tegra: Hook up MMC and BPMP to memory controller

In reply to Thierry Reding

From: Thierry Reding <[email protected]>

Use the interconnects property to hook up the MMC and BPMP to the memory controller. This is needed to set the correct bus-level DMA mask, which is a prerequisite for adding IOMMU support.

---
 arch/arm64/boot/dts/nvidia/tegra234.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm64/boot/dts/nvidia/tegra234.dtsi +8 -0
index a75b21c6a521..fafbd9a819a4 100644
@@ -157,6 +157,9 @@ mmc@3460000 {
 			assigned-clock-parents = <&bpmp TEGRA234_CLK_PLLC4>;
 			resets = <&bpmp TEGRA234_RESET_SDMMC4>;
 			reset-names = "sdhci";
+			interconnects = <&mc TEGRA234_MEMORY_CLIENT_SDMMCRAB &emc>,
+					<&mc TEGRA234_MEMORY_CLIENT_SDMMCWAB &emc>;
+			interconnect-names = "dma-mem", "write";
 			nvidia,pad-autocal-pull-up-offset-hs400 = <0x00>;
 			nvidia,pad-autocal-pull-down-offset-hs400 = <0x00>;
 			nvidia,pad-autocal-pull-up-offset-1v8-timeout = <0x0a>;
@@ -289,6 +292,11 @@ bpmp: bpmp {
 		#clock-cells = <1>;
 		#reset-cells = <1>;
 		#power-domain-cells = <1>;
+		interconnects = <&mc TEGRA234_MEMORY_CLIENT_BPMPR &emc>,
+				<&mc TEGRA234_MEMORY_CLIENT_BPMPW &emc>,
+				<&mc TEGRA234_MEMORY_CLIENT_BPMPDMAR &emc>,
+				<&mc TEGRA234_MEMORY_CLIENT_BPMPDMAW &emc>;
+		interconnect-names = "read", "write", "dma-mem", "dma-write";
 
 		bpmp_i2c: i2c {
 			compatible = "nvidia,tegra186-bpmp-i2c";
Signature · 1 line
2.34.1