Linux Tegra architecture development
 help / color / mirror / Atom feed
* [PATCH 0/3] arm64: tegra: Add DBB clock to EMC on Tegra264
@ 2025-11-05 16:05 Thierry Reding
  2025-11-05 16:05 ` [PATCH 1/3] dt-bindings: memory: tegra: Document DBB clock for Tegra264 Thierry Reding
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Thierry Reding @ 2025-11-05 16:05 UTC (permalink / raw)
  To: Thierry Reding, Krzysztof Kozlowski
  Cc: Rob Herring, Conor Dooley, Jon Hunter, linux-tegra, devicetree

From: Thierry Reding <treding@nvidia.com>

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(-)

-- 
2.51.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/3] dt-bindings: memory: tegra: Document DBB clock for Tegra264
  2025-11-05 16:05 [PATCH 0/3] arm64: tegra: Add DBB clock to EMC on Tegra264 Thierry Reding
@ 2025-11-05 16:05 ` Thierry Reding
  2025-11-05 17:31   ` Rob Herring (Arm)
  2025-11-05 16:05 ` [PATCH 2/3] memory: tegra: Add support for DBB clock on Tegra264 Thierry Reding
  2025-11-05 16:05 ` [PATCH 3/3] arm64: tegra: Add DBB clock to EMC " Thierry Reding
  2 siblings, 1 reply; 6+ messages in thread
From: Thierry Reding @ 2025-11-05 16:05 UTC (permalink / raw)
  To: Thierry Reding, Krzysztof Kozlowski
  Cc: Rob Herring, Conor Dooley, Jon Hunter, linux-tegra, devicetree

From: Thierry Reding <treding@nvidia.com>

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.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 .../memory-controllers/nvidia,tegra186-mc.yaml        | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/Documentation/devicetree/bindings/memory-controllers/nvidia,tegra186-mc.yaml b/Documentation/devicetree/bindings/memory-controllers/nvidia,tegra186-mc.yaml
index b901f1b3e0fc..f0448d9ea1ba 100644
--- a/Documentation/devicetree/bindings/memory-controllers/nvidia,tegra186-mc.yaml
+++ b/Documentation/devicetree/bindings/memory-controllers/nvidia,tegra186-mc.yaml
@@ -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:
-- 
2.51.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] memory: tegra: Add support for DBB clock on Tegra264
  2025-11-05 16:05 [PATCH 0/3] arm64: tegra: Add DBB clock to EMC on Tegra264 Thierry Reding
  2025-11-05 16:05 ` [PATCH 1/3] dt-bindings: memory: tegra: Document DBB clock for Tegra264 Thierry Reding
@ 2025-11-05 16:05 ` Thierry Reding
  2025-11-05 16:05 ` [PATCH 3/3] arm64: tegra: Add DBB clock to EMC " Thierry Reding
  2 siblings, 0 replies; 6+ messages in thread
From: Thierry Reding @ 2025-11-05 16:05 UTC (permalink / raw)
  To: Thierry Reding, Krzysztof Kozlowski
  Cc: Rob Herring, Conor Dooley, Jon Hunter, linux-tegra, devicetree

From: Thierry Reding <treding@nvidia.com>

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.

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/memory/tegra/tegra186-emc.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/memory/tegra/tegra186-emc.c b/drivers/memory/tegra/tegra186-emc.c
index 74be09968baa..7a26d8830172 100644
--- a/drivers/memory/tegra/tegra186-emc.c
+++ b/drivers/memory/tegra/tegra186-emc.c
@@ -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;
 
-- 
2.51.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] arm64: tegra: Add DBB clock to EMC on Tegra264
  2025-11-05 16:05 [PATCH 0/3] arm64: tegra: Add DBB clock to EMC on Tegra264 Thierry Reding
  2025-11-05 16:05 ` [PATCH 1/3] dt-bindings: memory: tegra: Document DBB clock for Tegra264 Thierry Reding
  2025-11-05 16:05 ` [PATCH 2/3] memory: tegra: Add support for DBB clock on Tegra264 Thierry Reding
@ 2025-11-05 16:05 ` Thierry Reding
  2 siblings, 0 replies; 6+ messages in thread
From: Thierry Reding @ 2025-11-05 16:05 UTC (permalink / raw)
  To: Thierry Reding, Krzysztof Kozlowski
  Cc: Rob Herring, Conor Dooley, Jon Hunter, linux-tegra, devicetree

From: Thierry Reding <treding@nvidia.com>

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

Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 arch/arm64/boot/dts/nvidia/tegra264.dtsi | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/boot/dts/nvidia/tegra264.dtsi b/arch/arm64/boot/dts/nvidia/tegra264.dtsi
index c66ea12ef5a3..f1cf370f6363 100644
--- a/arch/arm64/boot/dts/nvidia/tegra264.dtsi
+++ b/arch/arm64/boot/dts/nvidia/tegra264.dtsi
@@ -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>;
-- 
2.51.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/3] dt-bindings: memory: tegra: Document DBB clock for Tegra264
  2025-11-05 16:05 ` [PATCH 1/3] dt-bindings: memory: tegra: Document DBB clock for Tegra264 Thierry Reding
@ 2025-11-05 17:31   ` Rob Herring (Arm)
  2025-11-05 19:49     ` Thierry Reding
  0 siblings, 1 reply; 6+ messages in thread
From: Rob Herring (Arm) @ 2025-11-05 17:31 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Conor Dooley, Jon Hunter, devicetree, Krzysztof Kozlowski,
	linux-tegra


On Wed, 05 Nov 2025 17:05:11 +0100, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
> 
> 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.
> 
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---
>  .../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/20251105160513.2638408-2-thierry.reding@gmail.com

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.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/3] dt-bindings: memory: tegra: Document DBB clock for Tegra264
  2025-11-05 17:31   ` Rob Herring (Arm)
@ 2025-11-05 19:49     ` Thierry Reding
  0 siblings, 0 replies; 6+ messages in thread
From: Thierry Reding @ 2025-11-05 19:49 UTC (permalink / raw)
  To: Rob Herring (Arm)
  Cc: Conor Dooley, Jon Hunter, devicetree, Krzysztof Kozlowski,
	linux-tegra

[-- Attachment #1: Type: text/plain, Size: 1893 bytes --]

On Wed, Nov 05, 2025 at 11:31:31AM -0600, Rob Herring (Arm) wrote:
> 
> On Wed, 05 Nov 2025 17:05:11 +0100, Thierry Reding wrote:
> > From: Thierry Reding <treding@nvidia.com>
> > 
> > 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.
> > 
> > Signed-off-by: Thierry Reding <treding@nvidia.com>
> > ---
> >  .../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

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-11-05 19:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-05 16:05 [PATCH 0/3] arm64: tegra: Add DBB clock to EMC on Tegra264 Thierry Reding
2025-11-05 16:05 ` [PATCH 1/3] dt-bindings: memory: tegra: Document DBB clock for Tegra264 Thierry Reding
2025-11-05 17:31   ` Rob Herring (Arm)
2025-11-05 19:49     ` Thierry Reding
2025-11-05 16:05 ` [PATCH 2/3] memory: tegra: Add support for DBB clock on Tegra264 Thierry Reding
2025-11-05 16:05 ` [PATCH 3/3] arm64: tegra: Add DBB clock to EMC " Thierry Reding

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox