Yellow: Always use mini-UART for Bluetooth (#2571)

* Yellow: Always use mini-UART for Bluetooth

Unfortunately, the mini-UART device tree adjusts the alias for serial1,
which we need to make ttyAMA1 the Zigbee UART (UART4).

However, we can no simply adjust that overlay, as the overlays are not
built as part of the Buildroot build. Instead, they are directly copied
from Raspberry Pi's Firmware repostiory.

Instead of using device tree overlays, just apply the changes to our
Yellow specific device tree. To avoid that the device tree gets loaded
anyhow, we could adjust config.txt but that has complications on its
own. Since the overlay might be conflicting with the Yellow device tree
anyways, just remove all of them.

Note: The miniuart-bt.dtbo overlay won't be present, while config.txt
of upgraded instances still reference it. It seems that this doesn't
cause problems at boot time. Leaving the dtoverlay=miniuart-bt present
also allows user to downgrade in case needed.

* Avoid duplicating 98-rpi.conf
This commit is contained in:
Stefan Agner 2023-06-01 12:13:18 +02:00
parent 91cb63cd0a
commit b7be663ced
No known key found for this signature in database
GPG Key ID: 22D95D15D3A36E95
5 changed files with 89 additions and 4 deletions

View File

@ -10,9 +10,6 @@ arm_64bit=1
# Enable primary UART by default
enable_uart=1
# Free up full-fledged PL011 UART for J11
dtoverlay=miniuart-bt
# No HDMI on Yellow, but we can't set to 16 since we need the full firmware
# for codecs
gpu_mem=32

View File

@ -0,0 +1,79 @@
From 51e62f1491c1fce95541008d29d154e4ae117a22 Mon Sep 17 00:00:00 2001
Message-Id: <51e62f1491c1fce95541008d29d154e4ae117a22.1685609747.git.stefan@agner.ch>
In-Reply-To: <f0292972b38d512fce48384ebbb72b2da46f03bd.1685609747.git.stefan@agner.ch>
References: <f0292972b38d512fce48384ebbb72b2da46f03bd.1685609747.git.stefan@agner.ch>
From: Stefan Agner <stefan@agner.ch>
Date: Thu, 1 Jun 2023 10:22:12 +0200
Subject: [PATCH] ARM: dts: bcm2711: yellow: Use mini-UART for Bluetooth by
default
Use the mini UART for Bluetooth by default. This makes sure that the
full UART is always available on J11.
Signed-off-by: Stefan Agner <stefan@agner.ch>
---
.../boot/dts/bcm2711-rpi-cm4-ha-yellow.dts | 23 ++++++++++++-------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/arch/arm/boot/dts/bcm2711-rpi-cm4-ha-yellow.dts b/arch/arm/boot/dts/bcm2711-rpi-cm4-ha-yellow.dts
index b8f0bc2df062..78e61e628d66 100644
--- a/arch/arm/boot/dts/bcm2711-rpi-cm4-ha-yellow.dts
+++ b/arch/arm/boot/dts/bcm2711-rpi-cm4-ha-yellow.dts
@@ -318,7 +318,7 @@ chosen {
};
aliases {
- serial0 = &uart1;
+ serial0 = &uart0;
serial1 = &uart4;
serial2 = &uart5;
mmc0 = &emmc2;
@@ -348,12 +348,14 @@ &mmcnr {
};
&uart0 {
- pinctrl-0 = <&uart0_pins &bt_pins>;
+ pinctrl-0 = <&uart0_pins>;
status = "okay";
};
&uart1 {
- pinctrl-0 = <&uart1_pins>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&uart1_pins &bt_pins &fake_bt_cts>;
+ status = "okay";
};
&spi0 {
@@ -489,18 +491,23 @@ bt_pins: bt_pins {
brcm,pull = <2>;
};
- uart0_pins: uart0_pins {
- brcm,pins = <32 33>;
- brcm,function = <BCM2835_FSEL_ALT3>;
- brcm,pull = <0 2>;
+ fake_bt_cts: fake_bt_cts {
+ brcm,pins = <31>;
+ brcm,function = <1>; /* output */
};
- uart1_pins: uart1_pins {
+ uart0_pins: uart0_pins {
brcm,pins;
brcm,function;
brcm,pull;
};
+ uart1_pins: uart1_pins {
+ brcm,pins = <32 33>;
+ brcm,function = <2>; /* alt5=UART1 */
+ brcm,pull = <0 2>;
+ };
+
uart2_pins: uart2_pins {
brcm,pins = <0 1>;
brcm,function = <BCM2835_FSEL_ALT4>;
--
2.40.1

View File

@ -0,0 +1,4 @@
KERNEL=="ttyAMA0", SYMLINK+="serial0"
KERNEL=="ttyS0", SYMLINK+="serial1"

View File

@ -15,7 +15,7 @@ BR2_TARGET_GENERIC_HOSTNAME="homeassistant"
BR2_TARGET_GENERIC_ISSUE="Welcome to Home Assistant"
BR2_INIT_SYSTEMD=y
# BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW is not set
BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_HASSOS_PATH)/rootfs-overlay $(BR2_EXTERNAL_HASSOS_PATH)/board/raspberrypi/rootfs-overlay"
BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_HASSOS_PATH)/rootfs-overlay $(BR2_EXTERNAL_HASSOS_PATH)/board/raspberrypi/rootfs-overlay $(BR2_EXTERNAL_HASSOS_PATH)/board/raspberrypi/yellow/rootfs-overlay"
BR2_ROOTFS_POST_BUILD_SCRIPT="$(BR2_EXTERNAL_HASSOS_PATH)/scripts/post-build.sh"
BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL_HASSOS_PATH)/scripts/post-image.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_EXTERNAL_HASSOS_PATH)/board/raspberrypi/yellow $(BR2_EXTERNAL_HASSOS_PATH)/board/raspberrypi/hassos-hook.sh"
@ -26,6 +26,7 @@ BR2_LINUX_KERNEL_DEFCONFIG="bcm2711"
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_HASSOS_PATH)/kernel/hassos.config $(BR2_EXTERNAL_HASSOS_PATH)/kernel/docker.config $(BR2_EXTERNAL_HASSOS_PATH)/kernel/device-support.config $(BR2_EXTERNAL_HASSOS_PATH)/board/raspberrypi/kernel.config"
BR2_LINUX_KERNEL_LZ4=y
BR2_LINUX_KERNEL_DTS_SUPPORT=y
BR2_LINUX_KERNEL_DTB_OVERLAY_SUPPORT=y
BR2_LINUX_KERNEL_INTREE_DTS_NAME="broadcom/bcm2711-rpi-cm4-ha-yellow"
BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y
@ -52,6 +53,7 @@ BR2_PACKAGE_LINUX_FIRMWARE_RTL_815X=y
BR2_PACKAGE_LINUX_FIRMWARE_USB_SERIAL_TI=y
BR2_PACKAGE_RPI_FIRMWARE=y
BR2_PACKAGE_RPI_FIRMWARE_VARIANT_PI4=y
# BR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTB_OVERLAYS is not set
BR2_PACKAGE_GPTFDISK=y
BR2_PACKAGE_GPTFDISK_SGDISK=y
BR2_PACKAGE_INPUT_EVENT_DAEMON=y

View File

@ -16,6 +16,9 @@ install_boot() {
fi
mount "${RAUC_IMAGE_NAME}" "${BOOT_NEW}"
# Avoid stale/old overlays
rm -f "${BOOT_MNT}"/overlays/* || true
# Backup boot config
cp -f "${BOOT_MNT}"/*.txt "${BOOT_TMP}/" || true