Skip to contentSkip to conversation

arm64: tegra: Add DBB clock to EMC on Tegra264

PATCH Superseded Thierry Reding 2 participants 6 messages Nov 5, 2025

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover arm64: tegra: Add DBB clock to EMC on Tegra264

From: Thierry Reding <[email protected]>

Hi,

Tegra264 requires the DBB clock to be enabled anytime an IP block needs to access external memory. The external memory controller is the right place to put this logic. This short series of patches adds the DBB clock to the bindings, adds code to the driver to use that clock and finally passes the clock into the EMC so that it can be used.

Thierry

Thierry Reding (3):
dt-bindings: memory: tegra: Document DBB clock for Tegra264
memory: tegra: Add support for DBB clock on Tegra264
arm64: tegra: Add DBB clock to EMC on Tegra264

 .../memory-controllers/nvidia,tegra186-mc.yaml        | 11 +++++++++++
 arch/arm64/boot/dts/nvidia/tegra264.dtsi              |  5 +++--
 drivers/memory/tegra/tegra186-emc.c                   |  8 ++++++++
 3 files changed, 22 insertions(+), 2 deletions(-)
Signature · 1 line
2.51.2
#1 lore raw

PATCH 1/3 dt-bindings: memory: tegra: Document DBB clock for Tegra264

From: Thierry Reding <[email protected]>

Accesses to external memory are routed through the data backbone (DBB) on Tegra264. A separate clock feeds this path and needs to be enabled whenever an IP block makes an access to external memory. The external memory controller driver is the best place to control this clock since it knows how many devices are actively accessing memory.

Document the presence of this clock on Tegra264 only.

---
 .../memory-controllers/nvidia,tegra186-mc.yaml        | 11 +++++++++++
 1 file changed, 11 insertions(+)
Documentation/devicetree/bindings/memory-controllers/nvidia,tegra186-mc.yaml +11 -0
index b901f1b3e0fc..f0448d9ea1ba 100644
@@ -92,10 +92,12 @@ patternProperties:
       clocks:
         items:
           - description: external memory clock
+          - description: data backbone clock
 
       clock-names:
         items:
           - const: emc
+          - const: dbb
 
       "#interconnect-cells":
         const: 0
@@ -115,6 +117,9 @@ patternProperties:
             reg:
               maxItems: 1
 
+            clocks:
+              maxItems: 1
+
       - if:
           properties:
             compatible:
@@ -124,6 +129,9 @@ patternProperties:
             reg:
               minItems: 2
 
+            clocks:
+              maxItems: 1
+
       - if:
           properties:
             compatible:
@@ -133,6 +141,9 @@ patternProperties:
             reg:
               minItems: 2
 
+            clocks:
+              maxItems: 1
+
       - if:
           properties:
             compatible:
Signature · 1 line
2.51.2
#2 lore raw

Re: [PATCH 1/3] dt-bindings: memory: tegra: Document DBB clock for Tegra264

Quoted 8 lines · Thierry Reding

From: Thierry Reding <[email protected]>

Accesses to external memory are routed through the data backbone (DBB) on Tegra264. A separate clock feeds this path and needs to be enabled whenever an IP block makes an access to external memory. The external memory controller driver is the best place to control this clock since it knows how many devices are actively accessing memory.

Quoted 7 lines

Document the presence of this clock on Tegra264 only.

---
 .../memory-controllers/nvidia,tegra186-mc.yaml        | 11 +++++++++++
 1 file changed, 11 insertions(+)

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/memory-controllers/nvidia,tegra186-mc.example.dtb: memory-controller@2c00000 (nvidia,tegra186-mc): external-memory-controller@2c60000:clock-names: ['emc'] is too short
from schema $id: http://devicetree.org/schemas/memory-controllers/nvidia,tegra186-mc.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/memory-controllers/nvidia,tegra186-mc.example.dtb: memory-controller@2c00000 (nvidia,tegra186-mc): external-memory-controller@2c60000:clocks: [[4294967295, 58]] is too short
from schema $id: http://devicetree.org/schemas/memory-controllers/nvidia,tegra186-mc.yaml

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]

The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.

#3 lore raw

Re: [PATCH 1/3] dt-bindings: memory: tegra: Document DBB clock for Tegra264

Quoted 20 lines · Rob Herring (Arm)
Quoted 8 lines · Thierry Reding

From: Thierry Reding <[email protected]>

Accesses to external memory are routed through the data backbone (DBB) on Tegra264. A separate clock feeds this path and needs to be enabled whenever an IP block makes an access to external memory. The external memory controller driver is the best place to control this clock since it knows how many devices are actively accessing memory.

Quoted 7 lines

Document the presence of this clock on Tegra264 only.

---
 .../memory-controllers/nvidia,tegra186-mc.yaml        | 11 +++++++++++
 1 file changed, 11 insertions(+)

My bot found errors running 'make dt_binding_check' on your patch:

Quoted 7 lines

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/memory-controllers/nvidia,tegra186-mc.example.dtb: memory-controller@2c00000 (nvidia,tegra186-mc): external-memory-controller@2c60000:clock-names: ['emc'] is too short
from schema $id: http://devicetree.org/schemas/memory-controllers/nvidia,tegra186-mc.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/memory-controllers/nvidia,tegra186-mc.example.dtb: memory-controller@2c00000 (nvidia,tegra186-mc): external-memory-controller@2c60000:clocks: [[4294967295, 58]] is too short
from schema $id: http://devicetree.org/schemas/memory-controllers/nvidia,tegra186-mc.yaml

Ugh... looks like I used the wrong hash in the format-patch command and didn't notice that I sent out an old version of the patch that's missing the minItems for clocks and clock-names.

I'll send out the correct version, sorry for the noise.

Thierry

#4 lore raw

PATCH 2/3 memory: tegra: Add support for DBB clock on Tegra264

In reply to Thierry Reding

From: Thierry Reding <[email protected]>

The DBB clock is needed by many IP blocks in order to access system memory via the data backbone. The memory controller and external memory controllers are the central place where these accesses are managed, so make sure that the clock can be controlled from the corresponding driver.

Note that not all drivers fully register bandwidth requests, and hence the EMC driver doesn't have enough information to know when it's safe to switch the clock off, so for now it will be kept on permanently.

---
 drivers/memory/tegra/tegra186-emc.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/memory/tegra/tegra186-emc.c +8 -0
index 74be09968baa..7a26d8830172 100644
@@ -33,6 +33,7 @@ struct tegra186_emc {
 	struct tegra_bpmp *bpmp;
 	struct device *dev;
 	struct clk *clk;
+	struct clk *clk_dbb;
 
 	struct tegra186_emc_dvfs *dvfs;
 	unsigned int num_dvfs;
@@ -452,6 +453,13 @@ static int tegra186_emc_probe(struct platform_device *pdev)
 		return dev_err_probe(&pdev->dev, PTR_ERR(emc->clk),
 				     "failed to get EMC clock\n");
 
+	emc->clk_dbb = devm_clk_get_optional_enabled(&pdev->dev, "dbb");
+	if (IS_ERR(emc->clk_dbb)) {
+		err = PTR_ERR(emc->clk_dbb);
+		dev_err(&pdev->dev, "failed to get DBB clock: %d\n", err);
+		goto put_bpmp;
+	}
+
 	platform_set_drvdata(pdev, emc);
 	emc->dev = &pdev->dev;
 
Signature · 1 line
2.51.2
#5 lore raw

PATCH 3/3 arm64: tegra: Add DBB clock to EMC on Tegra264

In reply to Thierry Reding

From: Thierry Reding <[email protected]>

The DBB clock is used by the EMC to enable the data path from various IP blocks to external memory.

---
 arch/arm64/boot/dts/nvidia/tegra264.dtsi | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/nvidia/tegra264.dtsi +3 -2
index c66ea12ef5a3..f1cf370f6363 100644
@@ -3444,8 +3444,9 @@ emc: external-memory-controller@8800000 {
 				reg = <0x00 0x8800000 0x0 0x20000>,
 				      <0x00 0x8890000 0x0 0x20000>;
 				interrupts = <GIC_SPI 141 IRQ_TYPE_LEVEL_HIGH>;
-				clocks = <&bpmp TEGRA264_CLK_EMC>;
-				clock-names = "emc";
+				clocks = <&bpmp TEGRA264_CLK_EMC>,
+					 <&bpmp TEGRA264_CLK_DBB_UPHY0>;
+				clock-names = "emc", "dbb";
 
 				#interconnect-cells = <0>;
 				nvidia,bpmp = <&bpmp>;
Signature · 1 line
2.51.2