Skip to contentSkip to conversation

Support Tegra210 actmon for dynamic EMC scaling

PATCH Superseded Aaron Kling 3 participants 21 messages Sep 3, 2025 – Sep 6, 2025

Subsystems (4)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 cover Support Tegra210 actmon for dynamic EMC scaling

This series adds interconnect support to tegra210 MC and EMC, then enables actmon. This enables dynamic emc scaling.

---
Changes in v2:
- Assume 64-bit dram bus width in patch 4
- Add dt-bindings patch to document the new properties on the
tegra210-emc node.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Aaron Kling (8):
dt-bindings: memory: tegra210: Add memory client IDs
dt-bindings: devfreq: tegra30-actmon: Add Tegra124 fallback for Tegra210
dt-bindings: memory: tegra210: emc: Document OPP table and interconnect
soc: tegra: fuse: speedo-tegra210: Add soc speedo 2
memory: tegra210: Support interconnect framework
arm64: tegra: tegra210: Add actmon
arm64: tegra: Add interconnect properties to Tegra210 device-tree
arm64: tegra: Add OPP tables on Tegra210

 .../bindings/devfreq/nvidia,tegra30-actmon.yaml    |  13 +-
 .../memory-controllers/nvidia,tegra210-emc.yaml    |  13 +
 .../boot/dts/nvidia/tegra210-peripherals-opp.dtsi  | 135 ++++++++++
 arch/arm64/boot/dts/nvidia/tegra210.dtsi           |  43 ++++
 drivers/memory/tegra/Kconfig                       |   1 +
 drivers/memory/tegra/tegra210-emc-core.c           | 274 ++++++++++++++++++++-
 drivers/memory/tegra/tegra210-emc.h                |  23 ++
 drivers/memory/tegra/tegra210.c                    |  81 ++++++
 drivers/soc/tegra/fuse/speedo-tegra210.c           |   1 +
 include/dt-bindings/memory/tegra210-mc.h           |  58 +++++
 10 files changed, 635 insertions(+), 7 deletions(-)

---
base-commit: 8f5ae30d69d7543eee0d70083daf4de8fe15d585
change-id: 20250822-t210-actmon-34904ce7ed0c
prerequisite-change-id: 20250812-tegra210-speedo-470691e8b8cc:v2
prerequisite-patch-id: 83adce426963f91482cc0928357dad36705a3328
prerequisite-patch-id: f693f138b5d40cdc45d9066ce48cbcff782253f8
prerequisite-patch-id: 9e3b9b2fdb8d9c2264dfa7641d1aec84fb7aedd9
prerequisite-patch-id: ef4bcc4ddba7898b188fb3fc6e414a2662183f91

Best regards,

Signature · 1 line
Aaron Kling <[email protected]>
#1 lore raw

PATCH v2 1/8 dt-bindings: memory: tegra210: Add memory client IDs

Each memory client has unique hardware ID, add these IDs.

---
 include/dt-bindings/memory/tegra210-mc.h | 58 ++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)
include/dt-bindings/memory/tegra210-mc.h +58 -0
index 5e082547f1794cba1f72872782e04d8747863b6d..48474942a000e049142014e3bcc132b88bf1a92d 100644
@@ -75,4 +75,62 @@
 #define TEGRA210_MC_RESET_ETR		28
 #define TEGRA210_MC_RESET_TSECB		29
 
+#define TEGRA210_MC_PTCR		0
+#define TEGRA210_MC_DISPLAY0A		1
+#define TEGRA210_MC_DISPLAY0AB		2
+#define TEGRA210_MC_DISPLAY0B		3
+#define TEGRA210_MC_DISPLAY0BB		4
+#define TEGRA210_MC_DISPLAY0C		5
+#define TEGRA210_MC_DISPLAY0CB		6
+#define TEGRA210_MC_AFIR		14
+#define TEGRA210_MC_AVPCARM7R		15
+#define TEGRA210_MC_DISPLAYHC		16
+#define TEGRA210_MC_DISPLAYHCB		17
+#define TEGRA210_MC_HDAR		21
+#define TEGRA210_MC_HOST1XDMAR		22
+#define TEGRA210_MC_HOST1XR		23
+#define TEGRA210_MC_NVENCSRD		28
+#define TEGRA210_MC_PPCSAHBDMAR		29
+#define TEGRA210_MC_PPCSAHBSLVR		30
+#define TEGRA210_MC_SATAR		31
+#define TEGRA210_MC_MPCORER		39
+#define TEGRA210_MC_NVENCSWR		43
+#define TEGRA210_MC_AFIW		49
+#define TEGRA210_MC_AVPCARM7W		50
+#define TEGRA210_MC_HDAW		53
+#define TEGRA210_MC_HOST1XW		54
+#define TEGRA210_MC_MPCOREW		57
+#define TEGRA210_MC_PPCSAHBDMAW		59
+#define TEGRA210_MC_PPCSAHBSLVW		60
+#define TEGRA210_MC_SATAW		61
+#define TEGRA210_MC_ISPRA		68
+#define TEGRA210_MC_ISPWA		70
+#define TEGRA210_MC_ISPWB		71
+#define TEGRA210_MC_XUSB_HOSTR		74
+#define TEGRA210_MC_XUSB_HOSTW		75
+#define TEGRA210_MC_XUSB_DEVR		76
+#define TEGRA210_MC_XUSB_DEVW		77
+#define TEGRA210_MC_ISPRAB		78
+#define TEGRA210_MC_ISPWAB		80
+#define TEGRA210_MC_ISPWBB		81
+#define TEGRA210_MC_TSECSRD		84
+#define TEGRA210_MC_TSECSWR		85
+#define TEGRA210_MC_A9AVPSCR		86
+#define TEGRA210_MC_A9AVPSCW		87
+#define TEGRA210_MC_GPUSRD		88
+#define TEGRA210_MC_GPUSWR		89
+#define TEGRA210_MC_DISPLAYT		90
+#define TEGRA210_MC_SDMMCRA		96
+#define TEGRA210_MC_SDMMCRAA		97
+#define TEGRA210_MC_SDMMCR		98
+#define TEGRA210_MC_SDMMCRAB		99
+#define TEGRA210_MC_SDMMCWA		100
+#define TEGRA210_MC_SDMMCWAA		101
+#define TEGRA210_MC_SDMMCW		102
+#define TEGRA210_MC_SDMMCWAB		103
+#define TEGRA210_MC_VICSRD		108
+#define TEGRA210_MC_VICSWR		109
+#define TEGRA210_MC_VIW			114
+#define TEGRA210_MC_DISPLAYD		115
+
 #endif
Signature · 1 line
2.50.1
#2 lore raw

Re: [PATCH v2 1/8] dt-bindings: memory: tegra210: Add memory client IDs

Quoted 12 lines · Aaron Kling

Each memory client has unique hardware ID, add these IDs.

---
 include/dt-bindings/memory/tegra210-mc.h | 58 ++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)
include/dt-bindings/memory/tegra210-mc.h +0 -0
index 5e082547f1794cba1f72872782e04d8747863b6d..48474942a000e049142014e3bcc132b88bf1a92d 100644

include/dt-bindings/memory/tegra210-mc.h line 78

Quoted 4 lines
include/dt-bindings/memory/tegra210-mc.h +1 -0
@@ -75,4 +75,62 @@
 #define TEGRA210_MC_RESET_ETR		28
 #define TEGRA210_MC_RESET_TSECB		29
 
+#define TEGRA210_MC_PTCR		0

There is no driver user of this ABI, so does not look like a binding.

You have entire commit msg to clarify such unusual things, like lack of users. Please use it.

Best regards,
Krzysztof

#3 lore raw

Re: [PATCH v2 1/8] dt-bindings: memory: tegra210: Add memory client IDs

Quoted 17 lines · Krzysztof Kozlowski
Quoted 15 lines · Aaron Kling

Each memory client has unique hardware ID, add these IDs.

---
 include/dt-bindings/memory/tegra210-mc.h | 58 ++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)
include/dt-bindings/memory/tegra210-mc.h +0 -0
index 5e082547f1794cba1f72872782e04d8747863b6d..48474942a000e049142014e3bcc132b88bf1a92d 100644
@@ -75,4 +75,62 @@
 #define TEGRA210_MC_RESET_ETR                28
 #define TEGRA210_MC_RESET_TSECB              29
 
Quoted 6 lines

include/dt-bindings/memory/tegra210-mc.h line 78

Quoted 1 line
include/dt-bindings/memory/tegra210-mc.h +1 -0
+#define TEGRA210_MC_PTCR             0

There is no driver user of this ABI, so does not look like a binding.

You have entire commit msg to clarify such unusual things, like lack of users. Please use it.

The tegra210-mc driver has these hardcoded and should probably be updated to use the bindings instead, but I think that's outside of the scope of this series. I will clarify such in the updated message.

Aaron

#4 lore raw

Re: [PATCH v2 1/8] dt-bindings: memory: tegra210: Add memory client IDs

Quoted 22 lines · Aaron Kling
Quoted 21 lines · Krzysztof Kozlowski
Quoted 12 lines · Aaron Kling

Each memory client has unique hardware ID, add these IDs.

---
 include/dt-bindings/memory/tegra210-mc.h | 58 ++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)
include/dt-bindings/memory/tegra210-mc.h +0 -0
index 5e082547f1794cba1f72872782e04d8747863b6d..48474942a000e049142014e3bcc132b88bf1a92d 100644

include/dt-bindings/memory/tegra210-mc.h line 78

Quoted 4 lines
include/dt-bindings/memory/tegra210-mc.h +1 -0
@@ -75,4 +75,62 @@
 #define TEGRA210_MC_RESET_ETR                28
 #define TEGRA210_MC_RESET_TSECB              29
 
+#define TEGRA210_MC_PTCR             0

There is no driver user of this ABI, so does not look like a binding.

Quoted 6 lines
Quoted 2 lines

You have entire commit msg to clarify such unusual things, like lack of users. Please use it.

The tegra210-mc driver has these hardcoded and should probably be updated to use the bindings instead, but I think that's outside of the scope of this series. I will clarify such in the updated message.

If you introduce the binding, change the drivers to use it. Otherwise there is no point benefit in this binding, really.

Quoted 2 lines

Aaron

Best regards,
Krzysztof

#5 lore raw

Re: [PATCH v2 1/8] dt-bindings: memory: tegra210: Add memory client IDs

Quoted 27 lines · Krzysztof Kozlowski
Quoted 25 lines · Aaron Kling
Quoted 23 lines · Krzysztof Kozlowski
Quoted 12 lines · Aaron Kling

Each memory client has unique hardware ID, add these IDs.

---
 include/dt-bindings/memory/tegra210-mc.h | 58 ++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)
include/dt-bindings/memory/tegra210-mc.h +0 -0
index 5e082547f1794cba1f72872782e04d8747863b6d..48474942a000e049142014e3bcc132b88bf1a92d 100644

include/dt-bindings/memory/tegra210-mc.h line 78

Quoted 4 lines
include/dt-bindings/memory/tegra210-mc.h +1 -0
@@ -75,4 +75,62 @@
 #define TEGRA210_MC_RESET_ETR                28
 #define TEGRA210_MC_RESET_TSECB              29
 
+#define TEGRA210_MC_PTCR             0

There is no driver user of this ABI, so does not look like a binding.

You have entire commit msg to clarify such unusual things, like lack of users. Please use it.

Quoted 6 lines
Quoted 3 lines

The tegra210-mc driver has these hardcoded and should probably be updated to use the bindings instead, but I think that's outside of the scope of this series. I will clarify such in the updated message.

If you introduce the binding, change the drivers to use it. Otherwise there is no point benefit in this binding, really.

Ack. I was adding the bindings to avoid magic numbers in the dt commits at the end of this series. But I can update the mc driver as well.

Aaron

#6 lore raw

PATCH v2 2/8 dt-bindings: devfreq: tegra30-actmon: Add Tegra124 fallback for Tegra210

In reply to Aaron Kling

The Tegra210 actmon is compatible with the existing Tegra124 driver. Describe the compatibles as such.

---
 .../devicetree/bindings/devfreq/nvidia,tegra30-actmon.yaml  | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
Documentation/devicetree/bindings/devfreq/nvidia,tegra30-actmon.yaml +8 -5
index e3379d1067283e36d1bee303187c0205b410f610..ea1dc86bc31f635f91a0e36f908f5c0c4f9a804c 100644
@@ -19,11 +19,14 @@ description: |
 
 properties:
   compatible:
-    enum:
-      - nvidia,tegra30-actmon
-      - nvidia,tegra114-actmon
-      - nvidia,tegra124-actmon
-      - nvidia,tegra210-actmon
+    oneOf:
+      - enum:
+          - nvidia,tegra30-actmon
+          - nvidia,tegra114-actmon
+          - nvidia,tegra124-actmon
+      - items:
+          - const: nvidia,tegra210-actmon
+          - const: nvidia,tegra124-actmon
 
   reg:
     maxItems: 1
Signature · 1 line
2.50.1
maintainer Reviewed-by on v2 2/8
#7 lore raw

Re: [PATCH v2 2/8] dt-bindings: devfreq: tegra30-actmon: Add Tegra124 fallback for Tegra210

Quoted 7 lines · Aaron Kling

The Tegra210 actmon is compatible with the existing Tegra124 driver. Describe the compatibles as such.

---
 .../devicetree/bindings/devfreq/nvidia,tegra30-actmon.yaml  | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

Best regards,
Krzysztof

Acked-by on v2 2/8
#8 lore raw

Re: [PATCH v2 2/8] dt-bindings: devfreq: tegra30-actmon: Add Tegra124 fallback for Tegra210

In reply to Aaron Kling

Hi,

25. 9. 4. 04:50에 Aaron Kling via B4 Relay 이(가) 쓴 글:

Quoted 25 lines

From: Aaron Kling <[email protected]>

The Tegra210 actmon is compatible with the existing Tegra124 driver. Describe the compatibles as such.

---
 .../devicetree/bindings/devfreq/nvidia,tegra30-actmon.yaml  | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
Documentation/devicetree/bindings/devfreq/nvidia,tegra30-actmon.yaml +1 -5
index e3379d1067283e36d1bee303187c0205b410f610..ea1dc86bc31f635f91a0e36f908f5c0c4f9a804c 100644
@@ -19,11 +19,14 @@ description: |
 
 properties:
   compatible:
-    enum:
-      - nvidia,tegra30-actmon
-      - nvidia,tegra114-actmon
-      - nvidia,tegra124-actmon
-      - nvidia,tegra210-actmon
+    oneOf:

Documentation/devicetree/bindings/devfreq/nvidia,tegra30-actmon.yaml description: | · line 32

Quoted 10 lines
Documentation/devicetree/bindings/devfreq/nvidia,tegra30-actmon.yaml +7 -0
+      - enum:
+          - nvidia,tegra30-actmon
+          - nvidia,tegra114-actmon
+          - nvidia,tegra124-actmon
+      - items:
+          - const: nvidia,tegra210-actmon
+          - const: nvidia,tegra124-actmon
 
   reg:
     maxItems: 1
Signature · 3 lines
Best Regards,
Samsung Electronics
Chanwoo Choi
#9 lore raw

PATCH v2 3/8 dt-bindings: memory: tegra210: emc: Document OPP table and interconnect

In reply to Aaron Kling

These are needed for dynamic frequency scaling of the EMC controller.

---
 .../bindings/memory-controllers/nvidia,tegra210-emc.yaml    | 13 +++++++++++++
 1 file changed, 13 insertions(+)
Documentation/devicetree/bindings/memory-controllers/nvidia,tegra210-emc.yaml +13 -0
index bc8477e7ab193b7880bb681037985f3fccebf02f..6cc1c7fc7a328bd18c7c0beb535c1ff918bcdb2a 100644
@@ -33,6 +33,9 @@ properties:
     items:
       - description: EMC general interrupt
 
+  "#interconnect-cells":
+    const: 0
+
   memory-region:
     maxItems: 1
     description:
@@ -44,12 +47,19 @@ properties:
     description:
       phandle of the memory controller node
 
+  operating-points-v2:
+    description:
+      Should contain freqs and voltages and opp-supported-hw property, which
+      is a bitfield indicating SoC speedo ID mask.
+
 required:
   - compatible
   - reg
   - clocks
   - clock-names
+  - "#interconnect-cells"
   - nvidia,memory-controller
+  - operating-points-v2
 
 additionalProperties: false
 
@@ -79,4 +89,7 @@ examples:
         interrupts = <GIC_SPI 78 IRQ_TYPE_LEVEL_HIGH>;
         memory-region = <&emc_table>;
         nvidia,memory-controller = <&mc>;
+        operating-points-v2 = <&dvfs_opp_table>;
+
+        #interconnect-cells = <0>;
     };
Signature · 1 line
2.50.1
#10 lore raw

Re: [PATCH v2 3/8] dt-bindings: memory: tegra210: emc: Document OPP table and interconnect

Quoted 6 lines · Aaron Kling

These are needed for dynamic frequency scaling of the EMC controller.

---
 .../bindings/memory-controllers/nvidia,tegra210-emc.yaml    | 13 +++++++++++++
 1 file changed, 13 insertions(+)

I asked to order patches within patchset in some logical way. First patch was memory, second other, third again memory.

There are no dependencies explained, so this looks like groupping unrelated patches, therefore SPLIT finally the patchset per subsystem.

Quoted 16 lines
Documentation/devicetree/bindings/memory-controllers/nvidia,tegra210-emc.yaml +3 -0
index bc8477e7ab193b7880bb681037985f3fccebf02f..6cc1c7fc7a328bd18c7c0beb535c1ff918bcdb2a 100644
@@ -33,6 +33,9 @@ properties:
     items:
       - description: EMC general interrupt
 
+  "#interconnect-cells":
+    const: 0
+
   memory-region:
     maxItems: 1
     description:

Documentation/devicetree/bindings/memory-controllers/nvidia,tegra210-emc.yaml properties: · line 54

Quoted 8 lines
Documentation/devicetree/bindings/memory-controllers/nvidia,tegra210-emc.yaml +5 -0
@@ -44,12 +47,19 @@ properties:
     description:
       phandle of the memory controller node
 
+  operating-points-v2:
+    description:
+      Should contain freqs and voltages and opp-supported-hw property, which
+      is a bitfield indicating SoC speedo ID mask.
+

No opp-table?

Documentation/devicetree/bindings/memory-controllers/nvidia,tegra210-emc.yaml properties: · line 60

Quoted 6 lines
Documentation/devicetree/bindings/memory-controllers/nvidia,tegra210-emc.yaml +1 -0
 required:
   - compatible
   - reg
   - clocks
   - clock-names
+  - "#interconnect-cells"

That's ABI break without explanation.

Documentation/devicetree/bindings/memory-controllers/nvidia,tegra210-emc.yaml properties: · line 62

Quoted 2 lines
Documentation/devicetree/bindings/memory-controllers/nvidia,tegra210-emc.yaml +1 -0
   - nvidia,memory-controller
+  - operating-points-v2

Best regards,
Krzysztof

#11 lore raw

Re: [PATCH v2 3/8] dt-bindings: memory: tegra210: emc: Document OPP table and interconnect

Quoted 34 lines · Krzysztof Kozlowski
Quoted 6 lines · Aaron Kling

These are needed for dynamic frequency scaling of the EMC controller.

---
 .../bindings/memory-controllers/nvidia,tegra210-emc.yaml    | 13 +++++++++++++
 1 file changed, 13 insertions(+)

I asked to order patches within patchset in some logical way. First patch was memory, second other, third again memory.

There are no dependencies explained, so this looks like groupping unrelated patches, therefore SPLIT finally the patchset per subsystem.

Quoted 19 lines
Documentation/devicetree/bindings/memory-controllers/nvidia,tegra210-emc.yaml +3 -0
index bc8477e7ab193b7880bb681037985f3fccebf02f..6cc1c7fc7a328bd18c7c0beb535c1ff918bcdb2a 100644
@@ -33,6 +33,9 @@ properties:
     items:
       - description: EMC general interrupt
 
+  "#interconnect-cells":
+    const: 0
+
   memory-region:
     maxItems: 1
     description:
@@ -44,12 +47,19 @@ properties:
     description:
       phandle of the memory controller node
 
Quoted 7 lines

Documentation/devicetree/bindings/memory-controllers/nvidia,tegra210-emc.yaml properties: · line 54

Quoted 5 lines
Documentation/devicetree/bindings/memory-controllers/nvidia,tegra210-emc.yaml +5 -0
+  operating-points-v2:
+    description:
+      Should contain freqs and voltages and opp-supported-hw property, which
+      is a bitfield indicating SoC speedo ID mask.
+

No opp-table?

All other tegra devices have the opp tables in standalone nodes, not as subnodes to their users. I followed that style here, see patch 8.

Aaron

#12 lore raw

PATCH v2 4/8 soc: tegra: fuse: speedo-tegra210: Add soc speedo 2

In reply to Aaron Kling

The Jetson Nano series of modules only have 2 emc table entries, different from other soc sku's. As the emc driver uses the soc speedo to populate the emc opp tables, add a new speedo id to uniquely identify this.

---
 drivers/soc/tegra/fuse/speedo-tegra210.c | 1 +
 1 file changed, 1 insertion(+)
drivers/soc/tegra/fuse/speedo-tegra210.c +1 -0
index 60356159e00d2059e55eaacba27b5ca63bf96c90..c310bdabcfd06ea8f23facb4eaaf209f183dc4eb 100644
@@ -97,6 +97,7 @@ static void __init rev_sku_to_speedo_ids(struct tegra_sku_info *sku_info,
 			break;
 
 		case 0x8F:
+			sku_info->soc_speedo_id = 2;
 			sku_info->cpu_speedo_id = 9;
 			sku_info->gpu_speedo_id = 2;
 			break;
Signature · 1 line
2.50.1
#13 lore raw

PATCH v2 5/8 memory: tegra210: Support interconnect framework

In reply to Aaron Kling

This makes mc and emc interconnect providers and allows for dynamic memory clock scaling.

---
 drivers/memory/tegra/Kconfig             |   1 +
 drivers/memory/tegra/tegra210-emc-core.c | 274 ++++++++++++++++++++++++++++++-
 drivers/memory/tegra/tegra210-emc.h      |  23 +++
 drivers/memory/tegra/tegra210.c          |  81 +++++++++
 4 files changed, 377 insertions(+), 2 deletions(-)
drivers/memory/tegra/Kconfig +1 -0
index fc5a277918267ee8240f9fb9efeb80275db4790b..2d0be29afe2b9ebf9a0630ef7fb6fb43ff359499 100644
@@ -55,6 +55,7 @@ config TEGRA210_EMC
 	tristate "NVIDIA Tegra210 External Memory Controller driver"
 	depends on ARCH_TEGRA_210_SOC || COMPILE_TEST
 	select TEGRA210_EMC_TABLE
+	select PM_OPP
 	help
 	  This driver is for the External Memory Controller (EMC) found on
 	  Tegra210 chips. The EMC controls the external DRAM on the board.
drivers/memory/tegra/tegra210-emc-core.c +272 -2

318 lines not on this page · raw message

drivers/memory/tegra/tegra210-emc.h +23 -0
index 8988bcf1529072a7bdc93b185ebe0d51d82c1763..3c9142bfd5ae5c57bbc139e69e62c893b50ce40c 100644
@@ -8,6 +8,7 @@
 
 #include <linux/clk.h>
 #include <linux/clk/tegra.h>
+#include <linux/interconnect-provider.h>
 #include <linux/io.h>
 #include <linux/platform_device.h>
 
@@ -784,6 +785,17 @@ enum {
 #define TRIM_REGS_SIZE 138
 #define BURST_REGS_SIZE 221
 
+enum emc_rate_request_type {
+	EMC_RATE_DEBUG,
+	EMC_RATE_ICC,
+	EMC_RATE_TYPE_MAX,
+};
+
+struct emc_rate_request {
+	unsigned long min_rate;
+	unsigned long max_rate;
+};
+
 struct tegra210_emc_per_channel_regs {
 	u16 bank;
 	u16 offset;
@@ -932,6 +944,17 @@ struct tegra210_emc {
 	} debugfs;
 
 	struct tegra210_clk_emc_provider provider;
+
+	struct icc_provider icc_provider;
+
+	/*
+	 * There are multiple sources in the EMC driver which could request
+	 * a min/max clock rate, these rates are contained in this array.
+	 */
+	struct emc_rate_request requested_rate[EMC_RATE_TYPE_MAX];
+
+	/* protect shared rate-change code path */
+	struct mutex rate_lock;
 };
 
 struct tegra210_emc_sequence {
drivers/memory/tegra/tegra210.c +81 -0

98 lines not on this page · raw message

Signature · 1 line
2.50.1
#14 lore raw

Re: [PATCH v2 5/8] memory: tegra210: Support interconnect framework

Quoted 10 lines · Aaron Kling

This makes mc and emc interconnect providers and allows for dynamic memory clock scaling.

---
 drivers/memory/tegra/Kconfig             |   1 +
 drivers/memory/tegra/tegra210-emc-core.c | 274 ++++++++++++++++++++++++++++++-
 drivers/memory/tegra/tegra210-emc.h      |  23 +++
 drivers/memory/tegra/tegra210.c          |  81 +++++++++
 4 files changed, 377 insertions(+), 2 deletions(-)

Patch #3 was memory, patch #4 was soc, patch #5 is memory, so that mixup pattern continues.

Please address the earlier feedback.

Quoted 29 lines
drivers/memory/tegra/Kconfig +1 -0
index fc5a277918267ee8240f9fb9efeb80275db4790b..2d0be29afe2b9ebf9a0630ef7fb6fb43ff359499 100644
@@ -55,6 +55,7 @@ config TEGRA210_EMC
 	tristate "NVIDIA Tegra210 External Memory Controller driver"
 	depends on ARCH_TEGRA_210_SOC || COMPILE_TEST
 	select TEGRA210_EMC_TABLE
+	select PM_OPP
 	help
 	  This driver is for the External Memory Controller (EMC) found on
 	  Tegra210 chips. The EMC controls the external DRAM on the board.
drivers/memory/tegra/tegra210-emc-core.c +1 -0
index e96ca4157d48182574310f8caf72687bed7cc16a..f12e60b47fa87d629505cde57310d2bb68fc87f3 100644
@@ -13,6 +13,7 @@
 #include <linux/module.h>
 #include <linux/of_reserved_mem.h>
 #include <linux/platform_device.h>
+#include <linux/pm_opp.h>
 #include <linux/slab.h>
 #include <linux/thermal.h>
 #include <soc/tegra/fuse.h>
@@ -1569,6 +1570,79 @@ static int tegra210_emc_set_rate(struct device *dev,
 	return 0;
 }
 

...

Quoted 36 lines
drivers/memory/tegra/tegra210-emc-core.c +32 -0
@@ -1758,6 +1832,193 @@ static void tegra210_emc_debugfs_init(struct tegra210_emc *emc)
 			    &tegra210_emc_debug_temperature_fops);
 }
 
+static inline struct tegra210_emc *
+to_tegra210_emc_provider(struct icc_provider *provider)
+{
+	return container_of(provider, struct tegra210_emc, icc_provider);
+}
+
+static struct icc_node_data *
+emc_of_icc_xlate_extended(const struct of_phandle_args *spec, void *data)
+{
+	struct icc_provider *provider = data;
+	struct icc_node_data *ndata;
+	struct icc_node *node;
+
+	/* External Memory is the only possible ICC route */
+	list_for_each_entry(node, &provider->nodes, node_list) {
+		if (node->id != TEGRA_ICC_EMEM)
+			continue;
+
+		ndata = kzalloc(sizeof(*ndata), GFP_KERNEL);
+		if (!ndata)
+			return ERR_PTR(-ENOMEM);
+
+		/*
+		 * SRC and DST nodes should have matching TAG in order to have
+		 * it set by default for a requested path.
+		 */
+		ndata->tag = TEGRA_MC_ICC_TAG_ISO;
+		ndata->node = node;
+
+		return ndata;
+	}
+

drivers/memory/tegra/tegra210-emc-core.c static void tegra210_emc_debugfs_init(struct tegra210_emc *emc) · line 1876

Quoted 10 lines
drivers/memory/tegra/tegra210-emc-core.c +10 -0
+	return ERR_PTR(-EPROBE_DEFER);
+}
+
+static int emc_icc_set(struct icc_node *src, struct icc_node *dst)
+{
+	struct tegra210_emc *emc = to_tegra210_emc_provider(dst->provider);
+	unsigned long long peak_bw = icc_units_to_bps(dst->peak_bw);
+	unsigned long long avg_bw = icc_units_to_bps(dst->avg_bw);
+	unsigned long long rate = max(avg_bw, peak_bw);
+	const unsigned int ddr = 2;

Just use defines in top part for this.

drivers/memory/tegra/tegra210-emc-core.c static void tegra210_emc_debugfs_init(struct tegra210_emc *emc) · line 1884

Quoted 8 lines
drivers/memory/tegra/tegra210-emc-core.c +8 -0
+	int err;
+
+	/*
+	 * Tegra210 memory layout can be 1 channel at 64-bit or 2 channels
+	 * at 32-bit each. Either way, the total bus width will always be
+	 * 64-bit.
+	 */
+	const unsigned int dram_data_bus_width_bytes = 64 / 8;

Same here.

Quoted 86 lines
drivers/memory/tegra/tegra210-emc-core.c +86 -0
+
+	/*
+	 * Tegra210 EMC runs on a clock rate of SDRAM bus. This means that
+	 * EMC clock rate is twice smaller than the peak data rate because
+	 * data is sampled on both EMC clock edges.
+	 */
+	do_div(rate, ddr * dram_data_bus_width_bytes);
+	rate = min_t(u64, rate, U32_MAX);
+
+	err = emc_set_min_rate(emc, rate, EMC_RATE_ICC);
+	if (err)
+		return err;
+
+	return 0;
+}
+
+static int tegra_emc_icc_get_init_bw(struct icc_node *node, u32 *avg, u32 *peak)
+{
+	*avg = 0;
+	*peak = 0;
+
+	return 0;
+}
+
+static int tegra_emc_interconnect_init(struct tegra210_emc *emc)
+{
+	const struct tegra_mc_soc *soc = emc->mc->soc;
+	struct icc_node *node;
+	int err;
+
+	emc->icc_provider.dev = emc->dev;
+	emc->icc_provider.set = emc_icc_set;
+	emc->icc_provider.data = &emc->icc_provider;
+	emc->icc_provider.aggregate = soc->icc_ops->aggregate;
+	emc->icc_provider.xlate_extended = emc_of_icc_xlate_extended;
+	emc->icc_provider.get_bw = tegra_emc_icc_get_init_bw;
+
+	icc_provider_init(&emc->icc_provider);
+
+	/* create External Memory Controller node */
+	node = icc_node_create(TEGRA_ICC_EMC);
+	if (IS_ERR(node)) {
+		err = PTR_ERR(node);
+		goto err_msg;
+	}
+
+	node->name = "External Memory Controller";
+	icc_node_add(node, &emc->icc_provider);
+
+	/* link External Memory Controller to External Memory (DRAM) */
+	err = icc_link_create(node, TEGRA_ICC_EMEM);
+	if (err)
+		goto remove_nodes;
+
+	/* create External Memory node */
+	node = icc_node_create(TEGRA_ICC_EMEM);
+	if (IS_ERR(node)) {
+		err = PTR_ERR(node);
+		goto remove_nodes;
+	}
+
+	node->name = "External Memory (DRAM)";
+	icc_node_add(node, &emc->icc_provider);
+
+	err = icc_provider_register(&emc->icc_provider);
+	if (err)
+		goto remove_nodes;
+
+	return 0;
+
+remove_nodes:
+	icc_nodes_remove(&emc->icc_provider);
+err_msg:
+	dev_err(emc->dev, "failed to initialize ICC: %d\n", err);
+
+	return err;
+}
+
+static int tegra_emc_opp_table_init(struct tegra210_emc *emc)
+{
+	u32 hw_version = BIT(tegra_sku_info.soc_speedo_id);
+	struct dev_pm_opp *opp;
+	unsigned long rate;
+	int opp_token, err, max_opps, i;
+
+	err = dev_pm_opp_set_supported_hw(emc->dev, &hw_version, 1);

drivers/memory/tegra/tegra210-emc-core.c static void tegra210_emc_debugfs_init(struct tegra210_emc *emc) · line 1980

Quoted 10 lines
drivers/memory/tegra/tegra210-emc-core.c +10 -0
+	if (err < 0) {
+		dev_err(emc->dev, "failed to set OPP supported HW: %d\n", err);
+		return err;
+	}
+	opp_token = err;
+
+	err = dev_pm_opp_of_add_table(emc->dev);
+	if (err) {
+		if (err == -ENODEV)
+			dev_err(emc->dev, "OPP table not found, please update your device tree\n");

So this looks like the actual ABI break.

Best regards,
Krzysztof

#15 lore raw

Re: [PATCH v2 5/8] memory: tegra210: Support interconnect framework

Quoted 13 lines · Krzysztof Kozlowski
Quoted 10 lines · Aaron Kling

This makes mc and emc interconnect providers and allows for dynamic memory clock scaling.

---
 drivers/memory/tegra/Kconfig             |   1 +
 drivers/memory/tegra/tegra210-emc-core.c | 274 ++++++++++++++++++++++++++++++-
 drivers/memory/tegra/tegra210-emc.h      |  23 +++
 drivers/memory/tegra/tegra210.c          |  81 +++++++++
 4 files changed, 377 insertions(+), 2 deletions(-)
Quoted 4 lines

Patch #3 was memory, patch #4 was soc, patch #5 is memory, so that mixup pattern continues.

Please address the earlier feedback.

Alright, I double check the docs and re-order this and my other series for the next revisions. I had a misunderstanding how subsystems were split up, which caused most but not all of the issues.

Quoted 183 lines
Quoted 30 lines
drivers/memory/tegra/Kconfig +1 -0
index fc5a277918267ee8240f9fb9efeb80275db4790b..2d0be29afe2b9ebf9a0630ef7fb6fb43ff359499 100644
@@ -55,6 +55,7 @@ config TEGRA210_EMC
      tristate "NVIDIA Tegra210 External Memory Controller driver"
      depends on ARCH_TEGRA_210_SOC || COMPILE_TEST
      select TEGRA210_EMC_TABLE
+     select PM_OPP
      help
        This driver is for the External Memory Controller (EMC) found on
        Tegra210 chips. The EMC controls the external DRAM on the board.
drivers/memory/tegra/tegra210-emc-core.c +1 -0
index e96ca4157d48182574310f8caf72687bed7cc16a..f12e60b47fa87d629505cde57310d2bb68fc87f3 100644
@@ -13,6 +13,7 @@
 #include <linux/module.h>
 #include <linux/of_reserved_mem.h>
 #include <linux/platform_device.h>
+#include <linux/pm_opp.h>
 #include <linux/slab.h>
 #include <linux/thermal.h>
 #include <soc/tegra/fuse.h>
@@ -1569,6 +1570,79 @@ static int tegra210_emc_set_rate(struct device *dev,
      return 0;
 }
 

...

Quoted 36 lines
drivers/memory/tegra/tegra210-emc-core.c +32 -0
@@ -1758,6 +1832,193 @@ static void tegra210_emc_debugfs_init(struct tegra210_emc *emc)
                          &tegra210_emc_debug_temperature_fops);
 }
 
+static inline struct tegra210_emc *
+to_tegra210_emc_provider(struct icc_provider *provider)
+{
+     return container_of(provider, struct tegra210_emc, icc_provider);
+}
+
+static struct icc_node_data *
+emc_of_icc_xlate_extended(const struct of_phandle_args *spec, void *data)
+{
+     struct icc_provider *provider = data;
+     struct icc_node_data *ndata;
+     struct icc_node *node;
+
+     /* External Memory is the only possible ICC route */
+     list_for_each_entry(node, &provider->nodes, node_list) {
+             if (node->id != TEGRA_ICC_EMEM)
+                     continue;
+
+             ndata = kzalloc(sizeof(*ndata), GFP_KERNEL);
+             if (!ndata)
+                     return ERR_PTR(-ENOMEM);
+
+             /*
+              * SRC and DST nodes should have matching TAG in order to have
+              * it set by default for a requested path.
+              */
+             ndata->tag = TEGRA_MC_ICC_TAG_ISO;
+             ndata->node = node;
+
+             return ndata;
+     }
+

drivers/memory/tegra/tegra210-emc-core.c static void tegra210_emc_debugfs_init(struct tegra210_emc *emc) · line 1876

Quoted 10 lines
drivers/memory/tegra/tegra210-emc-core.c +10 -0
+     return ERR_PTR(-EPROBE_DEFER);
+}
+
+static int emc_icc_set(struct icc_node *src, struct icc_node *dst)
+{
+     struct tegra210_emc *emc = to_tegra210_emc_provider(dst->provider);
+     unsigned long long peak_bw = icc_units_to_bps(dst->peak_bw);
+     unsigned long long avg_bw = icc_units_to_bps(dst->avg_bw);
+     unsigned long long rate = max(avg_bw, peak_bw);
+     const unsigned int ddr = 2;

Just use defines in top part for this.

drivers/memory/tegra/tegra210-emc-core.c static void tegra210_emc_debugfs_init(struct tegra210_emc *emc) · line 1884

Quoted 8 lines
drivers/memory/tegra/tegra210-emc-core.c +8 -0
+     int err;
+
+     /*
+      * Tegra210 memory layout can be 1 channel at 64-bit or 2 channels
+      * at 32-bit each. Either way, the total bus width will always be
+      * 64-bit.
+      */
+     const unsigned int dram_data_bus_width_bytes = 64 / 8;

Same here.

Quoted 90 lines
drivers/memory/tegra/tegra210-emc-core.c +90 -0
+
+     /*
+      * Tegra210 EMC runs on a clock rate of SDRAM bus. This means that
+      * EMC clock rate is twice smaller than the peak data rate because
+      * data is sampled on both EMC clock edges.
+      */
+     do_div(rate, ddr * dram_data_bus_width_bytes);
+     rate = min_t(u64, rate, U32_MAX);
+
+     err = emc_set_min_rate(emc, rate, EMC_RATE_ICC);
+     if (err)
+             return err;
+
+     return 0;
+}
+
+static int tegra_emc_icc_get_init_bw(struct icc_node *node, u32 *avg, u32 *peak)
+{
+     *avg = 0;
+     *peak = 0;
+
+     return 0;
+}
+
+static int tegra_emc_interconnect_init(struct tegra210_emc *emc)
+{
+     const struct tegra_mc_soc *soc = emc->mc->soc;
+     struct icc_node *node;
+     int err;
+
+     emc->icc_provider.dev = emc->dev;
+     emc->icc_provider.set = emc_icc_set;
+     emc->icc_provider.data = &emc->icc_provider;
+     emc->icc_provider.aggregate = soc->icc_ops->aggregate;
+     emc->icc_provider.xlate_extended = emc_of_icc_xlate_extended;
+     emc->icc_provider.get_bw = tegra_emc_icc_get_init_bw;
+
+     icc_provider_init(&emc->icc_provider);
+
+     /* create External Memory Controller node */
+     node = icc_node_create(TEGRA_ICC_EMC);
+     if (IS_ERR(node)) {
+             err = PTR_ERR(node);
+             goto err_msg;
+     }
+
+     node->name = "External Memory Controller";
+     icc_node_add(node, &emc->icc_provider);
+
+     /* link External Memory Controller to External Memory (DRAM) */
+     err = icc_link_create(node, TEGRA_ICC_EMEM);
+     if (err)
+             goto remove_nodes;
+
+     /* create External Memory node */
+     node = icc_node_create(TEGRA_ICC_EMEM);
+     if (IS_ERR(node)) {
+             err = PTR_ERR(node);
+             goto remove_nodes;
+     }
+
+     node->name = "External Memory (DRAM)";
+     icc_node_add(node, &emc->icc_provider);
+
+     err = icc_provider_register(&emc->icc_provider);
+     if (err)
+             goto remove_nodes;
+
+     return 0;
+
+remove_nodes:
+     icc_nodes_remove(&emc->icc_provider);
+err_msg:
+     dev_err(emc->dev, "failed to initialize ICC: %d\n", err);
+
+     return err;
+}
+
+static int tegra_emc_opp_table_init(struct tegra210_emc *emc)
+{
+     u32 hw_version = BIT(tegra_sku_info.soc_speedo_id);
+     struct dev_pm_opp *opp;
+     unsigned long rate;
+     int opp_token, err, max_opps, i;
+
+     err = dev_pm_opp_set_supported_hw(emc->dev, &hw_version, 1);
+     if (err < 0) {
+             dev_err(emc->dev, "failed to set OPP supported HW: %d\n", err);
+             return err;
+     }
Quoted 8 lines

drivers/memory/tegra/tegra210-emc-core.c static void tegra210_emc_debugfs_init(struct tegra210_emc *emc) · line 1980

Quoted 6 lines
drivers/memory/tegra/tegra210-emc-core.c +6 -0
+     opp_token = err;
+
+     err = dev_pm_opp_of_add_table(emc->dev);
+     if (err) {
+             if (err == -ENODEV)
+                     dev_err(emc->dev, "OPP table not found, please update your device tree\n");

So this looks like the actual ABI break.

Okay, so let's discuss this. For reference, I based this patch off the tegra124 change [0], which also caused an abi break. I know past changes don't justify current mistakes, but this is the context. This series adds all new required dt properties to the arch common dtsi, so any newly compiled dtb will work. Any old dtb with a new kernel would fail to probe, however. I think it would be safe to just skip the interconnect init if the opp table init returns ENODEV, then let probe succeed, but I would have to verify that. Do I need to do that and drop the new requires from the binding?

Aaron

[0] https://github.com/torvalds/linux/commit/380def2d4cf257663de42618e57134afeded32dd#diff-3ff603a1ea7654928390eb213cea0424b6a12251bccbb5fd3b9720402a3c076aR1435

#16 lore raw

Re: [PATCH v2 5/8] memory: tegra210: Support interconnect framework

Quoted 22 lines · Aaron Kling
Quoted 13 lines
Quoted 13 lines
drivers/memory/tegra/tegra210-emc-core.c +13 -0
+
+static int tegra_emc_opp_table_init(struct tegra210_emc *emc)
+{
+     u32 hw_version = BIT(tegra_sku_info.soc_speedo_id);
+     struct dev_pm_opp *opp;
+     unsigned long rate;
+     int opp_token, err, max_opps, i;
+
+     err = dev_pm_opp_set_supported_hw(emc->dev, &hw_version, 1);
+     if (err < 0) {
+             dev_err(emc->dev, "failed to set OPP supported HW: %d\n", err);
+             return err;
+     }
Quoted 8 lines

drivers/memory/tegra/tegra210-emc-core.c static void tegra210_emc_debugfs_init(struct tegra210_emc *emc) · line 1980

Quoted 6 lines
drivers/memory/tegra/tegra210-emc-core.c +6 -0
+     opp_token = err;
+
+     err = dev_pm_opp_of_add_table(emc->dev);
+     if (err) {
+             if (err == -ENODEV)
+                     dev_err(emc->dev, "OPP table not found, please update your device tree\n");

So this looks like the actual ABI break.

Quoted 2 lines

Okay, so let's discuss this. For reference, I based this patch off the tegra124 change [0], which also caused an abi break. I know past

That was almost 5 years ago and we also got stricter what we require in the commit msg. It's also documented in writing bindings.

Quoted 4 lines

changes don't justify current mistakes, but this is the context. This series adds all new required dt properties to the arch common dtsi, so any newly compiled dtb will work. Any old dtb with a new kernel would fail to probe, however. I think it would be safe to just skip the

That's the ABI break.

Quoted 3 lines

interconnect init if the opp table init returns ENODEV, then let probe succeed, but I would have to verify that. Do I need to do that and drop the new requires from the binding?

The best would be yes, make it optional in the binding as well.

Best regards,
Krzysztof

#17 lore raw

PATCH v2 6/8 arm64: tegra: tegra210: Add actmon

In reply to Aaron Kling

This enables the action monitor to facilitate dynamic frequency scaling.

---
 arch/arm64/boot/dts/nvidia/tegra210.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/arm64/boot/dts/nvidia/tegra210.dtsi +12 -0
index 402b0ede1472af625d9d9e811f5af306d436cc98..6da10db893add44a98fde1666c382511212fd43c 100644
@@ -485,6 +485,18 @@ flow-controller@60007000 {
 		reg = <0x0 0x60007000 0x0 0x1000>;
 	};
 
+	actmon@6000c800 {
+		compatible = "nvidia,tegra210-actmon", "nvidia,tegra124-actmon";
+		reg = <0x0 0x6000c800 0x0 0x400>;
+		interrupts = <GIC_SPI 45 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&tegra_car TEGRA210_CLK_ACTMON>,
+			 <&tegra_car TEGRA210_CLK_EMC>;
+		clock-names = "actmon", "emc";
+		resets = <&tegra_car 119>;
+		reset-names = "actmon";
+		#cooling-cells = <2>;
+	};
+
 	gpio: gpio@6000d000 {
 		compatible = "nvidia,tegra210-gpio", "nvidia,tegra30-gpio";
 		reg = <0x0 0x6000d000 0x0 0x1000>;
Signature · 1 line
2.50.1
#18 lore raw

PATCH v2 7/8 arm64: tegra: Add interconnect properties to Tegra210 device-tree

In reply to Aaron Kling

Add interconnect properties to the Memory Controller, External Memory Controller and the Display Controller nodes in order to describe hardware interconnection.

---
 arch/arm64/boot/dts/nvidia/tegra210.dtsi | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
arch/arm64/boot/dts/nvidia/tegra210.dtsi +24 -0
index 6da10db893add44a98fde1666c382511212fd43c..2fcc7a28690f7100d49e8b93c4fb77de7947b002 100644
@@ -202,6 +202,19 @@ dc@54200000 {
 
 			nvidia,outputs = <&dsia &dsib &sor0 &sor1>;
 			nvidia,head = <0>;
+
+			interconnects = <&mc TEGRA210_MC_DISPLAY0A &emc>,
+					<&mc TEGRA210_MC_DISPLAY0B &emc>,
+					<&mc TEGRA210_MC_DISPLAY0C &emc>,
+					<&mc TEGRA210_MC_DISPLAYHC &emc>,
+					<&mc TEGRA210_MC_DISPLAYD &emc>,
+					<&mc TEGRA210_MC_DISPLAYT &emc>;
+			interconnect-names = "wina",
+					     "winb",
+					     "winc",
+					     "cursor",
+					     "wind",
+					     "wint";
 		};
 
 		dc@54240000 {
@@ -217,6 +230,15 @@ dc@54240000 {
 
 			nvidia,outputs = <&dsia &dsib &sor0 &sor1>;
 			nvidia,head = <1>;
+
+			interconnects = <&mc TEGRA210_MC_DISPLAY0AB &emc>,
+					<&mc TEGRA210_MC_DISPLAY0BB &emc>,
+					<&mc TEGRA210_MC_DISPLAY0CB &emc>,
+					<&mc TEGRA210_MC_DISPLAYHCB &emc>;
+			interconnect-names = "wina",
+					     "winb",
+					     "winc",
+					     "cursor";
 		};
 
 		dsia: dsi@54300000 {
@@ -990,6 +1012,7 @@ mc: memory-controller@70019000 {
 
 		#iommu-cells = <1>;
 		#reset-cells = <1>;
+		#interconnect-cells = <1>;
 	};
 
 	emc: external-memory-controller@7001b000 {
@@ -1001,6 +1024,7 @@ emc: external-memory-controller@7001b000 {
 		clock-names = "emc";
 		interrupts = <GIC_SPI 78 IRQ_TYPE_LEVEL_HIGH>;
 		nvidia,memory-controller = <&mc>;
+		#interconnect-cells = <0>;
 		#cooling-cells = <2>;
 	};
 
Signature · 1 line
2.50.1
#19 lore raw

PATCH v2 8/8 arm64: tegra: Add OPP tables on Tegra210

In reply to Aaron Kling

This adds OPP tables for actmon and emc, enabling dynamic frequency scaling for ram.

---
 .../boot/dts/nvidia/tegra210-peripherals-opp.dtsi  | 135 +++++++++++++++++++++
 arch/arm64/boot/dts/nvidia/tegra210.dtsi           |   7 ++
 2 files changed, 142 insertions(+)
arch/arm64/boot/dts/nvidia/tegra210-peripherals-opp.dtsi new file +135 -0
new file mode 100644
index 0000000000000000000000000000000000000000..bf2527d737932a1f41aa83d61f44d87ba52b0519
@@ -0,0 +1,135 @@
+// SPDX-License-Identifier: GPL-2.0
+
+/ {
+	/* EMC DVFS OPP table */
+	emc_icc_dvfs_opp_table: opp-table-dvfs0 {
+		compatible = "operating-points-v2";
+
+		opp-40800000-800 {
+			opp-microvolt = <800000 800000 1150000>;
+			opp-hz = /bits/ 64 <40800000>;
+			opp-supported-hw = <0x0003>;
+		};
+
+		opp-68000000-800 {
+			opp-microvolt = <800000 800000 1150000>;
+			opp-hz = /bits/ 64 <68000000>;
+			opp-supported-hw = <0x0003>;
+		};
+
+		opp-102000000-800 {
+			opp-microvolt = <800000 800000 1150000>;
+			opp-hz = /bits/ 64 <102000000>;
+			opp-supported-hw = <0x0003>;
+		};
+
+		opp-204000000-800 {
+			opp-microvolt = <800000 800000 1150000>;
+			opp-hz = /bits/ 64 <204000000>;
+			opp-supported-hw = <0x0007>;
+			opp-suspend;
+		};
+
+		opp-408000000-812 {
+			opp-microvolt = <812000 812000 1150000>;
+			opp-hz = /bits/ 64 <408000000>;
+			opp-supported-hw = <0x0003>;
+		};
+
+		opp-665600000-825 {
+			opp-microvolt = <825000 825000 1150000>;
+			opp-hz = /bits/ 64 <665600000>;
+			opp-supported-hw = <0x0003>;
+		};
+
+		opp-800000000-825 {
+			opp-microvolt = <825000 825000 1150000>;
+			opp-hz = /bits/ 64 <800000000>;
+			opp-supported-hw = <0x0003>;
+		};
+
+		opp-1065600000-837 {
+			opp-microvolt = <837000 837000 1150000>;
+			opp-hz = /bits/ 64 <1065600000>;
+			opp-supported-hw = <0x0003>;
+		};
+
+		opp-1331200000-850 {
+			opp-microvolt = <850000 850000 1150000>;
+			opp-hz = /bits/ 64 <1331200000>;
+			opp-supported-hw = <0x0003>;
+		};
+
+		opp-1600000000-887 {
+			opp-microvolt = <887000 887000 1150000>;
+			opp-hz = /bits/ 64 <1600000000>;
+			opp-supported-hw = <0x0007>;
+		};
+	};
+
+	/* EMC bandwidth OPP table */
+	emc_bw_dfs_opp_table: opp-table-dvfs1 {
+		compatible = "operating-points-v2";
+
+		opp-40800000 {
+			opp-hz = /bits/ 64 <40800000>;
+			opp-supported-hw = <0x0003>;
+			opp-peak-kBps = <652800>;
+		};
+
+		opp-68000000 {
+			opp-hz = /bits/ 64 <68000000>;
+			opp-supported-hw = <0x0003>;
+			opp-peak-kBps = <1088000>;
+		};
+
+		opp-102000000 {
+			opp-hz = /bits/ 64 <102000000>;
+			opp-supported-hw = <0x0003>;
+			opp-peak-kBps = <1632000>;
+		};
+
+		opp-204000000 {
+			opp-hz = /bits/ 64 <204000000>;
+			opp-supported-hw = <0x0007>;
+			opp-peak-kBps = <3264000>;
+			opp-suspend;
+		};
+
+		opp-408000000 {
+			opp-hz = /bits/ 64 <408000000>;
+			opp-supported-hw = <0x0003>;
+			opp-peak-kBps = <6528000>;
+		};
+
+		opp-665600000 {
+			opp-hz = /bits/ 64 <665600000>;
+			opp-supported-hw = <0x0003>;
+			opp-peak-kBps = <10649600>;
+		};
+
+		opp-800000000 {
+			opp-hz = /bits/ 64 <800000000>;
+			opp-supported-hw = <0x001F>;
+			opp-peak-kBps = <12800000>;
+		};
+
+		opp-1065600000 {
+			opp-hz = /bits/ 64 <1065600000>;
+			opp-supported-hw = <0x0003>;
+			opp-peak-kBps = <17049600>;
+		};
+
+		opp-1331200000 {
+			opp-hz = /bits/ 64 <1331200000>;
+			opp-supported-hw = <0x0003>;
+			opp-peak-kBps = <21299200>;
+		};
+
+		opp-1600000000 {
+			opp-hz = /bits/ 64 <1600000000>;
+			opp-supported-hw = <0x0007>;
+			opp-peak-kBps = <25600000>;
+		};
+	};
+};
arch/arm64/boot/dts/nvidia/tegra210.dtsi +7 -0
index 2fcc7a28690f7100d49e8b93c4fb77de7947b002..f2961c9e12db1cf91254b75389779955f2a0956d 100644
@@ -9,6 +9,8 @@
 #include <dt-bindings/thermal/tegra124-soctherm.h>
 #include <dt-bindings/soc/tegra-pmc.h>
 
+#include "tegra210-peripherals-opp.dtsi"
+
 / {
 	compatible = "nvidia,tegra210";
 	interrupt-parent = <&lic>;
@@ -516,6 +518,9 @@ actmon@6000c800 {
 		clock-names = "actmon", "emc";
 		resets = <&tegra_car 119>;
 		reset-names = "actmon";
+		operating-points-v2 = <&emc_bw_dfs_opp_table>;
+		interconnects = <&mc TEGRA210_MC_MPCORER &emc>;
+		interconnect-names = "cpu-read";
 		#cooling-cells = <2>;
 	};
 
@@ -1024,6 +1029,8 @@ emc: external-memory-controller@7001b000 {
 		clock-names = "emc";
 		interrupts = <GIC_SPI 78 IRQ_TYPE_LEVEL_HIGH>;
 		nvidia,memory-controller = <&mc>;
+		operating-points-v2 = <&emc_icc_dvfs_opp_table>;
+
 		#interconnect-cells = <0>;
 		#cooling-cells = <2>;
 	};
Signature · 1 line
2.50.1