1 From c46a59c99e53ab41096afcf7f7879bb12769346b Mon Sep 17 00:00:00 2001
2 From: Maxim Mikityanskiy <maxtram95@gmail.com>
3 Date: Sat, 27 Jun 2020 13:08:26 +0300
4 Subject: [PATCH] ARM: dts: Add Bluetooth nodes for Raspberry Pi
6 Add device tree nodes for Bluetooth on supported Raspberry Pi boards.
7 It's disabled by default and can be enabled by `krnbt=on` dtparam. It's
8 an alternative way of configuring Bluetooth, as compared to hciattach or
9 btattach. When the dtparam is enabled, the Bluetooth driver is probed
10 automatically and doesn't require any additional bring-up scripts.
12 Note that Raspberry Pi 3 B rev 1.2 doesn't have the required hardware
13 flow control pins of UART0 connected to the Bluetooth module, so the
14 user should decrease the baudrate by passing `krnbt_baudrate=921600`
15 dtparam to make it more stable. It resembles the behavior of the btuart
18 The miniuart-bt overlay was modified to support Bluetooth probing with
19 device tree, too. It's disabled by default and can be enabled by
20 `krnbt=on` parameter of the miniuart-bt overlay.
22 Signed-off-by: Maxim Mikityanskiy <maxtram95@gmail.com>
24 arch/arm/boot/dts/bcm2708-rpi-bt.dtsi | 26 +++++++++++++++++++
25 arch/arm/boot/dts/bcm2708-rpi-zero-w.dts | 1 +
26 arch/arm/boot/dts/bcm2710-rpi-3-b-plus.dts | 1 +
27 arch/arm/boot/dts/bcm2710-rpi-3-b.dts | 1 +
28 arch/arm/boot/dts/bcm2711-rpi-4-b.dts | 3 +--
29 arch/arm/boot/dts/bcm271x-rpi-bt.dtsi | 26 +++++++++++++++++++
30 arch/arm/boot/dts/overlays/README | 12 +++++++--
31 .../boot/dts/overlays/disable-bt-overlay.dts | 13 ++++++++--
32 .../boot/dts/overlays/miniuart-bt-overlay.dts | 21 ++++++++++++---
33 9 files changed, 94 insertions(+), 10 deletions(-)
34 create mode 100644 arch/arm/boot/dts/bcm2708-rpi-bt.dtsi
35 create mode 100644 arch/arm/boot/dts/bcm271x-rpi-bt.dtsi
38 +++ b/arch/arm/boot/dts/bcm2708-rpi-bt.dtsi
40 +// SPDX-License-Identifier: GPL-2.0
44 + compatible = "brcm,bcm43438-bt";
45 + max-speed = <3000000>;
46 + shutdown-gpios = <&gpio 45 GPIO_ACTIVE_HIGH>;
47 + status = "disabled";
53 + compatible = "brcm,bcm43438-bt";
54 + max-speed = <460800>;
55 + shutdown-gpios = <&gpio 45 GPIO_ACTIVE_HIGH>;
56 + status = "disabled";
62 + krnbt = <&bt>,"status";
63 + krnbt_baudrate = <&bt>,"max-speed:0";
66 --- a/arch/arm/boot/dts/bcm2708-rpi-zero-w.dts
67 +++ b/arch/arm/boot/dts/bcm2708-rpi-zero-w.dts
69 #include "bcm2708-rpi.dtsi"
70 #include "bcm283x-rpi-csi1-2lane.dtsi"
71 #include "bcm283x-rpi-i2c0mux_0_28.dtsi"
72 +#include "bcm2708-rpi-bt.dtsi"
75 compatible = "raspberrypi,model-zero-w", "brcm,bcm2835";
76 --- a/arch/arm/boot/dts/bcm2710-rpi-3-b-plus.dts
77 +++ b/arch/arm/boot/dts/bcm2710-rpi-3-b-plus.dts
79 #include "bcm283x-rpi-lan7515.dtsi"
80 #include "bcm283x-rpi-csi1-2lane.dtsi"
81 #include "bcm283x-rpi-i2c0mux_0_44.dtsi"
82 +#include "bcm271x-rpi-bt.dtsi"
85 compatible = "raspberrypi,3-model-b-plus", "brcm,bcm2837";
86 --- a/arch/arm/boot/dts/bcm2710-rpi-3-b.dts
87 +++ b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts
89 #include "bcm283x-rpi-smsc9514.dtsi"
90 #include "bcm283x-rpi-csi1-2lane.dtsi"
91 #include "bcm283x-rpi-i2c0mux_0_44.dtsi"
92 +#include "bcm271x-rpi-bt.dtsi"
95 compatible = "raspberrypi,3-model-b", "brcm,bcm2837";
96 --- a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
97 +++ b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
99 // Downstream rpi- changes
101 #include "bcm270x.dtsi"
102 +#include "bcm271x-rpi-bt.dtsi"
108 pinctrl-0 = <&uart0_pins &bt_pins>;
111 - /delete-node/ bluetooth;
116 +++ b/arch/arm/boot/dts/bcm271x-rpi-bt.dtsi
118 +// SPDX-License-Identifier: GPL-2.0
122 + compatible = "brcm,bcm43438-bt";
123 + max-speed = <3000000>;
124 + shutdown-gpios = <&expgpio 0 GPIO_ACTIVE_HIGH>;
125 + status = "disabled";
130 + minibt: bluetooth {
131 + compatible = "brcm,bcm43438-bt";
132 + max-speed = <460800>;
133 + shutdown-gpios = <&expgpio 0 GPIO_ACTIVE_HIGH>;
134 + status = "disabled";
140 + krnbt = <&bt>,"status";
141 + krnbt_baudrate = <&bt>,"max-speed:0";
144 --- a/arch/arm/boot/dts/overlays/README
145 +++ b/arch/arm/boot/dts/overlays/README
146 @@ -162,6 +162,13 @@ Params:
147 i2s Set to "on" to enable the i2s interface
150 + krnbt Set to "on" to enable autoprobing of Bluetooth
151 + driver without need of hciattach/btattach
154 + krnbt_baudrate Set the baudrate of the PL011 UART when used
157 spi Set to "on" to enable the spi interfaces
160 @@ -1764,8 +1771,9 @@ Info: Switch the onboard Bluetooth fun
161 in which case use /dev/serial1 instead because it will always be
162 correct. Furthermore, you must also set core_freq and core_freq_min to
163 the same value in config.txt or the miniuart will not work.
164 -Load: dtoverlay=miniuart-bt
166 +Load: dtoverlay=miniuart-bt,<param>=<val>
167 +Params: krnbt Set to "on" to enable autoprobing of Bluetooth
168 + driver without need of hciattach/btattach
172 --- a/arch/arm/boot/dts/overlays/disable-bt-overlay.dts
173 +++ b/arch/arm/boot/dts/overlays/disable-bt-overlay.dts
175 sudo systemctl disable hciuart
178 +#include <dt-bindings/gpio/gpio.h>
181 compatible = "brcm,bcm2835";
189 + status = "disabled";
194 target = <&uart0_pins>;
212 target-path = "/aliases";
214 serial0 = "/soc/serial@7e201000";
215 --- a/arch/arm/boot/dts/overlays/miniuart-bt-overlay.dts
216 +++ b/arch/arm/boot/dts/overlays/miniuart-bt-overlay.dts
218 this overlay is used.
221 +#include <dt-bindings/gpio/gpio.h>
224 compatible = "brcm,bcm2835";
232 + status = "disabled";
239 pinctrl-names = "default";
246 target = <&uart0_pins>;
255 target = <&uart1_pins>;
266 fake_bt_cts: fake_bt_cts {
273 target-path = "/aliases";
275 serial0 = "/soc/serial@7e201000";
276 serial1 = "/soc/serial@7e215040";
281 + krnbt = <&minibt>,"status";