devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] DTS: bcm2711: Move emmc2 into its own bus
@ 2020-03-03 12:08 Nicolas Saenz Julienne
  2020-03-03 18:21 ` Florian Fainelli
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Saenz Julienne @ 2020-03-03 12:08 UTC (permalink / raw)
  To: Rob Herring, Nicolas Saenz Julienne
  Cc: phil, florian.fainelli, devicetree, bcm-kernel-feedback-list,
	linux-rpi-kernel, linux-arm-kernel, linux-kernel

Depending on bcm2711's revision its emmc2 controller might have
different DMA constraints. Raspberry Pi 4's firmware will take care of
updating those, but only if a certain alias is found in the device tree.
So, move emmc2 into its own bus, so as not to pollute other devices with
dma-ranges changes and create the emmc2bus alias.

Based in Phil ELwell's downstream implementation.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
---
 arch/arm/boot/dts/bcm2711-rpi-4-b.dts |  1 +
 arch/arm/boot/dts/bcm2711.dtsi        | 19 ++++++++++++++-----
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
index 1d4b589fe233..e26ea9006378 100644
--- a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
+++ b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
@@ -20,6 +20,7 @@ memory@0 {
 	};
 
 	aliases {
+		emmc2bus = &emmc2bus;
 		ethernet0 = &genet;
 		pcie0 = &pcie0;
 	};
diff --git a/arch/arm/boot/dts/bcm2711.dtsi b/arch/arm/boot/dts/bcm2711.dtsi
index d1e684d0acfd..61ea8b44c51e 100644
--- a/arch/arm/boot/dts/bcm2711.dtsi
+++ b/arch/arm/boot/dts/bcm2711.dtsi
@@ -241,17 +241,26 @@ pwm1: pwm@7e20c800 {
 			status = "disabled";
 		};
 
+		hvs@7e400000 {
+			interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>;
+		};
+	};
+
+	emmc2bus: emmc2bus {
+		compatible = "simple-bus";
+		#address-cells = <2>;
+		#size-cells = <1>;
+
+		ranges = <0x0 0x7e000000  0x0 0xfe000000  0x01800000>;
+		dma-ranges = <0x0 0xc0000000  0x0 0x00000000  0x40000000>;
+
 		emmc2: emmc2@7e340000 {
 			compatible = "brcm,bcm2711-emmc2";
-			reg = <0x7e340000 0x100>;
+			reg = <0x0 0x7e340000 0x100>;
 			interrupts = <GIC_SPI 126 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&clocks BCM2711_CLOCK_EMMC2>;
 			status = "disabled";
 		};
-
-		hvs@7e400000 {
-			interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>;
-		};
 	};
 
 	arm-pmu {
-- 
2.25.1


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

* Re: [PATCH] DTS: bcm2711: Move emmc2 into its own bus
  2020-03-03 12:08 [PATCH] DTS: bcm2711: Move emmc2 into its own bus Nicolas Saenz Julienne
@ 2020-03-03 18:21 ` Florian Fainelli
  2020-03-03 18:32   ` Nicolas Saenz Julienne
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Fainelli @ 2020-03-03 18:21 UTC (permalink / raw)
  To: Nicolas Saenz Julienne, Rob Herring
  Cc: devicetree, florian.fainelli, phil, linux-kernel,
	bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel

On 3/3/20 4:08 AM, Nicolas Saenz Julienne wrote:
> Depending on bcm2711's revision its emmc2 controller might have
> different DMA constraints. Raspberry Pi 4's firmware will take care of
> updating those, but only if a certain alias is found in the device tree.
> So, move emmc2 into its own bus, so as not to pollute other devices with
> dma-ranges changes and create the emmc2bus alias.
> 
> Based in Phil ELwell's downstream implementation.
> 
> Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>

Nit: the subject should be ARM: dts: bcm2711. Some more comments below.

> ---
>  arch/arm/boot/dts/bcm2711-rpi-4-b.dts |  1 +
>  arch/arm/boot/dts/bcm2711.dtsi        | 19 ++++++++++++++-----
>  2 files changed, 15 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
> index 1d4b589fe233..e26ea9006378 100644
> --- a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
> +++ b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
> @@ -20,6 +20,7 @@ memory@0 {
>  	};
>  
>  	aliases {
> +		emmc2bus = &emmc2bus;
>  		ethernet0 = &genet;
>  		pcie0 = &pcie0;
>  	};
> diff --git a/arch/arm/boot/dts/bcm2711.dtsi b/arch/arm/boot/dts/bcm2711.dtsi
> index d1e684d0acfd..61ea8b44c51e 100644
> --- a/arch/arm/boot/dts/bcm2711.dtsi
> +++ b/arch/arm/boot/dts/bcm2711.dtsi
> @@ -241,17 +241,26 @@ pwm1: pwm@7e20c800 {
>  			status = "disabled";
>  		};
>  
> +		hvs@7e400000 {
> +			interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>;
> +		};
> +	};
> +
> +	emmc2bus: emmc2bus {
> +		compatible = "simple-bus";
> +		#address-cells = <2>;
> +		#size-cells = <1>;
> +
> +		ranges = <0x0 0x7e000000  0x0 0xfe000000  0x01800000>;
> +		dma-ranges = <0x0 0xc0000000  0x0 0x00000000  0x40000000>;

This deserves a comment for two reasons:

- explaining which of these properties is getting patched by the
firmware (and it would be really nice if we had a concept of annotation
attributes for Device Tree such that you could express something like:

	dma-ranges = <> __patchable;

- explaining why this is not collapsed in the soc bus node, because the
dma-ranges constraint can be different based on the Pi4 revision

With that fixed, this looks good to me!

> +
>  		emmc2: emmc2@7e340000 {
>  			compatible = "brcm,bcm2711-emmc2";
> -			reg = <0x7e340000 0x100>;
> +			reg = <0x0 0x7e340000 0x100>;
>  			interrupts = <GIC_SPI 126 IRQ_TYPE_LEVEL_HIGH>;
>  			clocks = <&clocks BCM2711_CLOCK_EMMC2>;
>  			status = "disabled";
>  		};
> -
> -		hvs@7e400000 {
> -			interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>;
> -		};
>  	};
>  
>  	arm-pmu {
> 


-- 
Florian

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

* Re: [PATCH] DTS: bcm2711: Move emmc2 into its own bus
  2020-03-03 18:21 ` Florian Fainelli
@ 2020-03-03 18:32   ` Nicolas Saenz Julienne
  0 siblings, 0 replies; 3+ messages in thread
From: Nicolas Saenz Julienne @ 2020-03-03 18:32 UTC (permalink / raw)
  To: Florian Fainelli, Rob Herring
  Cc: devicetree, florian.fainelli, phil, linux-kernel,
	bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel

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

Hi Florian,

On Tue, 2020-03-03 at 10:21 -0800, Florian Fainelli wrote:
> On 3/3/20 4:08 AM, Nicolas Saenz Julienne wrote:
> > Depending on bcm2711's revision its emmc2 controller might have
> > different DMA constraints. Raspberry Pi 4's firmware will take care of
> > updating those, but only if a certain alias is found in the device tree.
> > So, move emmc2 into its own bus, so as not to pollute other devices with
> > dma-ranges changes and create the emmc2bus alias.
> > 
> > Based in Phil ELwell's downstream implementation.
> > 
> > Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
> 
> Nit: the subject should be ARM: dts: bcm2711. Some more comments below.

Of course, should have known better.

> > ---
> >  arch/arm/boot/dts/bcm2711-rpi-4-b.dts |  1 +
> >  arch/arm/boot/dts/bcm2711.dtsi        | 19 ++++++++++++++-----
> >  2 files changed, 15 insertions(+), 5 deletions(-)
> > 
> > diff --git a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
> > b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
> > index 1d4b589fe233..e26ea9006378 100644
> > --- a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
> > +++ b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
> > @@ -20,6 +20,7 @@ memory@0 {
> >  	};
> >  
> >  	aliases {
> > +		emmc2bus = &emmc2bus;
> >  		ethernet0 = &genet;
> >  		pcie0 = &pcie0;
> >  	};
> > diff --git a/arch/arm/boot/dts/bcm2711.dtsi b/arch/arm/boot/dts/bcm2711.dtsi
> > index d1e684d0acfd..61ea8b44c51e 100644
> > --- a/arch/arm/boot/dts/bcm2711.dtsi
> > +++ b/arch/arm/boot/dts/bcm2711.dtsi
> > @@ -241,17 +241,26 @@ pwm1: pwm@7e20c800 {
> >  			status = "disabled";
> >  		};
> >  
> > +		hvs@7e400000 {
> > +			interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>;
> > +		};
> > +	};
> > +
> > +	emmc2bus: emmc2bus {
> > +		compatible = "simple-bus";
> > +		#address-cells = <2>;
> > +		#size-cells = <1>;
> > +
> > +		ranges = <0x0 0x7e000000  0x0 0xfe000000  0x01800000>;
> > +		dma-ranges = <0x0 0xc0000000  0x0 0x00000000  0x40000000>;
> 
> This deserves a comment for two reasons:
> 
> - explaining which of these properties is getting patched by the
> firmware (and it would be really nice if we had a concept of annotation
> attributes for Device Tree such that you could express something like:
> 
> 	dma-ranges = <> __patchable;

Something like this would've been useful to me some time ago while debugging
CMA issues on a random arm64 Board. I was left wondering if the memory nodes on
that specific board were set in stone or just a placeholder.

> - explaining why this is not collapsed in the soc bus node, because the
> dma-ranges constraint can be different based on the Pi4 revision

Noted

> With that fixed, this looks good to me!

Thanks!

> 
> > +
> >  		emmc2: emmc2@7e340000 {
> >  			compatible = "brcm,bcm2711-emmc2";
> > -			reg = <0x7e340000 0x100>;
> > +			reg = <0x0 0x7e340000 0x100>;
> >  			interrupts = <GIC_SPI 126 IRQ_TYPE_LEVEL_HIGH>;
> >  			clocks = <&clocks BCM2711_CLOCK_EMMC2>;
> >  			status = "disabled";
> >  		};
> > -
> > -		hvs@7e400000 {
> > -			interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>;
> > -		};
> >  	};
> >  
> >  	arm-pmu {
> > 
> 
> 


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2020-03-03 18:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-03 12:08 [PATCH] DTS: bcm2711: Move emmc2 into its own bus Nicolas Saenz Julienne
2020-03-03 18:21 ` Florian Fainelli
2020-03-03 18:32   ` Nicolas Saenz Julienne

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).