diff mbox series

[3/6] ARM: dts: Move BCM2711 RPi specific into separate dtsi

Message ID 1622366775-5309-4-git-send-email-stefan.wahren@i2se.com (mailing list archive)
State Superseded
Headers show
Series ARM: dts: Add Raspberry Pi 400 support | expand

Commit Message

Stefan Wahren May 30, 2021, 9:26 a.m. UTC
There is a lot of Raspberry Pi specific stuff (neither SoC or board
specific) for the BCM2711 which is currently in the RPi 4 B dts. In order
to avoid copy & paste for every new BCM2711 based Raspberry Pi, move it
into a separate dtsi.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
---
 arch/arm/boot/dts/bcm2711-rpi-4-b.dts | 62 +----------------------------
 arch/arm/boot/dts/bcm2711-rpi.dtsi    | 75 +++++++++++++++++++++++++++++++++++
 2 files changed, 76 insertions(+), 61 deletions(-)
 create mode 100644 arch/arm/boot/dts/bcm2711-rpi.dtsi

Comments

Nicolas Saenz Julienne June 1, 2021, 10:03 a.m. UTC | #1
Hi Stefan,
Thanks for having a go at this.

On Sun, 2021-05-30 at 11:26 +0200, Stefan Wahren wrote:
> There is a lot of Raspberry Pi specific stuff (neither SoC or board
> specific) for the BCM2711 which is currently in the RPi 4 B dts. In order
> to avoid copy & paste for every new BCM2711 based Raspberry Pi, move it
> into a separate dtsi.
> 
> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
> ---
>  arch/arm/boot/dts/bcm2711-rpi-4-b.dts | 62 +----------------------------
>  arch/arm/boot/dts/bcm2711-rpi.dtsi    | 75 +++++++++++++++++++++++++++++++++++
>  2 files changed, 76 insertions(+), 61 deletions(-)
>  create mode 100644 arch/arm/boot/dts/bcm2711-rpi.dtsi
> 
> diff --git a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
> index 3b4ab94..78142a0 100644
> --- a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
> +++ b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
> @@ -1,11 +1,9 @@
>  // SPDX-License-Identifier: GPL-2.0
>  /dts-v1/;
>  #include "bcm2711.dtsi"
> -#include "bcm2835-rpi.dtsi"
> +#include "bcm2711-rpi.dtsi"
>  #include "bcm283x-rpi-usb-peripheral.dtsi"
>  
> 
> -#include <dt-bindings/reset/raspberrypi,firmware-reset.h>
> -
>  / {
>  	compatible = "raspberrypi,4-model-b", "brcm,bcm2711";
>  	model = "Raspberry Pi 4 Model B";
> @@ -22,10 +20,7 @@
>  	};
>  
> 
>  	aliases {
> -		emmc2bus = &emmc2bus;
>  		ethernet0 = &genet;

Why not picking this one? nor the relevant DT nodes? I belive it's available on
all the bcm2711 based boards.

> -		pcie0 = &pcie0;
> -		blconfig = &blconfig;
>  	};
>  
> 
>  	leds {
> @@ -80,11 +75,6 @@
>  };
>  
> 
>  &firmware {
> -	firmware_clocks: clocks {
> -		compatible = "raspberrypi,firmware-clocks";
> -		#clock-cells = <1>;
> -	};
> -
>  	expgpio: gpio {

Why not taking this one too and letting each dts file define its own
'gpio-line-names'?

>  		compatible = "raspberrypi,firmware-gpio";
>  		gpio-controller;
> @@ -99,11 +89,6 @@
>  				  "";
>  		status = "okay";
>  	};
> -
> -	reset: reset {
> -		compatible = "raspberrypi,firmware-reset";
> -		#reset-cells = <1>;
> -	};
>  };
>  
> 
>  &gpio {
> @@ -180,23 +165,13 @@
>  };
>  
> 
>  &hdmi0 {
> -	clocks = <&firmware_clocks 13>, <&firmware_clocks 14>, <&dvp 0>, <&clk_27MHz>;
> -	clock-names = "hdmi", "bvb", "audio", "cec";
> -	wifi-2.4ghz-coexistence;
>  	status = "okay";
>  };
>  
> 
>  &hdmi1 {
> -	clocks = <&firmware_clocks 13>, <&firmware_clocks 14>, <&dvp 1>, <&clk_27MHz>;
> -	clock-names = "hdmi", "bvb", "audio", "cec";
> -	wifi-2.4ghz-coexistence;
>  	status = "okay";
>  };
>  
> 
> -&hvs {
> -	clocks = <&firmware_clocks 4>;
> -};
> -
>  &pixelvalve0 {
>  	status = "okay";
>  };
> @@ -219,22 +194,6 @@
>  	status = "okay";
>  };
>  
> 
> -&rmem {
> -	/*
> -	 * RPi4's co-processor will copy the board's bootloader configuration
> -	 * into memory for the OS to consume. It'll also update this node with
> -	 * its placement information.
> -	 */
> -	blconfig: nvram@0 {
> -		compatible = "raspberrypi,bootloader-config", "nvmem-rmem";
> -		#address-cells = <1>;
> -		#size-cells = <1>;
> -		reg = <0x0 0x0 0x0>;
> -		no-map;
> -		status = "disabled";
> -	};
> -};
> -
>  /* SDHCI is used to control the SDIO for wireless */
>  &sdhci {
>  	#address-cells = <1>;
> @@ -273,21 +232,6 @@
>  	};
>  };
>  
> 
> -&pcie0 {
> -	pci@1,0 {
> -		#address-cells = <3>;
> -		#size-cells = <2>;
> -		ranges;
> -
> -		reg = <0 0 0 0 0>;
> -
> -		usb@1,0 {
> -			reg = <0x10000 0 0 0 0>;
> -			resets = <&reset RASPBERRYPI_FIRMWARE_RESET_ID_USB>;
> -		};
> -	};
> -};
> -

This is not relevant to CM4, maybe we should leave it in the .dts

>  /* uart0 communicates with the BT module */
>  &uart0 {

What about 'uart1'? I belive the configuration is the same for all boards. pwm1
also comes to mind.

Regards,
Nicolas
Stefan Wahren June 1, 2021, 6:51 p.m. UTC | #2
Hi Nicolas,

Am 01.06.21 um 12:03 schrieb nicolas saenz julienne:
> Hi Stefan,
> Thanks for having a go at this.
>
> On Sun, 2021-05-30 at 11:26 +0200, Stefan Wahren wrote:
>> There is a lot of Raspberry Pi specific stuff (neither SoC or board
>> specific) for the BCM2711 which is currently in the RPi 4 B dts. In order
>> to avoid copy & paste for every new BCM2711 based Raspberry Pi, move it
>> into a separate dtsi.
>>
>> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
>> ---
>>  arch/arm/boot/dts/bcm2711-rpi-4-b.dts | 62 +----------------------------
>>  arch/arm/boot/dts/bcm2711-rpi.dtsi    | 75 +++++++++++++++++++++++++++++++++++
>>  2 files changed, 76 insertions(+), 61 deletions(-)
>>  create mode 100644 arch/arm/boot/dts/bcm2711-rpi.dtsi
>>
>> diff --git a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
>> index 3b4ab94..78142a0 100644
>> --- a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
>> +++ b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
>> @@ -1,11 +1,9 @@
>>  // SPDX-License-Identifier: GPL-2.0
>>  /dts-v1/;
>>  #include "bcm2711.dtsi"
>> -#include "bcm2835-rpi.dtsi"
>> +#include "bcm2711-rpi.dtsi"
>>  #include "bcm283x-rpi-usb-peripheral.dtsi"
>>  
>>
>> -#include <dt-bindings/reset/raspberrypi,firmware-reset.h>
>> -
>>  / {
>>  	compatible = "raspberrypi,4-model-b", "brcm,bcm2711";
>>  	model = "Raspberry Pi 4 Model B";
>> @@ -22,10 +20,7 @@
>>  	};
>>  
>>
>>  	aliases {
>> -		emmc2bus = &emmc2bus;
>>  		ethernet0 = &genet;
> Why not picking this one? nor the relevant DT nodes? I belive it's available on
> all the bcm2711 based boards.
While i agree that most of the boards [1] support Ethernet, the PHY
stuff is almost board specific.
>
>> -		pcie0 = &pcie0;
>> -		blconfig = &blconfig;
>>  	};
>>  
>>
>>  	leds {
>> @@ -80,11 +75,6 @@
>>  };
>>  
>>
>>  &firmware {
>> -	firmware_clocks: clocks {
>> -		compatible = "raspberrypi,firmware-clocks";
>> -		#clock-cells = <1>;
>> -	};
>> -
>>  	expgpio: gpio {
> Why not taking this one too and letting each dts file define its own
> 'gpio-line-names'?
Agree
>
>>  		compatible = "raspberrypi,firmware-gpio";
>>  		gpio-controller;
>> @@ -99,11 +89,6 @@
>>  				  "";
>>  		status = "okay";
>>  	};
>> -
>> -	reset: reset {
>> -		compatible = "raspberrypi,firmware-reset";
>> -		#reset-cells = <1>;
>> -	};
>>  };
>>  
>>
>>  &gpio {
>> @@ -180,23 +165,13 @@
>>  };
>>  
>>
>>  &hdmi0 {
>> -	clocks = <&firmware_clocks 13>, <&firmware_clocks 14>, <&dvp 0>, <&clk_27MHz>;
>> -	clock-names = "hdmi", "bvb", "audio", "cec";
>> -	wifi-2.4ghz-coexistence;
>>  	status = "okay";
>>  };
>>  
>>
>>  &hdmi1 {
>> -	clocks = <&firmware_clocks 13>, <&firmware_clocks 14>, <&dvp 1>, <&clk_27MHz>;
>> -	clock-names = "hdmi", "bvb", "audio", "cec";
>> -	wifi-2.4ghz-coexistence;
>>  	status = "okay";
>>  };
>>  
>>
>> -&hvs {
>> -	clocks = <&firmware_clocks 4>;
>> -};
>> -
>>  &pixelvalve0 {
>>  	status = "okay";
>>  };
>> @@ -219,22 +194,6 @@
>>  	status = "okay";
>>  };
>>  
>>
>> -&rmem {
>> -	/*
>> -	 * RPi4's co-processor will copy the board's bootloader configuration
>> -	 * into memory for the OS to consume. It'll also update this node with
>> -	 * its placement information.
>> -	 */
>> -	blconfig: nvram@0 {
>> -		compatible = "raspberrypi,bootloader-config", "nvmem-rmem";
>> -		#address-cells = <1>;
>> -		#size-cells = <1>;
>> -		reg = <0x0 0x0 0x0>;
>> -		no-map;
>> -		status = "disabled";
>> -	};
>> -};
>> -
>>  /* SDHCI is used to control the SDIO for wireless */
>>  &sdhci {
>>  	#address-cells = <1>;
>> @@ -273,21 +232,6 @@
>>  	};
>>  };
>>  
>>
>> -&pcie0 {
>> -	pci@1,0 {
>> -		#address-cells = <3>;
>> -		#size-cells = <2>;
>> -		ranges;
>> -
>> -		reg = <0 0 0 0 0>;
>> -
>> -		usb@1,0 {
>> -			reg = <0x10000 0 0 0 0>;
>> -			resets = <&reset RASPBERRYPI_FIRMWARE_RESET_ID_USB>;
>> -		};
>> -	};
>> -};
>> -
> This is not relevant to CM4, maybe we should leave it in the .dts
Okay
>
>>  /* uart0 communicates with the BT module */
>>  &uart0 {
> What about 'uart1'? I belive the configuration is the same for all boards. pwm1
> also comes to mind.

I wouldn't include pinmux dependent stuff here, because this is very
specific to the board and use case [1].

But there is a trick for the Pi 400, which is very similiar to the Pi 4
B. We could include the pi4.dts in the pi400.dts. Additional i would
keep this patch for CM4 and co.

Regards
Stefan

[1] -
https://afterhourscoding.wordpress.com/2021/02/21/a-list-of-raspberry-pi-compute-module-carrier-boards-and-devices/

>
> Regards,
> Nicolas
>
>
diff mbox series

Patch

diff --git a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
index 3b4ab94..78142a0 100644
--- a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
+++ b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
@@ -1,11 +1,9 @@ 
 // SPDX-License-Identifier: GPL-2.0
 /dts-v1/;
 #include "bcm2711.dtsi"
-#include "bcm2835-rpi.dtsi"
+#include "bcm2711-rpi.dtsi"
 #include "bcm283x-rpi-usb-peripheral.dtsi"
 
-#include <dt-bindings/reset/raspberrypi,firmware-reset.h>
-
 / {
 	compatible = "raspberrypi,4-model-b", "brcm,bcm2711";
 	model = "Raspberry Pi 4 Model B";
@@ -22,10 +20,7 @@ 
 	};
 
 	aliases {
-		emmc2bus = &emmc2bus;
 		ethernet0 = &genet;
-		pcie0 = &pcie0;
-		blconfig = &blconfig;
 	};
 
 	leds {
@@ -80,11 +75,6 @@ 
 };
 
 &firmware {
-	firmware_clocks: clocks {
-		compatible = "raspberrypi,firmware-clocks";
-		#clock-cells = <1>;
-	};
-
 	expgpio: gpio {
 		compatible = "raspberrypi,firmware-gpio";
 		gpio-controller;
@@ -99,11 +89,6 @@ 
 				  "";
 		status = "okay";
 	};
-
-	reset: reset {
-		compatible = "raspberrypi,firmware-reset";
-		#reset-cells = <1>;
-	};
 };
 
 &gpio {
@@ -180,23 +165,13 @@ 
 };
 
 &hdmi0 {
-	clocks = <&firmware_clocks 13>, <&firmware_clocks 14>, <&dvp 0>, <&clk_27MHz>;
-	clock-names = "hdmi", "bvb", "audio", "cec";
-	wifi-2.4ghz-coexistence;
 	status = "okay";
 };
 
 &hdmi1 {
-	clocks = <&firmware_clocks 13>, <&firmware_clocks 14>, <&dvp 1>, <&clk_27MHz>;
-	clock-names = "hdmi", "bvb", "audio", "cec";
-	wifi-2.4ghz-coexistence;
 	status = "okay";
 };
 
-&hvs {
-	clocks = <&firmware_clocks 4>;
-};
-
 &pixelvalve0 {
 	status = "okay";
 };
@@ -219,22 +194,6 @@ 
 	status = "okay";
 };
 
-&rmem {
-	/*
-	 * RPi4's co-processor will copy the board's bootloader configuration
-	 * into memory for the OS to consume. It'll also update this node with
-	 * its placement information.
-	 */
-	blconfig: nvram@0 {
-		compatible = "raspberrypi,bootloader-config", "nvmem-rmem";
-		#address-cells = <1>;
-		#size-cells = <1>;
-		reg = <0x0 0x0 0x0>;
-		no-map;
-		status = "disabled";
-	};
-};
-
 /* SDHCI is used to control the SDIO for wireless */
 &sdhci {
 	#address-cells = <1>;
@@ -273,21 +232,6 @@ 
 	};
 };
 
-&pcie0 {
-	pci@1,0 {
-		#address-cells = <3>;
-		#size-cells = <2>;
-		ranges;
-
-		reg = <0 0 0 0 0>;
-
-		usb@1,0 {
-			reg = <0x10000 0 0 0 0>;
-			resets = <&reset RASPBERRYPI_FIRMWARE_RESET_ID_USB>;
-		};
-	};
-};
-
 /* uart0 communicates with the BT module */
 &uart0 {
 	pinctrl-names = "default";
@@ -309,10 +253,6 @@ 
 	status = "okay";
 };
 
-&vchiq {
-	interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
-};
-
 &vc4 {
 	status = "okay";
 };
diff --git a/arch/arm/boot/dts/bcm2711-rpi.dtsi b/arch/arm/boot/dts/bcm2711-rpi.dtsi
new file mode 100644
index 0000000..b4bc7f6
--- /dev/null
+++ b/arch/arm/boot/dts/bcm2711-rpi.dtsi
@@ -0,0 +1,75 @@ 
+// SPDX-License-Identifier: GPL-2.0
+#include "bcm2835-rpi.dtsi"
+
+#include <dt-bindings/reset/raspberrypi,firmware-reset.h>
+
+/ {
+	aliases {
+		emmc2bus = &emmc2bus;
+		pcie0 = &pcie0;
+		blconfig = &blconfig;
+	};
+};
+
+&firmware {
+	firmware_clocks: clocks {
+		compatible = "raspberrypi,firmware-clocks";
+		#clock-cells = <1>;
+	};
+
+	reset: reset {
+		compatible = "raspberrypi,firmware-reset";
+		#reset-cells = <1>;
+	};
+};
+
+&hdmi0 {
+	clocks = <&firmware_clocks 13>, <&firmware_clocks 14>, <&dvp 0>, <&clk_27MHz>;
+	clock-names = "hdmi", "bvb", "audio", "cec";
+	wifi-2.4ghz-coexistence;
+};
+
+&hdmi1 {
+	clocks = <&firmware_clocks 13>, <&firmware_clocks 14>, <&dvp 1>, <&clk_27MHz>;
+	clock-names = "hdmi", "bvb", "audio", "cec";
+	wifi-2.4ghz-coexistence;
+};
+
+&hvs {
+	clocks = <&firmware_clocks 4>;
+};
+
+&pcie0 {
+	pci@1,0 {
+		#address-cells = <3>;
+		#size-cells = <2>;
+		ranges;
+
+		reg = <0 0 0 0 0>;
+
+		usb@1,0 {
+			reg = <0x10000 0 0 0 0>;
+			resets = <&reset RASPBERRYPI_FIRMWARE_RESET_ID_USB>;
+		};
+	};
+};
+
+&rmem {
+	/*
+	 * RPi4's co-processor will copy the board's bootloader configuration
+	 * into memory for the OS to consume. It'll also update this node with
+	 * its placement information.
+	 */
+	blconfig: nvram@0 {
+		compatible = "raspberrypi,bootloader-config", "nvmem-rmem";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		reg = <0x0 0x0 0x0>;
+		no-map;
+		status = "disabled";
+	};
+};
+
+&vchiq {
+	interrupts = <GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>;
+};