Skip to content

Commit 856dd81

Browse files
gentoo-rootpelwell
authored andcommitted
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 <[email protected]>
1 parent a3703e6 commit 856dd81

File tree

9 files changed

+94
-10
lines changed

9 files changed

+94
-10
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
3+
&uart0 {
4+
bt: bluetooth {
5+
compatible = "brcm,bcm43438-bt";
6+
max-speed = <3000000>;
7+
shutdown-gpios = <&gpio 45 GPIO_ACTIVE_HIGH>;
8+
status = "disabled";
9+
};
10+
};
11+
12+
&uart1 {
13+
minibt: bluetooth {
14+
compatible = "brcm,bcm43438-bt";
15+
max-speed = <460800>;
16+
shutdown-gpios = <&gpio 45 GPIO_ACTIVE_HIGH>;
17+
status = "disabled";
18+
};
19+
};
20+
21+
/ {
22+
__overrides__ {
23+
krnbt = <&bt>,"status";
24+
krnbt_baudrate = <&bt>,"max-speed:0";
25+
};
26+
};

arch/arm/boot/dts/bcm2708-rpi-zero-w.dts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "bcm2708-rpi.dtsi"
55
#include "bcm283x-rpi-csi1-2lane.dtsi"
66
#include "bcm283x-rpi-i2c0mux_0_28.dtsi"
7+
#include "bcm2708-rpi-bt.dtsi"
78

89
/ {
910
compatible = "raspberrypi,model-zero-w", "brcm,bcm2835";

arch/arm/boot/dts/bcm2710-rpi-3-b-plus.dts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "bcm283x-rpi-lan7515.dtsi"
66
#include "bcm283x-rpi-csi1-2lane.dtsi"
77
#include "bcm283x-rpi-i2c0mux_0_44.dtsi"
8+
#include "bcm271x-rpi-bt.dtsi"
89

910
/ {
1011
compatible = "raspberrypi,3-model-b-plus", "brcm,bcm2837";

arch/arm/boot/dts/bcm2710-rpi-3-b.dts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "bcm283x-rpi-smsc9514.dtsi"
66
#include "bcm283x-rpi-csi1-2lane.dtsi"
77
#include "bcm283x-rpi-i2c0mux_0_44.dtsi"
8+
#include "bcm271x-rpi-bt.dtsi"
89

910
/ {
1011
compatible = "raspberrypi,3-model-b", "brcm,bcm2837";

arch/arm/boot/dts/bcm2711-rpi-4-b.dts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@
219219
// Downstream rpi- changes
220220

221221
#include "bcm270x.dtsi"
222+
#include "bcm271x-rpi-bt.dtsi"
222223

223224
/ {
224225
soc {
@@ -287,8 +288,6 @@
287288
&uart0 {
288289
pinctrl-0 = <&uart0_pins &bt_pins>;
289290
status = "okay";
290-
291-
/delete-node/ bluetooth;
292291
};
293292

294293
&uart1 {
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
3+
&uart0 {
4+
bt: bluetooth {
5+
compatible = "brcm,bcm43438-bt";
6+
max-speed = <3000000>;
7+
shutdown-gpios = <&expgpio 0 GPIO_ACTIVE_HIGH>;
8+
status = "disabled";
9+
};
10+
};
11+
12+
&uart1 {
13+
minibt: bluetooth {
14+
compatible = "brcm,bcm43438-bt";
15+
max-speed = <460800>;
16+
shutdown-gpios = <&expgpio 0 GPIO_ACTIVE_HIGH>;
17+
status = "disabled";
18+
};
19+
};
20+
21+
/ {
22+
__overrides__ {
23+
krnbt = <&bt>,"status";
24+
krnbt_baudrate = <&bt>,"max-speed:0";
25+
};
26+
};

arch/arm/boot/dts/overlays/README

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,13 @@ Params:
162162
i2s Set to "on" to enable the i2s interface
163163
(default "off")
164164

165+
krnbt Set to "on" to enable autoprobing of Bluetooth
166+
driver without need of hciattach/btattach
167+
(default "off")
168+
169+
krnbt_baudrate Set the baudrate of the PL011 UART when used
170+
with krnbt=on
171+
165172
spi Set to "on" to enable the spi interfaces
166173
(default "off")
167174

@@ -1748,8 +1755,9 @@ Info: Switch the onboard Bluetooth function on Pi 3B, 3B+, 3A+, 4B and Zero W
17481755
in which case use /dev/serial1 instead because it will always be
17491756
correct. Furthermore, you must also set core_freq and core_freq_min to
17501757
the same value in config.txt or the miniuart will not work.
1751-
Load: dtoverlay=miniuart-bt
1752-
Params: <None>
1758+
Load: dtoverlay=miniuart-bt,<param>=<val>
1759+
Params: krnbt Set to "on" to enable autoprobing of Bluetooth
1760+
driver without need of hciattach/btattach
17531761

17541762

17551763
Name: mmc

arch/arm/boot/dts/overlays/disable-bt-overlay.dts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
sudo systemctl disable hciuart
99
*/
1010

11+
#include <dt-bindings/gpio/gpio.h>
12+
1113
/{
1214
compatible = "brcm,bcm2835";
1315

@@ -28,6 +30,13 @@
2830
};
2931

3032
fragment@2 {
33+
target = <&bt>;
34+
__overlay__ {
35+
status = "disabled";
36+
};
37+
};
38+
39+
fragment@3 {
3140
target = <&uart0_pins>;
3241
__overlay__ {
3342
brcm,pins;
@@ -36,7 +45,7 @@
3645
};
3746
};
3847

39-
fragment@3 {
48+
fragment@4 {
4049
target = <&bt_pins>;
4150
__overlay__ {
4251
brcm,pins;
@@ -45,7 +54,7 @@
4554
};
4655
};
4756

48-
fragment@4 {
57+
fragment@5 {
4958
target-path = "/aliases";
5059
__overlay__ {
5160
serial0 = "/soc/serial@7e201000";

arch/arm/boot/dts/overlays/miniuart-bt-overlay.dts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
this overlay is used.
1616
*/
1717

18+
#include <dt-bindings/gpio/gpio.h>
19+
1820
/{
1921
compatible = "brcm,bcm2835";
2022

@@ -28,6 +30,13 @@
2830
};
2931

3032
fragment@1 {
33+
target = <&bt>;
34+
__overlay__ {
35+
status = "disabled";
36+
};
37+
};
38+
39+
fragment@2 {
3140
target = <&uart1>;
3241
__overlay__ {
3342
pinctrl-names = "default";
@@ -36,7 +45,7 @@
3645
};
3746
};
3847

39-
fragment@2 {
48+
fragment@3 {
4049
target = <&uart0_pins>;
4150
__overlay__ {
4251
brcm,pins;
@@ -45,7 +54,7 @@
4554
};
4655
};
4756

48-
fragment@3 {
57+
fragment@4 {
4958
target = <&uart1_pins>;
5059
__overlay__ {
5160
brcm,pins = <32 33>;
@@ -54,7 +63,7 @@
5463
};
5564
};
5665

57-
fragment@4 {
66+
fragment@5 {
5867
target = <&gpio>;
5968
__overlay__ {
6069
fake_bt_cts: fake_bt_cts {
@@ -64,11 +73,15 @@
6473
};
6574
};
6675

67-
fragment@5 {
76+
fragment@6 {
6877
target-path = "/aliases";
6978
__overlay__ {
7079
serial0 = "/soc/serial@7e201000";
7180
serial1 = "/soc/serial@7e215040";
7281
};
7382
};
83+
84+
__overrides__ {
85+
krnbt = <&minibt>,"status";
86+
};
7487
};

0 commit comments

Comments
 (0)