memory: tegra: Add Tegra238 memory controller support
cover memory: tegra: Add Tegra238 memory controller support
This series adds Memory Controller driver support for the Tegra238 SoC.
Tegra238 is similar to Tegra234 but with a reduced memory controller configuration featuring 8 channels instead of 16. The driver reuses Tegra234 memory client IDs and ICC operations, with Tegra238-specific stream IDs for SMMU configuration.
Ashish Mhetre (2):
memory: tegra: Add T238 MC support
dt-bindings: memory: tegra: Add nvidia,tegra238-mc compatible
.../nvidia,tegra186-mc.yaml | 31 ++ drivers/memory/tegra/Makefile | 1 + drivers/memory/tegra/mc.c | 3 + drivers/memory/tegra/mc.h | 6 + drivers/memory/tegra/tegra234.c | 2 +- drivers/memory/tegra/tegra238.c | 395 ++++++++++++++++++ .../dt-bindings/memory/nvidia,tegra238-mc.h | 74 ++++ 7 files changed, 511 insertions(+), 1 deletion(-) create mode 100644 drivers/memory/tegra/tegra238.c create mode 100644 include/dt-bindings/memory/nvidia,tegra238-mc.h
Signature · 1 line
2.50.1
PATCH 1/2 memory: tegra: Add T238 MC support
Add Memory Controller driver support for Tegra238 SOC, including:
- MC client definitions with Tegra238-specific stream IDs
- Reuse of Tegra234 ICC operations for bandwidth management via BPMP-FW
- Device tree compatible string "nvidia,tegra238-mc"
Export tegra234_mc_icc_ops so it can be shared with the Tegra238 MC driver, as both SoCs use the same ICC aggregation and bandwidth management logic.
--- drivers/memory/tegra/Makefile | 1 + drivers/memory/tegra/mc.c | 3 + drivers/memory/tegra/mc.h | 6 + drivers/memory/tegra/tegra234.c | 2 +- drivers/memory/tegra/tegra238.c | 395 ++++++++++++++++++++++++++++++++ 5 files changed, 406 insertions(+), 1 deletion(-) create mode 100644 drivers/memory/tegra/tegra238.c
drivers/memory/tegra/Makefile +1 -0
@@ -10,6 +10,7 @@ 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_234_SOC) += tegra186.o tegra234.o +tegra-mc-$(CONFIG_ARCH_TEGRA_238_SOC) += tegra186.o tegra238.o tegra-mc-$(CONFIG_ARCH_TEGRA_264_SOC) += tegra186.o tegra264.o obj-$(CONFIG_TEGRA_MC) += tegra-mc.o
drivers/memory/tegra/mc.c +3 -0
@@ -49,6 +49,9 @@ static const struct of_device_id tegra_mc_of_match[] = { #ifdef CONFIG_ARCH_TEGRA_234_SOC { .compatible = "nvidia,tegra234-mc", .data = &tegra234_mc_soc }, #endif +#ifdef CONFIG_ARCH_TEGRA_238_SOC + { .compatible = "nvidia,tegra238-mc", .data = &tegra238_mc_soc }, +#endif #ifdef CONFIG_ARCH_TEGRA_264_SOC { .compatible = "nvidia,tegra264-mc", .data = &tegra264_mc_soc }, #endif
drivers/memory/tegra/mc.h +6 -0
@@ -238,6 +238,11 @@ extern const struct tegra_mc_soc tegra194_mc_soc;#ifdef CONFIG_ARCH_TEGRA_234_SOC extern const struct tegra_mc_soc tegra234_mc_soc; +extern const struct tegra_mc_icc_ops tegra234_mc_icc_ops; +#endif + +#ifdef CONFIG_ARCH_TEGRA_238_SOC +extern const struct tegra_mc_soc tegra238_mc_soc;#endif #ifdef CONFIG_ARCH_TEGRA_264_SOC
@@ -256,6 +261,7 @@ extern const struct tegra_mc_ops tegra30_mc_ops;#if defined(CONFIG_ARCH_TEGRA_186_SOC ) || \ defined(CONFIG_ARCH_TEGRA_194_SOC ) || \ defined(CONFIG_ARCH_TEGRA_234_SOC ) || \ + defined(CONFIG_ARCH_TEGRA_238_SOC ) || \ defined(CONFIG_ARCH_TEGRA_264_SOC )extern const struct tegra_mc_ops tegra186_mc_ops;#endif
drivers/memory/tegra/tegra234.c +1 -1
@@ -1125,7 +1125,7 @@ static int tegra234_mc_icc_get_init_bw(struct icc_node *node, u32 *avg, u32 *peareturn 0 ; } -static const struct tegra_mc_icc_ops tegra234_mc_icc_ops = { +const struct tegra_mc_icc_ops tegra234_mc_icc_ops = { .xlate = tegra_mc_icc_xlate, .aggregate = tegra234_mc_icc_aggregate, .get_bw = tegra234_mc_icc_get_init_bw,
drivers/memory/tegra/tegra238.c new file +395 -0
395 lines not on this page · raw message
Signature · 1 line
2.50.1
Jon Hunter
maintainerRe: [PATCH 1/2] memory: tegra: Add T238 MC support
Quoted 36 lines · Ashish Mhetre
Add Memory Controller driver support for Tegra238 SOC, including:
- MC client definitions with Tegra238-specific stream IDs
- Reuse of Tegra234 ICC operations for bandwidth management via BPMP-FW
- Device tree compatible string "nvidia,tegra238-mc"Export
tegra234_mc_icc_opsso it can be shared with the Tegra238 MC driver, as both SoCs use the same ICC aggregation and bandwidth management logic.Signed-off-by Ashish Mhetre <[email protected]>--- drivers/memory/tegra/Makefile | 1 + drivers/memory/tegra/mc.c | 3 + drivers/memory/tegra/mc.h | 6 + drivers/memory/tegra/tegra234.c | 2 +- drivers/memory/tegra/tegra238.c | 395 ++++++++++++++++++++++++++++++++ 5 files changed, 406 insertions(+), 1 deletion(-)create mode 100644
drivers/memory/tegra/tegra238.cdrivers/memory/tegra/Makefile +1
-0@@ -10,6 +10,7 @@ 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_234_SOC) += tegra186.o tegra234.o +tegra-mc-$(CONFIG_ARCH_TEGRA_238_SOC) += tegra186.o tegra238.o tegra-mc-$(CONFIG_ARCH_TEGRA_264_SOC) += tegra186.o tegra264.o obj-$(CONFIG_TEGRA_MC) += tegra-mc.odrivers/memory/tegra/mc.c +0
-0
drivers/memory/tegra/mc.c static const struct of_device_id tegra_mc_of_match[] = { · line 54
Quoted 6 lines
drivers/memory/tegra/mc.c +3
-0@@ -49,6 +49,9 @@ static const struct of_device_id tegra_mc_of_match[] = { #ifdef CONFIG_ARCH_TEGRA_234_SOC { .compatible = "nvidia,tegra234-mc", .data = &tegra234_mc_soc }, #endif +#ifdef CONFIG_ARCH_TEGRA_238_SOC + { .compatible = "nvidia,tegra238-mc", .data = &tegra238_mc_soc }, +#endif
It is always better/preferred for the dt-binding patch to be 1st in the series. The above does not exist until after patch 2 is applied.
Quoted 8 lines
drivers/memory/tegra/mc.c +0
-0#ifdef CONFIG_ARCH_TEGRA_264_SOC { .compatible = "nvidia,tegra264-mc", .data = &tegra264_mc_soc }, #endifdrivers/memory/tegra/mc.h +0
-0
drivers/memory/tegra/mc.h extern const struct tegra_mc_soc tegra194_mc_soc; · line 246
Quoted 9 lines
drivers/memory/tegra/mc.h +5
-0@@ -238,6 +238,11 @@ extern const struct tegra_mc_soc tegra194_mc_soc;#ifdef CONFIG_ARCH_TEGRA_234_SOC extern const struct tegra_mc_soc tegra234_mc_soc; +extern const struct tegra_mc_icc_ops tegra234_mc_icc_ops; +#endif + +#ifdef CONFIG_ARCH_TEGRA_238_SOC +extern const struct tegra_mc_soc tegra238_mc_soc;#endif
Does this work? Tegra238 is dependent upon stuff in Tegra234, but there is no guarantee that both of these CONFIG options are always enabled?
Quoted 33 lines
drivers/memory/tegra/mc.h +1
-0#ifdef CONFIG_ARCH_TEGRA_264_SOC @@ -256,6 +261,7 @@ extern const struct tegra_mc_ops tegra30_mc_ops;#if defined(CONFIG_ARCH_TEGRA_186_SOC ) || \ defined(CONFIG_ARCH_TEGRA_194_SOC ) || \ defined(CONFIG_ARCH_TEGRA_234_SOC ) || \ + defined(CONFIG_ARCH_TEGRA_238_SOC ) || \ defined(CONFIG_ARCH_TEGRA_264_SOC )extern const struct tegra_mc_ops tegra186_mc_ops;#endif drivers/memory/tegra/tegra234.c +1
-1@@ -1125,7 +1125,7 @@ static int tegra234_mc_icc_get_init_bw(struct icc_node *node, u32 *avg, u32 *peareturn 0 ; } -static const struct tegra_mc_icc_ops tegra234_mc_icc_ops = { +const struct tegra_mc_icc_ops tegra234_mc_icc_ops = { .xlate = tegra_mc_icc_xlate, .aggregate = tegra234_mc_icc_aggregate, .get_bw = tegra234_mc_icc_get_init_bw,drivers/memory/tegra/tegra238.c new file +4
-0@@ -0,0 +1,395 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (C) 2026, NVIDIA CORPORATION. All rights reserved. +*/
...
Quoted 7 lines
drivers/memory/tegra/tegra238.c new file +7
-0+const struct tegra_mc_soc tegra238_mc_soc = { + .num_clients =ARRAY_SIZE (tegra238_mc_clients), + .clients = tegra238_mc_clients, + .num_address_bits =40 , + .num_channels =8 , + .client_id_mask =0x1ff , + .intmasks = tegra238_mc_intmasks,
drivers/memory/tegra/tegra238.c line 388
Quoted 10 lines
drivers/memory/tegra/tegra238.c new file +10
-0+ .num_intmasks = ARRAY_SIZE(tegra238_mc_intmasks), + .has_addr_hi_reg = true, + .ops = &tegra186_mc_ops, + .icc_ops = &tegra234_mc_icc_ops, + .ch_intmask = 0x0000ff00, + .global_intstatus_channel_shift = 8, +/* +* Additionally, there are lite carveouts but those are not currently +* supported. +*/
I don't know what this means?
drivers/memory/tegra/tegra238.c line 395
Quoted 7 lines
drivers/memory/tegra/tegra238.c new file +7
-0+ .num_carveouts = 32, + .regs = &tegra20_mc_regs, + .handle_irq = tegra30_mc_irq_handlers, + .num_interrupts = ARRAY_SIZE(tegra30_mc_irq_handlers), + .mc_addr_hi_mask = 0x3, + .mc_err_status_type_mask = (0x7 << 28), +};
Jon
Signature · 1 line
nvpublic
Re: [PATCH 1/2] memory: tegra: Add T238 MC support
Quoted 39 lines · Jon Hunter
Quoted 36 lines · Ashish Mhetre
Add Memory Controller driver support for Tegra238 SOC, including:
- MC client definitions with Tegra238-specific stream IDs
- Reuse of Tegra234 ICC operations for bandwidth management via BPMP-FW
- Device tree compatible string "nvidia,tegra238-mc"Export
tegra234_mc_icc_opsso it can be shared with the Tegra238 MC driver, as both SoCs use the same ICC aggregation and bandwidth management logic.Signed-off-by Ashish Mhetre <[email protected]>---
drivers/memory/tegra/Makefile | 1 + drivers/memory/tegra/mc.c | 3 + drivers/memory/tegra/mc.h | 6 +drivers/memory/tegra/tegra234.c| 2 +-drivers/memory/tegra/tegra238.c| 395 ++++++++++++++++++++++++++++++++5 files changed, 406 insertions(+), 1 deletion(-)create mode 100644
drivers/memory/tegra/tegra238.cdrivers/memory/tegra/Makefile +0
-0@@ -10,6 +10,7 @@ tegra-mc-$(CONFIG_ARCH_TEGRA_210_SOC) += tegra210.otegra-mc-$(CONFIG_ARCH_TEGRA_186_SOC) += tegra186.o tegra-mc-$(CONFIG_ARCH_TEGRA_194_SOC) += tegra186.o tegra194.o tegra-mc-$(CONFIG_ARCH_TEGRA_234_SOC) += tegra186.o tegra234.o +tegra-mc-$(CONFIG_ARCH_TEGRA_238_SOC) += tegra186.o tegra238.o tegra-mc-$(CONFIG_ARCH_TEGRA_264_SOC) += tegra186.o tegra264.o obj-$(CONFIG_TEGRA_MC) += tegra-mc.o
drivers/memory/tegra/mc.c +0
-0@@ -49,6 +49,9 @@ static const struct of_device_id tegra_mc_of_match[] = {
Quoted 9 lines
drivers/memory/tegra/mc.c static const struct of_device_id tegra_mc_of_match[] = { · line 54
Quoted 6 lines
drivers/memory/tegra/mc.c +3
-0#ifdef CONFIG_ARCH_TEGRA_234_SOC { .compatible = "nvidia,tegra234-mc", .data = &tegra234_mc_soc }, #endif +#ifdef CONFIG_ARCH_TEGRA_238_SOC + { .compatible = "nvidia,tegra238-mc", .data = &tegra238_mc_soc }, +#endifIt is always better/preferred for the dt-binding patch to be 1st in the series. The above does not exist until after patch 2 is applied.
Ack, I will resend with correct ordering.
Quoted 10 lines
Quoted 10 lines
drivers/memory/tegra/mc.c +0
-0#ifdef CONFIG_ARCH_TEGRA_264_SOC { .compatible = "nvidia,tegra264-mc", .data = &tegra264_mc_soc },#endif
drivers/memory/tegra/mc.h +0
-0@@ -238,6 +238,11 @@ extern const struct tegra_mc_soc tegra194_mc_soc; #ifdef CONFIG_ARCH_TEGRA_234_SOC extern const struct tegra_mc_soc tegra234_mc_soc;
Quoted 9 lines
drivers/memory/tegra/mc.h extern const struct tegra_mc_soc tegra194_mc_soc; · line 246
Quoted 6 lines
drivers/memory/tegra/mc.h +5
-0+extern const struct tegra_mc_icc_ops tegra234_mc_icc_ops; +#endif + +#ifdef CONFIG_ARCH_TEGRA_238_SOC +extern const struct tegra_mc_soc tegra238_mc_soc; #endifDoes this work? Tegra238 is dependent upon stuff in Tegra234, but there is no guarantee that both of these CONFIG options are always enabled?
Good point, thanks for catching this Jon. If CONFIG_ARCH_TEGRA_238_SOC is enabled without CONFIG_ARCH_TEGRA_234_SOC, the build would fail since tegra234_mc_icc_ops wouldn't be compiled or declared.
I'll fix this in V2 with combined Tegra234 and Tegra238 SOC guard for struct.
Quoted 54 lines
Quoted 32 lines
drivers/memory/tegra/mc.h +1
-0#ifdef CONFIG_ARCH_TEGRA_264_SOC@@ -256,6 +261,7 @@ extern const struct tegra_mc_ops tegra30_mc_ops; #if defined(CONFIG_ARCH_TEGRA_186_SOC) || \ defined(CONFIG_ARCH_TEGRA_194_SOC) || \ defined(CONFIG_ARCH_TEGRA_234_SOC) || \ + defined(CONFIG_ARCH_TEGRA_238_SOC) || \ defined(CONFIG_ARCH_TEGRA_264_SOC) extern const struct tegra_mc_ops tegra186_mc_ops; #endifdrivers/memory/tegra/tegra234.c +0
-0@@ -1125,7 +1125,7 @@ static int tegra234_mc_icc_get_init_bw(struct
icc_node*node, u32 *avg, u32 *pea
return 0;
}
-static const structtegra_mc_icc_opstegra234_mc_icc_ops= { +const structtegra_mc_icc_opstegra234_mc_icc_ops= { .xlate =tegra_mc_icc_xlate,
.aggregate =tegra234_mc_icc_aggregate,
.get_bw =tegra234_mc_icc_get_init_bw,drivers/memory/tegra/tegra238.c new file +4
-0@@ -0,0 +1,395 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (C) 2026, NVIDIA CORPORATION. All rights reserved. +*/ ...
Quoted 10 lines
+const struct
tegra_mc_soctegra238_mc_soc= { + .num_clients =ARRAY_SIZE(tegra238_mc_clients), + .clients =tegra238_mc_clients,
+ .num_address_bits = 40,
+ .num_channels = 8,
+ .client_id_mask =0x1ff,
+ .intmasks =tegra238_mc_intmasks,
+ .num_intmasks =ARRAY_SIZE(tegra238_mc_intmasks), + .has_addr_hi_reg = true,
+ .ops =&tegra186_mc_ops,Quoted 8 lines
+ .icc_ops =
&tegra234_mc_icc_ops,
+ .ch_intmask =0x0000ff00,
+ .global_intstatus_channel_shift = 8,
+ /*
+ * Additionally, there are lite carveouts but those are not currently
+ * supported.
+ */
Quoted 2 lines
I don't know what this means?
I have kept this comment similar to Tegra234. tegra_mc_get_carveout_info() function uses num_carveouts variable as upper limit for supported carveouts. On top of it, there are few lite carveouts which are supported by SOC but are not used by the driver.
It's redundant info IMO and can be removed from both Tegra234 and Tegra238. Jon, Can you please share your thoughts on this?
Thanks,
Ashish Mhetre
Quoted 10 lines
Quoted 7 lines
+ .num_carveouts = 32,
+ .regs =&tegra20_mc_regs,
+ .handle_irq =tegra30_mc_irq_handlers,
+ .num_interrupts =ARRAY_SIZE(tegra30_mc_irq_handlers), + .mc_addr_hi_mask =0x3,
+ .mc_err_status_type_mask = (0x7<< 28),
+};Jon
PATCH 2/2 dt-bindings: memory: tegra: Add nvidia,tegra238-mc compatible
In reply to Ashish MhetreDocument the device tree binding for the Tegra238 memory controller. Tegra238 has 8 memory controller channels plus broadcast and stream-id registers.
Add the stream ID header (nvidia,tegra238-mc.h) defining ISO and NISO stream IDs for SMMU configuration.
--- .../nvidia,tegra186-mc.yaml | 31 ++++++++ .../dt-bindings/memory/nvidia,tegra238-mc.h | 74 +++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 include/dt-bindings/memory/nvidia,tegra238-mc.h
Documentation/devicetree/bindings/memory-controllers/nvidia,tegra186-mc.yaml +31 -0
@@ -32,6 +32,7 @@ properties: - nvidia,tegra186-mc - nvidia,tegra194-mc - nvidia,tegra234-mc + - nvidia,tegra238-mc - nvidia,tegra264-mc reg:
@@ -266,6 +267,36 @@ allOf: interrupt-names: false + - if: + properties: + compatible: + const: nvidia,tegra238-mc + then: + properties: + reg: + minItems: 10 + maxItems: 10 + description: 8 memory controller channels, 1 broadcast, and 1 for stream-id registers + + reg-names: + items: + - const: sid + - const: broadcast + - const: ch0 + - const: ch1 + - const: ch2 + - const: ch3 + - const: ch4 + - const: ch5 + - const: ch6 + - const: ch7 + + interrupts: + items: + - description: MC general interrupt + + interrupt-names: false + - if: properties: compatible:
include/dt-bindings/memory/nvidia,tegra238-mc.h new file +74 -0
74 lines not on this page · raw message
Signature · 1 line
2.50.1
Jon Hunter
maintainerRe: [PATCH 2/2] dt-bindings: memory: tegra: Add nvidia,tegra238-mc compatible
Quoted 30 lines · Ashish Mhetre
Document the device tree binding for the Tegra238 memory controller. Tegra238 has 8 memory controller channels plus broadcast and stream-id registers.
Add the stream ID header (nvidia,tegra238-mc.h) defining ISO and NISO stream IDs for SMMU configuration.
Signed-off-by Ashish Mhetre <[email protected]>--- .../nvidia,tegra186-mc.yaml | 31 ++++++++ .../dt-bindings/memory/nvidia,tegra238-mc.h | 74 +++++++++++++++++++ 2 files changed, 105 insertions(+)create mode 100644
include/dt-bindings/memory/nvidia,tegra238-mc.hDocumentation/devicetree/bindings/memory-controllers/nvidia,tegra186-mc.yaml +1
-0@@ -32,6 +32,7 @@ properties: - nvidia,tegra186-mc - nvidia,tegra194-mc - nvidia,tegra234-mc + - nvidia,tegra238-mc - nvidia,tegra264-mc reg:@@ -266,6 +267,36 @@ allOf: interrupt-names: false
Documentation/devicetree/bindings/memory-controllers/nvidia,tegra186-mc.yaml allOf: · line 279
Quoted 10 lines
Documentation/devicetree/bindings/memory-controllers/nvidia,tegra186-mc.yaml +10
-0+ - if: + properties: + compatible: + const: nvidia,tegra238-mc + then: + properties: + reg: + minItems: 10 + maxItems: 10 + description: 8 memory controller channels, 1 broadcast, and 1 for stream-id registers
To be consistent with existing bindings, this should be "9 memory controller channels and 1 for stream-id registers". It appears that the broadcast is just consider to be a memory controller channel.
Jon
Signature · 1 line
nvpublic
Krzysztof Kozlowski
maintainerQuoted 7 lines · Ashish Mhetre
This series adds Memory Controller driver support for the Tegra238 SoC.
Tegra238 is similar to Tegra234 but with a reduced memory controller configuration featuring 8 channels instead of 16. The driver reuses Tegra234 memory client IDs and ICC operations, with Tegra238-specific stream IDs for SMMU configuration.
Thank you for the patch/patchset. My tree is currently closed for new features till the end of the merge window. I will review and/or apply the patch after the merge window. No need to resend it, I will keep this in my mailbox.
If I misjudged this patch and this is a fix, please let me know.
Best regards,
Krzysztof
Krzysztof Kozlowski
maintainerQuoted 9 lines · Krzysztof Kozlowski
Quoted 7 lines · Ashish Mhetre
This series adds Memory Controller driver support for the Tegra238 SoC.
Tegra238 is similar to Tegra234 but with a reduced memory controller configuration featuring 8 channels instead of 16. The driver reuses Tegra234 memory client IDs and ICC operations, with Tegra238-specific stream IDs for SMMU configuration.
Quoted 6 lines
Thank you for the patch/patchset. My tree is currently closed for new features till the end of the merge window. I will review and/or apply the patch after the merge window. No need to resend it, I will keep this in my mailbox.
If I misjudged this patch and this is a fix, please let me know.
And FWIW, I did take a quick look and code seemed fine, so I don't have immediate objections.
Best regards,
Krzysztof