Skip to content

Commit

Permalink
ARM: dts: Add Bluetooth nodes for Raspberry Pi
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
gentoo-root authored and pelwell committed Jul 1, 2020
1 parent a3703e6 commit 856dd81
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 10 deletions.
26 changes: 26 additions & 0 deletions arch/arm/boot/dts/bcm2708-rpi-bt.dtsi
Original file line number Diff line number Diff line change
@@ -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";
};
};
1 change: 1 addition & 0 deletions arch/arm/boot/dts/bcm2708-rpi-zero-w.dts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
1 change: 1 addition & 0 deletions arch/arm/boot/dts/bcm2710-rpi-3-b-plus.dts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
1 change: 1 addition & 0 deletions arch/arm/boot/dts/bcm2710-rpi-3-b.dts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
3 changes: 1 addition & 2 deletions arch/arm/boot/dts/bcm2711-rpi-4-b.dts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@
// Downstream rpi- changes

#include "bcm270x.dtsi"
#include "bcm271x-rpi-bt.dtsi"

/ {
soc {
Expand Down Expand Up @@ -287,8 +288,6 @@
&uart0 {
pinctrl-0 = <&uart0_pins &bt_pins>;
status = "okay";

/delete-node/ bluetooth;
};

&uart1 {
Expand Down
26 changes: 26 additions & 0 deletions arch/arm/boot/dts/bcm271x-rpi-bt.dtsi
Original file line number Diff line number Diff line change
@@ -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";
};
};
12 changes: 10 additions & 2 deletions arch/arm/boot/dts/overlays/README
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -1748,8 +1755,9 @@ Info: Switch the onboard Bluetooth function on Pi 3B, 3B+, 3A+, 4B and Zero W
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
Expand Down
13 changes: 11 additions & 2 deletions arch/arm/boot/dts/overlays/disable-bt-overlay.dts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
sudo systemctl disable hciuart
*/

#include <dt-bindings/gpio/gpio.h>

/{
compatible = "brcm,bcm2835";

Expand All @@ -28,6 +30,13 @@
};

fragment@2 {
target = <&bt>;
__overlay__ {
status = "disabled";
};
};

fragment@3 {
target = <&uart0_pins>;
__overlay__ {
brcm,pins;
Expand All @@ -36,7 +45,7 @@
};
};

fragment@3 {
fragment@4 {
target = <&bt_pins>;
__overlay__ {
brcm,pins;
Expand All @@ -45,7 +54,7 @@
};
};

fragment@4 {
fragment@5 {
target-path = "/aliases";
__overlay__ {
serial0 = "/soc/serial@7e201000";
Expand Down
21 changes: 17 additions & 4 deletions arch/arm/boot/dts/overlays/miniuart-bt-overlay.dts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
this overlay is used.
*/

#include <dt-bindings/gpio/gpio.h>

/{
compatible = "brcm,bcm2835";

Expand All @@ -28,6 +30,13 @@
};

fragment@1 {
target = <&bt>;
__overlay__ {
status = "disabled";
};
};

fragment@2 {
target = <&uart1>;
__overlay__ {
pinctrl-names = "default";
Expand All @@ -36,7 +45,7 @@
};
};

fragment@2 {
fragment@3 {
target = <&uart0_pins>;
__overlay__ {
brcm,pins;
Expand All @@ -45,7 +54,7 @@
};
};

fragment@3 {
fragment@4 {
target = <&uart1_pins>;
__overlay__ {
brcm,pins = <32 33>;
Expand All @@ -54,7 +63,7 @@
};
};

fragment@4 {
fragment@5 {
target = <&gpio>;
__overlay__ {
fake_bt_cts: fake_bt_cts {
Expand All @@ -64,11 +73,15 @@
};
};

fragment@5 {
fragment@6 {
target-path = "/aliases";
__overlay__ {
serial0 = "/soc/serial@7e201000";
serial1 = "/soc/serial@7e215040";
};
};

__overrides__ {
krnbt = <&minibt>,"status";
};
};

0 comments on commit 856dd81

Please sign in to comment.