diff mbox series

[5/5] bcm27xx: add support for Raspberry Pi Zero 2

Message ID 20211120034152.2612831-6-stijn@linux-ipv6.be
State Rejected, archived
Delegated to: Stijn Tintel
Headers show
Series add support for Raspberry Pi Zero 2 | expand

Commit Message

Stijn Tintel Nov. 20, 2021, 3:41 a.m. UTC
Updating the entire patchset from Raspberry Pi upstream would also add
the Raspberry Pi Zero 2 patch, but as that is a cumbersome process, just
import the required patch. Prefix it with 950 so it is clear that this
patch comes from the same source, but use a high number for the 2nd part
of the prefix so that it's clear the patch is not in the upstream order.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
---
 .../bcm27xx/base-files/etc/board.d/02_network |   1 +
 target/linux/bcm27xx/base-files/etc/diag.sh   |   1 +
 target/linux/bcm27xx/image/Makefile           |  18 +-
 ...0-9900-ARM-dts-Add-Pi-Zero-2-Support.patch | 229 ++++++++++++++++++
 4 files changed, 243 insertions(+), 6 deletions(-)
 create mode 100644 target/linux/bcm27xx/patches-5.10/950-9900-ARM-dts-Add-Pi-Zero-2-Support.patch
diff mbox series

Patch

diff --git a/target/linux/bcm27xx/base-files/etc/board.d/02_network b/target/linux/bcm27xx/base-files/etc/board.d/02_network
index f279941e1e..b4d73bf967 100644
--- a/target/linux/bcm27xx/base-files/etc/board.d/02_network
+++ b/target/linux/bcm27xx/base-files/etc/board.d/02_network
@@ -23,6 +23,7 @@  raspberrypi,4-model-b)
 	ucidef_set_interface_lan "eth0"
 	;;
 
+raspberrypi,model-zero-2 |\
 raspberrypi,model-zero-w)
 	ucidef_set_interface_lan "wlan0"
 	;;
diff --git a/target/linux/bcm27xx/base-files/etc/diag.sh b/target/linux/bcm27xx/base-files/etc/diag.sh
index f5e9ee0111..2a10aa9bdb 100644
--- a/target/linux/bcm27xx/base-files/etc/diag.sh
+++ b/target/linux/bcm27xx/base-files/etc/diag.sh
@@ -20,6 +20,7 @@  set_state() {
 	raspberrypi,3-compute-module |\
 	raspberrypi,model-b |\
 	raspberrypi,model-zero |\
+	raspberrypi,model-zero-2 |\
 	raspberrypi,model-zero-w)
 		status_led="led0"
 		;;
diff --git a/target/linux/bcm27xx/image/Makefile b/target/linux/bcm27xx/image/Makefile
index f0c3ae1272..3165a2d1e5 100644
--- a/target/linux/bcm27xx/image/Makefile
+++ b/target/linux/bcm27xx/image/Makefile
@@ -96,14 +96,17 @@  define Device/rpi-2
 	bcm2709-rpi-2-b bcm2710-rpi-2-b \
 	bcm2710-rpi-3-b bcm2710-rpi-3-b-plus \
 	bcm2711-rpi-4-b bcm2711-rpi-400 \
-	bcm2710-rpi-cm3 bcm2711-rpi-cm4
+	bcm2710-rpi-cm3 bcm2711-rpi-cm4 \
+	bcm2710-rpi-zero-2
   SUPPORTED_DEVICES := \
-	rpi-2-b rpi-3-b rpi-3-b-plus rpi-cm \
+	rpi-2-b rpi-3-b rpi-3-b-plus rpi-cm rpi-zero-2 \
 	raspberrypi,2-model-b raspberrypi,2-model-b-rev2 \
 	raspberrypi,3-model-b raspberrypi,3-model-b-plus \
 	raspberrypi,3-compute-module raspberrypi,compute-module-3 \
-	raspberrypi,400 raspberrypi,4-compute-module raspberrypi,4-model-b
+	raspberrypi,400 raspberrypi,4-compute-module raspberrypi,4-model-b \
+	raspberrypi,model-zero-2
   DEVICE_PACKAGES := \
+	bcm43436-firmware \
 	cypress-firmware-43430-sdio \
 	cypress-nvram-43430-sdio-rpi-3b \
 	cypress-firmware-43455-sdio \
@@ -126,13 +129,16 @@  define Device/rpi-3
   DEVICE_DTS := \
 	broadcom/bcm2710-rpi-2-b \
 	broadcom/bcm2710-rpi-3-b broadcom/bcm2710-rpi-3-b-plus \
-	broadcom/bcm2710-rpi-cm3
+	broadcom/bcm2710-rpi-cm3 \
+	broadcom/bcm2710-rpi-zero-2
   SUPPORTED_DEVICES := \
-	rpi-3-b rpi-3-b-plus \
+	rpi-3-b rpi-3-b-plus rpi-zero-2 \
 	raspberrypi,2-model-b-rev2 \
 	raspberrypi,3-model-b raspberrypi,3-model-b-plus \
-	raspberrypi,3-compute-module raspberrypi,compute-module-3
+	raspberrypi,3-compute-module raspberrypi,compute-module-3 \
+	raspberrypi,model-zero-2
   DEVICE_PACKAGES := \
+	bcm43436-firmware \
 	cypress-firmware-43430-sdio \
 	cypress-nvram-43430-sdio-rpi-3b \
 	cypress-firmware-43455-sdio \
diff --git a/target/linux/bcm27xx/patches-5.10/950-9900-ARM-dts-Add-Pi-Zero-2-Support.patch b/target/linux/bcm27xx/patches-5.10/950-9900-ARM-dts-Add-Pi-Zero-2-Support.patch
new file mode 100644
index 0000000000..6c37045c80
--- /dev/null
+++ b/target/linux/bcm27xx/patches-5.10/950-9900-ARM-dts-Add-Pi-Zero-2-Support.patch
@@ -0,0 +1,229 @@ 
+From 84dc624be6ae704fdb3c413b7d86315cf49fbb0b Mon Sep 17 00:00:00 2001
+From: Phil Elwell <phil@raspberrypi.com>
+Date: Thu, 9 Sep 2021 10:37:15 +0100
+Subject: [PATCH] ARM: dts: Add Pi Zero 2 support
+
+Signed-off-by: Phil Elwell <phil@raspberrypi.com>
+---
+ arch/arm/boot/dts/Makefile                    |   1 +
+ arch/arm/boot/dts/bcm2710-rpi-zero-2.dts      | 177 ++++++++++++++++++
+ arch/arm64/boot/dts/broadcom/Makefile         |   1 +
+ .../boot/dts/broadcom/bcm2710-rpi-zero-2.dts  |   1 +
+ 4 files changed, 180 insertions(+)
+ create mode 100644 arch/arm/boot/dts/bcm2710-rpi-zero-2.dts
+ create mode 100644 arch/arm64/boot/dts/broadcom/bcm2710-rpi-zero-2.dts
+
+diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
+index 12cd8bf582e1b..66956d0f2c187 100644
+--- a/arch/arm/boot/dts/Makefile
++++ b/arch/arm/boot/dts/Makefile
+@@ -7,6 +7,7 @@ dtb-$(CONFIG_ARCH_BCM2835) += \
+ 	bcm2708-rpi-cm.dtb \
+ 	bcm2708-rpi-zero.dtb \
+ 	bcm2708-rpi-zero-w.dtb \
++	bcm2710-rpi-zero-2.dtb \
+ 	bcm2709-rpi-2-b.dtb \
+ 	bcm2710-rpi-2-b.dtb \
+ 	bcm2710-rpi-3-b.dtb \
+diff --git a/arch/arm/boot/dts/bcm2710-rpi-zero-2.dts b/arch/arm/boot/dts/bcm2710-rpi-zero-2.dts
+new file mode 100644
+index 0000000000000..42185a4506666
+--- /dev/null
++++ b/arch/arm/boot/dts/bcm2710-rpi-zero-2.dts
+@@ -0,0 +1,177 @@
++/dts-v1/;
++
++#include "bcm2710.dtsi"
++#include "bcm2709-rpi.dtsi"
++#include "bcm283x-rpi-csi1-2lane.dtsi"
++#include "bcm283x-rpi-i2c0mux_0_44.dtsi"
++#include "bcm2708-rpi-bt.dtsi"
++#include "bcm283x-rpi-cam1-regulator.dtsi"
++
++/ {
++	compatible = "raspberrypi,model-zero-2", "brcm,bcm2837";
++	model = "Raspberry Pi Zero 2";
++
++	chosen {
++		bootargs = "coherent_pool=1M 8250.nr_uarts=1 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1";
++	};
++
++	aliases {
++		serial0 = &uart1;
++		serial1 = &uart0;
++		mmc1 = &mmcnr;
++	};
++};
++
++&gpio {
++	spi0_pins: spi0_pins {
++		brcm,pins = <9 10 11>;
++		brcm,function = <4>; /* alt0 */
++	};
++
++	spi0_cs_pins: spi0_cs_pins {
++		brcm,pins = <8 7>;
++		brcm,function = <1>; /* output */
++	};
++
++	i2c0_pins: i2c0 {
++		brcm,pins = <0 1>;
++		brcm,function = <4>;
++	};
++
++	i2c1_pins: i2c1 {
++		brcm,pins = <2 3>;
++		brcm,function = <4>;
++	};
++
++	i2s_pins: i2s {
++		brcm,pins = <18 19 20 21>;
++		brcm,function = <4>; /* alt0 */
++	};
++
++	sdio_pins: sdio_pins {
++		brcm,pins =     <34 35 36 37 38 39>;
++		brcm,function = <7>; // alt3 = SD1
++		brcm,pull =     <0 2 2 2 2 2>;
++	};
++
++	bt_pins: bt_pins {
++		brcm,pins = <43>;
++		brcm,function = <4>; /* alt0:GPCLK2 */
++		brcm,pull = <0>;
++	};
++
++	uart0_pins: uart0_pins {
++		brcm,pins = <30 31 32 33>;
++		brcm,function = <7>; /* alt3=UART0 */
++		brcm,pull = <2 0 0 2>; /* up none none up */
++	};
++
++	uart1_pins: uart1_pins {
++		brcm,pins;
++		brcm,function;
++		brcm,pull;
++	};
++
++	audio_pins: audio_pins {
++		brcm,pins = <>;
++		brcm,function = <>;
++	};
++};
++
++&mmcnr {
++	pinctrl-names = "default";
++	pinctrl-0 = <&sdio_pins>;
++	bus-width = <4>;
++	status = "okay";
++};
++
++&uart0 {
++	pinctrl-names = "default";
++	pinctrl-0 = <&uart0_pins &bt_pins>;
++	status = "okay";
++};
++
++&uart1 {
++	pinctrl-names = "default";
++	pinctrl-0 = <&uart1_pins>;
++	status = "okay";
++};
++
++&spi0 {
++	pinctrl-names = "default";
++	pinctrl-0 = <&spi0_pins &spi0_cs_pins>;
++	cs-gpios = <&gpio 8 1>, <&gpio 7 1>;
++
++	spidev0: spidev@0{
++		compatible = "spidev";
++		reg = <0>;	/* CE0 */
++		#address-cells = <1>;
++		#size-cells = <0>;
++		spi-max-frequency = <125000000>;
++	};
++
++	spidev1: spidev@1{
++		compatible = "spidev";
++		reg = <1>;	/* CE1 */
++		#address-cells = <1>;
++		#size-cells = <0>;
++		spi-max-frequency = <125000000>;
++	};
++};
++
++&i2c0if {
++	clock-frequency = <100000>;
++};
++
++&i2c1 {
++	pinctrl-names = "default";
++	pinctrl-0 = <&i2c1_pins>;
++	clock-frequency = <100000>;
++};
++
++&i2c2 {
++	clock-frequency = <100000>;
++};
++
++&i2s {
++	pinctrl-names = "default";
++	pinctrl-0 = <&i2s_pins>;
++};
++
++&leds {
++	act_led: led-act {
++		label = "led0";
++		linux,default-trigger = "actpwr";
++		gpios = <&gpio 29 GPIO_ACTIVE_LOW>;
++	};
++};
++
++&hdmi {
++	hpd-gpios = <&gpio 28 GPIO_ACTIVE_LOW>;
++};
++
++&audio {
++	pinctrl-names = "default";
++	pinctrl-0 = <&audio_pins>;
++	brcm,disable-headphones = <1>;
++};
++
++&bt {
++	shutdown-gpios = <&gpio 42 GPIO_ACTIVE_HIGH>;
++};
++
++&minibt {
++	shutdown-gpios = <&gpio 42 GPIO_ACTIVE_HIGH>;
++};
++
++&cam1_reg {
++	gpio = <&gpio 40 GPIO_ACTIVE_HIGH>;
++};
++
++/ {
++	__overrides__ {
++		act_led_gpio = <&act_led>,"gpios:4";
++		act_led_activelow = <&act_led>,"gpios:8";
++		act_led_trigger = <&act_led>,"linux,default-trigger";
++	};
++};
+diff --git a/arch/arm64/boot/dts/broadcom/Makefile b/arch/arm64/boot/dts/broadcom/Makefile
+index 69809bf2f45df..e7c2c4fd59a87 100644
+--- a/arch/arm64/boot/dts/broadcom/Makefile
++++ b/arch/arm64/boot/dts/broadcom/Makefile
+@@ -3,6 +3,7 @@ dtb-$(CONFIG_ARCH_BCM2835) += bcm2837-rpi-3-a-plus.dtb \
+ 			      bcm2837-rpi-3-b.dtb \
+ 			      bcm2837-rpi-3-b-plus.dtb \
+ 			      bcm2837-rpi-cm3-io3.dtb
++dtb-$(CONFIG_ARCH_BCM2835) += bcm2710-rpi-zero-2.dtb
+ dtb-$(CONFIG_ARCH_BCM2835) += bcm2710-rpi-2-b.dtb
+ dtb-$(CONFIG_ARCH_BCM2835) += bcm2710-rpi-3-b.dtb
+ dtb-$(CONFIG_ARCH_BCM2835) += bcm2710-rpi-3-b-plus.dtb
+diff --git a/arch/arm64/boot/dts/broadcom/bcm2710-rpi-zero-2.dts b/arch/arm64/boot/dts/broadcom/bcm2710-rpi-zero-2.dts
+new file mode 100644
+index 0000000000000..f76f553599ef2
+--- /dev/null
++++ b/arch/arm64/boot/dts/broadcom/bcm2710-rpi-zero-2.dts
+@@ -0,0 +1 @@
++#include "../../../../arm/boot/dts/bcm2710-rpi-zero-2.dts"