diff mbox

ARM: dts: add minimal device tree for compute model 3

Message ID 20171124121813.11318-1-kernel@martin.sperl.org (mailing list archive)
State New, archived
Headers show

Commit Message

Martin Sperl Nov. 24, 2017, 12:18 p.m. UTC
From: Martin Sperl <kernel@martin.sperl.org>

Add a minimal working device tree for the compute model 3
for both arm and arm64.

Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
---
 arch/arm/boot/dts/Makefile                       |  1 +
 arch/arm/boot/dts/bcm2837-rpi-cm3.dts            | 38 ++++++++++++++++++++++++
 arch/arm64/boot/dts/broadcom/Makefile            |  1 +
 arch/arm64/boot/dts/broadcom/bcm2837-rpi-cm3.dts |  2 ++
 4 files changed, 42 insertions(+)
 create mode 100644 arch/arm/boot/dts/bcm2837-rpi-cm3.dts
 create mode 100644 arch/arm64/boot/dts/broadcom/bcm2837-rpi-cm3.dts

Comments

Stefan Wahren Nov. 24, 2017, 8:57 p.m. UTC | #1
Hi Martin,

thanks for working on this.

> kernel@martin.sperl.org hat am 24. November 2017 um 13:18 geschrieben:
> 
> 
> From: Martin Sperl <kernel@martin.sperl.org>
> 
> Add a minimal working device tree for the compute model 3
> for both arm and arm64.

i think it's worth to provide more context:

The Raspberry Compute Module 3 is a SoM which contains a BCM2837 processor, 1 GB RAM and a 4 GB eMMC. There is also a carrier board which is called Compute Module IO Board V3.

Datasheet:
https://www.raspberrypi.org/documentation/hardware/computemodule/RPI-CM-DATASHEET-V1_0.pdf

> 
> Signed-off-by: Martin Sperl <kernel@martin.sperl.org>
> ---
>  arch/arm/boot/dts/Makefile                       |  1 +
>  arch/arm/boot/dts/bcm2837-rpi-cm3.dts            | 38 ++++++++++++++++++++++++
>  arch/arm64/boot/dts/broadcom/Makefile            |  1 +
>  arch/arm64/boot/dts/broadcom/bcm2837-rpi-cm3.dts |  2 ++
>  4 files changed, 42 insertions(+)
>  create mode 100644 arch/arm/boot/dts/bcm2837-rpi-cm3.dts
>  create mode 100644 arch/arm64/boot/dts/broadcom/bcm2837-rpi-cm3.dts
> 
> diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
> index eff87a344566..b24a682c450d 100644
> --- a/arch/arm/boot/dts/Makefile
> +++ b/arch/arm/boot/dts/Makefile
> @@ -75,6 +75,7 @@ dtb-$(CONFIG_ARCH_BCM2835) += \
>  	bcm2835-rpi-a-plus.dtb \
>  	bcm2836-rpi-2-b.dtb \
>  	bcm2837-rpi-3-b.dtb \
> +	bcm2837-rpi-cm3.dtb \

Since we need always 2 boards (SoM + carrier), i like to see two separate DT files. A DTSI file for the SoM (describe RAM, eMMC) and a DTS file for the carrier board (please look at arm/boot/dts/imx6ul-tx6ul.dtsi and arm/boot/dts/imx6ul-tx6ul-mainboard.dts as an example).

Suggested include hierarchy:

  bcm2837.dtsi
    bcm2837-rpi-cm3.dtsi
      bcm2837-rpi-cm3-io3.dts

>  	bcm2835-rpi-zero.dtb \
>  	bcm2835-rpi-zero-w.dtb
>  dtb-$(CONFIG_ARCH_BCM_5301X) += \
> diff --git a/arch/arm/boot/dts/bcm2837-rpi-cm3.dts b/arch/arm/boot/dts/bcm2837-rpi-cm3.dts
> new file mode 100644
> index 000000000000..f387bd8bd707
> --- /dev/null
> +++ b/arch/arm/boot/dts/bcm2837-rpi-cm3.dts
> @@ -0,0 +1,38 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/dts-v1/;
> +#include "bcm2837.dtsi"
> +#include "bcm2835-rpi.dtsi"
> +#include "bcm283x-rpi-usb-host.dtsi"
> +
> +/ {
> +	compatible = "raspberrypi,3-compute-model", "brcm,bcm2837";

s/compute-model/compute-module/

> +	model = "Raspberry Pi Compute Module 3";

Raspberry Pi Compute Module 3 on a IO board V3

> +
> +	memory {
> +		reg = <0 0x40000000>;
> +	};
> +
> +	leds {
> +		act {
> +			gpios = <&gpio 47 0>;

Please use GPIO_ACTIVE_HIGH here

> +		};
> +	};
> +};
> +
> +&hdmi {
> +	hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>;
> +};
> +
> +&uart0 {
> +	pinctrl-names = "default";
> +	pinctrl-0 = <&uart0_gpio14>;
> +	status = "okay";
> +};
> +
> +/* SDHOST is used to drive the SD card */

Since this is an eMMC please drop this misleading comment.

> +&sdhost {
> +	pinctrl-names = "default";
> +	pinctrl-0 = <&sdhost_gpio48>;
> +	status = "okay";
> +	bus-width = <4>;

non-removable;

> +};
> diff --git a/arch/arm64/boot/dts/broadcom/Makefile b/arch/arm64/boot/dts/broadcom/Makefile
> index 3df2db7f8878..aecf58f503ae 100644
> --- a/arch/arm64/boot/dts/broadcom/Makefile
> +++ b/arch/arm64/boot/dts/broadcom/Makefile
> @@ -1,5 +1,6 @@
>  # SPDX-License-Identifier: GPL-2.0
>  dtb-$(CONFIG_ARCH_BCM2835) += bcm2837-rpi-3-b.dtb
> +dtb-$(CONFIG_ARCH_BCM2835) += bcm2837-rpi-cm3.dtb
>  
>  dts-dirs	+= northstar2
>  dts-dirs	+= stingray
> diff --git a/arch/arm64/boot/dts/broadcom/bcm2837-rpi-cm3.dts b/arch/arm64/boot/dts/broadcom/bcm2837-rpi-cm3.dts
> new file mode 100644
> index 000000000000..a1bba71462ed
> --- /dev/null
> +++ b/arch/arm64/boot/dts/broadcom/bcm2837-rpi-cm3.dts
> @@ -0,0 +1,2 @@
> +// SPDX-License-Identifier: GPL-2.0
> +#include "arm/bcm2837-rpi-cm3.dts"
> -- 
> 2.11.0
> 
> 
> _______________________________________________
> linux-rpi-kernel mailing list
> linux-rpi-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-rpi-kernel
Stefan Wahren Nov. 25, 2017, 9:50 a.m. UTC | #2
Hi Martin,

> kernel@martin.sperl.org hat am 25. November 2017 um 08:32 geschrieben:
> 
> 
> 
> > On 24.11.2017, at 21:57, Stefan Wahren <stefan.wahren@i2se.com> wrote:
> > Since we need always 2 boards (SoM + carrier), i like to see two separate DT files. A DTSI file for the SoM (describe RAM, eMMC) and a DTS file for the carrier board (please look at arm/boot/dts/imx6ul-tx6ul.dtsi and arm/boot/dts/imx6ul-tx6ul-mainboard.dts as an example).
> > 
> > Suggested include hierarchy:
> > 
> >  bcm2837.dtsi
> >    bcm2837-rpi-cm3.dtsi
> >      bcm2837-rpi-cm3-io3.dts
> > 
> 
> I shall give it a try.
> 
> But it would require possibly 2 versions of the cm-module:
> * the one including emmc
> * the one exposing the sd-card ports/pins (CM3-Lite)

I don't have those modules. In case it's possible to create a DTSI which applies for both of them then i prefer this. In theory there are two extremes:

1) Create a DTS for all Compute Modules (like the Raspberry Pi foundation)
2) Create DTS/DTSI files for all possible combinations

I think none of them are practical. In case 1 3rd party vendors would start to copy the DTS file and case 2 is hard to maintain. So we need to try something in the middle by starting with a DTSI file which applies to all CM3 (including the Lite) and a DTS which applies to all Raspberry Pi IO Boards and include the CM3 DTSI.

> 
> But then I could go as far as including the “classic” CM V1 as well...

Yeah, that's the idea.

> 
> >> 	bcm2835-rpi-zero.dtb \
> >> 	bcm2835-rpi-zero-w.dtb
> >> dtb-$(CONFIG_ARCH_BCM_5301X) += \
> >> diff --git a/arch/arm/boot/dts/bcm2837-rpi-cm3.dts b/arch/arm/boot/dts/bcm2837-rpi-cm3.dts
> >> new file mode 100644
> >> index 000000000000..f387bd8bd707
> >> --- /dev/null
> >> +++ b/arch/arm/boot/dts/bcm2837-rpi-cm3.dts
> >> @@ -0,0 +1,38 @@
> >> +// SPDX-License-Identifier: GPL-2.0
> >> +/dts-v1/;
> >> +#include "bcm2837.dtsi"
> >> +#include "bcm2835-rpi.dtsi"
> >> +#include "bcm283x-rpi-usb-host.dtsi"
> >> +
> >> +/ {
> >> +	compatible = "raspberrypi,3-compute-model", "brcm,bcm2837";
> > 
> > s/compute-model/compute-module/

Btw i forgot to mention this needs to be documented here [1] in a separate patch.

> > 
> >> +	model = "Raspberry Pi Compute Module 3";
> > 
> > Raspberry Pi Compute Module 3 on a IO board V3
> > 
> 
> That is not necessarily true - I am running the CM3 on a IO-board v1 so that one is compatible…

AFAIK this combination is not recommend, because the old IO board doesn't provide enough power for all use cases. But that's not the point about my comment. We need to describe the combination.

How about "Raspberry Pi Compute Module 3 on a IO board" and "bcm2837-rpi-cm3-io.dts" ?

> 
> >> 
> >> +/* SDHOST is used to drive the SD card */
> > 
> > Since this is an eMMC please drop this misleading comment.
> > 
> 
> for a CM3-Lite it is exposing sd card pins
> 
> >> +&sdhost {
> >> +	pinctrl-names = "default";
> >> +	pinctrl-0 = <&sdhost_gpio48>;
> >> +	status = "okay";
> >> +	bus-width = <4>;
> > 
> > non-removable;
> 
> See comment about Lite...

Okay, i'm fine without it but then we need a comment that the upcoming DTSI should apply to CM3 and CM3-Lite. Also the commit log should mention the CM3-Lite so everybody understand it.

Please wait a little bit before sending your second version to give the others some time for comments.

Thanks
Stefan

[1] - https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/arm/bcm/brcm,bcm2835.txt

> 
> Martin
>
Stefan Wahren Dec. 19, 2017, 5:16 p.m. UTC | #3
Hi Martin,

> kernel@martin.sperl.org hat am 24. November 2017 um 13:18 geschrieben:
> 
> 
> From: Martin Sperl <kernel@martin.sperl.org>
> 
> Add a minimal working device tree for the compute model 3
> for both arm and arm64.
> 

just a note before you send a V2. Recently i looked at the CM datasheet (revision 1.0) and noticed on the block diagram (page 8) that the CM3 eMMC I/O voltage is fixed at 1.8 Volt (doesn't apply to CM3 lite). Providing a fixed regulator for vmmc/vqmmc-supply [1] would give the MMC core the chance to figure out the right voltage.

[1] - http://elixir.free-electrons.com/linux/latest/source/Documentation/devicetree/bindings/mmc/mmc.txt
diff mbox

Patch

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index eff87a344566..b24a682c450d 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -75,6 +75,7 @@  dtb-$(CONFIG_ARCH_BCM2835) += \
 	bcm2835-rpi-a-plus.dtb \
 	bcm2836-rpi-2-b.dtb \
 	bcm2837-rpi-3-b.dtb \
+	bcm2837-rpi-cm3.dtb \
 	bcm2835-rpi-zero.dtb \
 	bcm2835-rpi-zero-w.dtb
 dtb-$(CONFIG_ARCH_BCM_5301X) += \
diff --git a/arch/arm/boot/dts/bcm2837-rpi-cm3.dts b/arch/arm/boot/dts/bcm2837-rpi-cm3.dts
new file mode 100644
index 000000000000..f387bd8bd707
--- /dev/null
+++ b/arch/arm/boot/dts/bcm2837-rpi-cm3.dts
@@ -0,0 +1,38 @@ 
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+#include "bcm2837.dtsi"
+#include "bcm2835-rpi.dtsi"
+#include "bcm283x-rpi-usb-host.dtsi"
+
+/ {
+	compatible = "raspberrypi,3-compute-model", "brcm,bcm2837";
+	model = "Raspberry Pi Compute Module 3";
+
+	memory {
+		reg = <0 0x40000000>;
+	};
+
+	leds {
+		act {
+			gpios = <&gpio 47 0>;
+		};
+	};
+};
+
+&hdmi {
+	hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>;
+};
+
+&uart0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart0_gpio14>;
+	status = "okay";
+};
+
+/* SDHOST is used to drive the SD card */
+&sdhost {
+	pinctrl-names = "default";
+	pinctrl-0 = <&sdhost_gpio48>;
+	status = "okay";
+	bus-width = <4>;
+};
diff --git a/arch/arm64/boot/dts/broadcom/Makefile b/arch/arm64/boot/dts/broadcom/Makefile
index 3df2db7f8878..aecf58f503ae 100644
--- a/arch/arm64/boot/dts/broadcom/Makefile
+++ b/arch/arm64/boot/dts/broadcom/Makefile
@@ -1,5 +1,6 @@ 
 # SPDX-License-Identifier: GPL-2.0
 dtb-$(CONFIG_ARCH_BCM2835) += bcm2837-rpi-3-b.dtb
+dtb-$(CONFIG_ARCH_BCM2835) += bcm2837-rpi-cm3.dtb
 
 dts-dirs	+= northstar2
 dts-dirs	+= stingray
diff --git a/arch/arm64/boot/dts/broadcom/bcm2837-rpi-cm3.dts b/arch/arm64/boot/dts/broadcom/bcm2837-rpi-cm3.dts
new file mode 100644
index 000000000000..a1bba71462ed
--- /dev/null
+++ b/arch/arm64/boot/dts/broadcom/bcm2837-rpi-cm3.dts
@@ -0,0 +1,2 @@ 
+// SPDX-License-Identifier: GPL-2.0
+#include "arm/bcm2837-rpi-cm3.dts"