Openwrt/target/linux/bcm27xx/patches-5.4/950-0841-ARM-dts-Add-Bluetooth-nodes-for-Raspberry-Pi.patch
Álvaro Fernández Rojas f07e572f64 bcm27xx: import latest patches from the RPi foundation
bcm2708: boot tested on RPi B+ v1.2
bcm2709: boot tested on RPi 3B v1.2 and RPi 4B v1.1 4G
bcm2710: boot tested on RPi 3B v1.2
bcm2711: boot tested on RPi 4B v1.1 4G

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2021-02-18 23:42:32 +01:00

284 lines
7.1 KiB
Diff

From c46a59c99e53ab41096afcf7f7879bb12769346b Mon Sep 17 00:00:00 2001
From: Maxim Mikityanskiy <maxtram95@gmail.com>
Date: Sat, 27 Jun 2020 13:08:26 +0300
Subject: [PATCH] ARM: dts: Add Bluetooth nodes for Raspberry Pi
Add device tree nodes for Bluetooth on supported Raspberry Pi boards.
It's disabled by default and can be enabled by `krnbt=on` dtparam. It's
an alternative way of configuring Bluetooth, as compared to hciattach or
btattach. When the dtparam is enabled, the Bluetooth driver is probed
automatically and doesn't require any additional bring-up scripts.
Note that Raspberry Pi 3 B rev 1.2 doesn't have the required hardware
flow control pins of UART0 connected to the Bluetooth module, so the
user should decrease the baudrate by passing `krnbt_baudrate=921600`
dtparam to make it more stable. It resembles the behavior of the btuart
script from Raspbian.
The miniuart-bt overlay was modified to support Bluetooth probing with
device tree, too. It's disabled by default and can be enabled by
`krnbt=on` parameter of the miniuart-bt overlay.
Signed-off-by: Maxim Mikityanskiy <maxtram95@gmail.com>
---
arch/arm/boot/dts/bcm2708-rpi-bt.dtsi | 26 +++++++++++++++++++
arch/arm/boot/dts/bcm2708-rpi-zero-w.dts | 1 +
arch/arm/boot/dts/bcm2710-rpi-3-b-plus.dts | 1 +
arch/arm/boot/dts/bcm2710-rpi-3-b.dts | 1 +
arch/arm/boot/dts/bcm2711-rpi-4-b.dts | 3 +--
arch/arm/boot/dts/bcm271x-rpi-bt.dtsi | 26 +++++++++++++++++++
arch/arm/boot/dts/overlays/README | 12 +++++++--
.../boot/dts/overlays/disable-bt-overlay.dts | 13 ++++++++--
.../boot/dts/overlays/miniuart-bt-overlay.dts | 21 ++++++++++++---
9 files changed, 94 insertions(+), 10 deletions(-)
create mode 100644 arch/arm/boot/dts/bcm2708-rpi-bt.dtsi
create mode 100644 arch/arm/boot/dts/bcm271x-rpi-bt.dtsi
--- /dev/null
+++ b/arch/arm/boot/dts/bcm2708-rpi-bt.dtsi
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: GPL-2.0
+
+&uart0 {
+ bt: bluetooth {
+ compatible = "brcm,bcm43438-bt";
+ max-speed = <3000000>;
+ shutdown-gpios = <&gpio 45 GPIO_ACTIVE_HIGH>;
+ status = "disabled";
+ };
+};
+
+&uart1 {
+ minibt: bluetooth {
+ compatible = "brcm,bcm43438-bt";
+ max-speed = <460800>;
+ shutdown-gpios = <&gpio 45 GPIO_ACTIVE_HIGH>;
+ status = "disabled";
+ };
+};
+
+/ {
+ __overrides__ {
+ krnbt = <&bt>,"status";
+ krnbt_baudrate = <&bt>,"max-speed:0";
+ };
+};
--- a/arch/arm/boot/dts/bcm2708-rpi-zero-w.dts
+++ b/arch/arm/boot/dts/bcm2708-rpi-zero-w.dts
@@ -4,6 +4,7 @@
#include "bcm2708-rpi.dtsi"
#include "bcm283x-rpi-csi1-2lane.dtsi"
#include "bcm283x-rpi-i2c0mux_0_28.dtsi"
+#include "bcm2708-rpi-bt.dtsi"
/ {
compatible = "raspberrypi,model-zero-w", "brcm,bcm2835";
--- a/arch/arm/boot/dts/bcm2710-rpi-3-b-plus.dts
+++ b/arch/arm/boot/dts/bcm2710-rpi-3-b-plus.dts
@@ -5,6 +5,7 @@
#include "bcm283x-rpi-lan7515.dtsi"
#include "bcm283x-rpi-csi1-2lane.dtsi"
#include "bcm283x-rpi-i2c0mux_0_44.dtsi"
+#include "bcm271x-rpi-bt.dtsi"
/ {
compatible = "raspberrypi,3-model-b-plus", "brcm,bcm2837";
--- a/arch/arm/boot/dts/bcm2710-rpi-3-b.dts
+++ b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts
@@ -5,6 +5,7 @@
#include "bcm283x-rpi-smsc9514.dtsi"
#include "bcm283x-rpi-csi1-2lane.dtsi"
#include "bcm283x-rpi-i2c0mux_0_44.dtsi"
+#include "bcm271x-rpi-bt.dtsi"
/ {
compatible = "raspberrypi,3-model-b", "brcm,bcm2837";
--- a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
+++ b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
@@ -182,6 +182,7 @@
// Downstream rpi- changes
#include "bcm270x.dtsi"
+#include "bcm271x-rpi-bt.dtsi"
/ {
soc {
@@ -250,8 +251,6 @@
&uart0 {
pinctrl-0 = <&uart0_pins &bt_pins>;
status = "okay";
-
- /delete-node/ bluetooth;
};
&uart1 {
--- /dev/null
+++ b/arch/arm/boot/dts/bcm271x-rpi-bt.dtsi
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: GPL-2.0
+
+&uart0 {
+ bt: bluetooth {
+ compatible = "brcm,bcm43438-bt";
+ max-speed = <3000000>;
+ shutdown-gpios = <&expgpio 0 GPIO_ACTIVE_HIGH>;
+ status = "disabled";
+ };
+};
+
+&uart1 {
+ minibt: bluetooth {
+ compatible = "brcm,bcm43438-bt";
+ max-speed = <460800>;
+ shutdown-gpios = <&expgpio 0 GPIO_ACTIVE_HIGH>;
+ status = "disabled";
+ };
+};
+
+/ {
+ __overrides__ {
+ krnbt = <&bt>,"status";
+ krnbt_baudrate = <&bt>,"max-speed:0";
+ };
+};
--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -162,6 +162,13 @@ Params:
i2s Set to "on" to enable the i2s interface
(default "off")
+ krnbt Set to "on" to enable autoprobing of Bluetooth
+ driver without need of hciattach/btattach
+ (default "off")
+
+ krnbt_baudrate Set the baudrate of the PL011 UART when used
+ with krnbt=on
+
spi Set to "on" to enable the spi interfaces
(default "off")
@@ -1764,8 +1771,9 @@ Info: Switch the onboard Bluetooth fun
in which case use /dev/serial1 instead because it will always be
correct. Furthermore, you must also set core_freq and core_freq_min to
the same value in config.txt or the miniuart will not work.
-Load: dtoverlay=miniuart-bt
-Params: <None>
+Load: dtoverlay=miniuart-bt,<param>=<val>
+Params: krnbt Set to "on" to enable autoprobing of Bluetooth
+ driver without need of hciattach/btattach
Name: mmc
--- a/arch/arm/boot/dts/overlays/disable-bt-overlay.dts
+++ b/arch/arm/boot/dts/overlays/disable-bt-overlay.dts
@@ -8,6 +8,8 @@
sudo systemctl disable hciuart
*/
+#include <dt-bindings/gpio/gpio.h>
+
/{
compatible = "brcm,bcm2835";
@@ -28,6 +30,13 @@
};
fragment@2 {
+ target = <&bt>;
+ __overlay__ {
+ status = "disabled";
+ };
+ };
+
+ fragment@3 {
target = <&uart0_pins>;
__overlay__ {
brcm,pins;
@@ -36,7 +45,7 @@
};
};
- fragment@3 {
+ fragment@4 {
target = <&bt_pins>;
__overlay__ {
brcm,pins;
@@ -45,7 +54,7 @@
};
};
- fragment@4 {
+ fragment@5 {
target-path = "/aliases";
__overlay__ {
serial0 = "/soc/serial@7e201000";
--- a/arch/arm/boot/dts/overlays/miniuart-bt-overlay.dts
+++ b/arch/arm/boot/dts/overlays/miniuart-bt-overlay.dts
@@ -15,6 +15,8 @@
this overlay is used.
*/
+#include <dt-bindings/gpio/gpio.h>
+
/{
compatible = "brcm,bcm2835";
@@ -28,6 +30,13 @@
};
fragment@1 {
+ target = <&bt>;
+ __overlay__ {
+ status = "disabled";
+ };
+ };
+
+ fragment@2 {
target = <&uart1>;
__overlay__ {
pinctrl-names = "default";
@@ -36,7 +45,7 @@
};
};
- fragment@2 {
+ fragment@3 {
target = <&uart0_pins>;
__overlay__ {
brcm,pins;
@@ -45,7 +54,7 @@
};
};
- fragment@3 {
+ fragment@4 {
target = <&uart1_pins>;
__overlay__ {
brcm,pins = <32 33>;
@@ -54,7 +63,7 @@
};
};
- fragment@4 {
+ fragment@5 {
target = <&gpio>;
__overlay__ {
fake_bt_cts: fake_bt_cts {
@@ -64,11 +73,15 @@
};
};
- fragment@5 {
+ fragment@6 {
target-path = "/aliases";
__overlay__ {
serial0 = "/soc/serial@7e201000";
serial1 = "/soc/serial@7e215040";
};
};
+
+ __overrides__ {
+ krnbt = <&minibt>,"status";
+ };
};