Skip to contentSkip to conversation

ARM: bcm2835: add device tree for Raspberry Pi model B+

PATCH Superseded Matthias Klein 2 participants 4 messages Oct 28, 2014 – Oct 29, 2014

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: bcm2835: add device tree for Raspberry Pi model B+

The model B and B+ differ in the GPIO lines for ACT and PWR led. The PWR led on the B+ model is active low.

---
 arch/arm/boot/dts/bcm2835-rpi-b-plus.dts | 64 ++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)
 create mode 100644 arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
arch/arm/boot/dts/bcm2835-rpi-b-plus.dts new file +64 -0
new file mode 100644
index 0000000..c01d7cb
@@ -0,0 +1,64 @@
+/dts-v1/;
+/include/ "bcm2835.dtsi"
+
+/ {
+	compatible = "raspberrypi,model-b-plus", "brcm,bcm2835";
+	model = "Raspberry Pi Model B+";
+
+	memory {
+		reg = <0 0x10000000>;
+	};
+
+	leds {
+		compatible = "gpio-leds";
+
+		act {
+			label = "ACT";
+			gpios = <&gpio 47 1>;
+			default-state = "keep";
+			linux,default-trigger = "heartbeat";
+		};
+
+		pwr {
+			label = "PWR";
+			gpios = <&gpio 35 0>;
+			default-state = "keep";
+			linux,default-trigger = "default-on";
+		};
+	};
+};
+
+&gpio {
+	pinctrl-names = "default";
+	pinctrl-0 = <&gpioout &alt0 &alt3>;
+
+	gpioout: gpioout {
+		brcm,pins = <6>;
+		brcm,function = <1>; /* GPIO out */
+	};
+
+	alt0: alt0 {
+		brcm,pins = <0 1 2 3 4 5 7 8 9 10 11 14 15 40 45>;
+		brcm,function = <4>; /* alt0 */
+	};
+
+	alt3: alt3 {
+		brcm,pins = <48 49 50 51 52 53>;
+		brcm,function = <7>; /* alt3 */
+	};
+};
+
+&i2c0 {
+	status = "okay";
+	clock-frequency = <100000>;
+};
+
+&i2c1 {
+	status = "okay";
+	clock-frequency = <100000>;
+};
+
+&mmc {
+	status = "okay";
+	bus-width = <4>;
+};
Signature · 1 line
2.1.2
#1 lore raw
Quoted 2 lines · Matthias Klein

The model B and B+ differ in the GPIO lines for ACT and PWR led. The PWR led on the B+ model is active low.

This new file is almost identical to bcm2835-rpi.dts. Perhaps we can use some include files to share the common portions so they aren't duplicated. Roughly:

* Move all the common content from bcm2835-rpi.dts into bcm2835-rpi.dtsi.

* Update bcm2835-rpi.dts to include bcm2835-rpi.dtsi to get all the common parts, and add the few lines of differences.

* Update this patch similarly.

Does that make sense?

A couple changes to this patch and the existing bcm2835-rpi.dts might reduce the differences even further, leading to more common code in bcm2835-rpi.dtsi:

- Add the PWR LED to bcm2835-rpi-b.dts, if appropriate.
- Add the I2S pinmux settings for B+ too.

Quoted 1 line
arch/arm/boot/dts/bcm2835-rpi-b-plus.dts +0 -0

...

Quoted 1 line

+&mmc {

That label doesn't exist; it should be &sdhci. Consequently:

Quoted 3 lines

Error: arch/arm/boot/dts/bcm2835-rpi-b-plus.dts:64.2-3 label or path, 'mmc', not found FATAL ERROR: Syntax error parsing input tree
make[1]: *** [arch/arm/boot/dts/bcm2835-rpi-b-plus.dtb] Error 1

This new DT file should be added to arch/arm/boot/dts/Makefile too.

#2 lore raw

Am 29.10.2014 um 02:33 schrieb Stephen Warren:

Quoted 7 lines · Matthias Klein
Quoted 2 lines

The model B and B+ differ in the GPIO lines for ACT and PWR led. The PWR led on the B+ model is active low.

This new file is almost identical to bcm2835-rpi.dts. Perhaps we can use some include files to share the common portions so they aren't duplicated. Roughly:

Quoted 8 lines

* Move all the common content from bcm2835-rpi.dts into bcm2835-rpi.dtsi.

* Update bcm2835-rpi.dts to include bcm2835-rpi.dtsi to get all the common parts, and add the few lines of differences.

* Update this patch similarly.

Does that make sense?

Yes, I will work on such a patchset.

Quoted 5 lines

A couple changes to this patch and the existing bcm2835-rpi.dts might reduce the differences even further, leading to more common code in bcm2835-rpi.dtsi:

Quoted 7 lines

- Add the PWR LED to bcm2835-rpi-b.dts, if appropriate.
- Add the I2S pinmux settings for B+ too.

Quoted 1 line
arch/arm/boot/dts/bcm2835-rpi-b-plus.dts +0 -0

...

Quoted 1 line

+&mmc {

That label doesn't exist; it should be &sdhci. Consequently:

Sorry, I based my patch on the wrong tree. I used https://github.com/pietrushnic/rpi-dt-linux/tree/rpi-3.17.y which contains non upstream commits.

Which tree should I use in general for work on the BCM2835? Is linux-next the right tree?

#3 lore raw
Quoted 31 lines · Matthias Klein

Am 29.10.2014 um 02:33 schrieb Stephen Warren:

Quoted 7 lines · Matthias Klein
Quoted 2 lines

The model B and B+ differ in the GPIO lines for ACT and PWR led. The PWR led on the B+ model is active low.

This new file is almost identical to bcm2835-rpi.dts. Perhaps we can use some include files to share the common portions so they aren't duplicated. Roughly:

Quoted 8 lines

* Move all the common content from bcm2835-rpi.dts into bcm2835-rpi.dtsi.

* Update bcm2835-rpi.dts to include bcm2835-rpi.dtsi to get all the common parts, and add the few lines of differences.

* Update this patch similarly.

Does that make sense?

Yes, I will work on such a patchset.

Quoted 12 lines

A couple changes to this patch and the existing bcm2835-rpi.dts might reduce the differences even further, leading to more common code in bcm2835-rpi.dtsi:

- Add the PWR LED to bcm2835-rpi-b.dts, if appropriate.
- Add the I2S pinmux settings for B+ too.

Quoted 2 lines
arch/arm/boot/dts/bcm2835-rpi-b-plus.dts +0 -0

...

Quoted 1 line

+&mmc {

Quoted 8 lines
Quoted 1 line

That label doesn't exist; it should be &sdhci. Consequently:

Sorry, I based my patch on the wrong tree. I used
https://github.com/pietrushnic/rpi-dt-linux/tree/rpi-3.17.y which contains non upstream commits.

Which tree should I use in general for work on the BCM2835? Is linux-next the right tree?

linux-next would usually work.

The most recent Linus kernel would also often be a good base, or perhaps any recent branch (of which there are none at present) in:

https://git.kernel.org/cgit/linux/kernel/git/swarren/linux-rpi.git/
(
which will hopefully soon move to:
https://git.kernel.org/cgit/linux/kernel/git/rpi/linux-rpi.git/
)

Which you pick depends on things like how many other patches touch the same files, and which branches/repos they were applied in, and what conflicts/dependencies exist.