mirror of
				https://github.com/Ysurac/openmptcprouter.git
				synced 2025-03-09 15:40:20 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			196 lines
		
	
	
	
		
			5.8 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			196 lines
		
	
	
	
		
			5.8 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
From a1d1f1d6905bbfaa0259fd9dac0bc9ee1e67c5c2 Mon Sep 17 00:00:00 2001
 | 
						|
From: Phil Elwell <phil@raspberrypi.com>
 | 
						|
Date: Tue, 14 Feb 2023 11:20:58 +0000
 | 
						|
Subject: [PATCH] ARM: dts: bcm27xx: Enable kernel Bluetooth
 | 
						|
 | 
						|
Change the base Device Tree files so that by default the kernel is
 | 
						|
responsible for initialisation of the onboard Bluetooth modems.
 | 
						|
Use dtparam=krnbt=off to revert to the old behaviour.
 | 
						|
 | 
						|
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
 | 
						|
---
 | 
						|
 arch/arm/boot/dts/bcm2708-rpi-bt.dtsi         | 18 ++++++++++++++---
 | 
						|
 arch/arm/boot/dts/bcm271x-rpi-bt.dtsi         | 18 ++++++++++++++---
 | 
						|
 arch/arm/boot/dts/overlays/README             | 11 ++++++++--
 | 
						|
 .../boot/dts/overlays/disable-bt-overlay.dts  |  7 +------
 | 
						|
 .../boot/dts/overlays/miniuart-bt-overlay.dts | 20 ++++++-------------
 | 
						|
 5 files changed, 46 insertions(+), 28 deletions(-)
 | 
						|
 | 
						|
--- a/arch/arm/boot/dts/bcm2708-rpi-bt.dtsi
 | 
						|
+++ b/arch/arm/boot/dts/bcm2708-rpi-bt.dtsi
 | 
						|
@@ -5,22 +5,34 @@
 | 
						|
 		compatible = "brcm,bcm43438-bt";
 | 
						|
 		max-speed = <3000000>;
 | 
						|
 		shutdown-gpios = <&gpio 45 GPIO_ACTIVE_HIGH>;
 | 
						|
-		status = "disabled";
 | 
						|
+		local-bd-address = [ 00 00 00 00 00 00 ];
 | 
						|
+		fallback-bd-address; // Don't override a valid address
 | 
						|
+		status = "okay";
 | 
						|
 	};
 | 
						|
 };
 | 
						|
 
 | 
						|
 &uart1 {
 | 
						|
 	minibt: bluetooth {
 | 
						|
 		compatible = "brcm,bcm43438-bt";
 | 
						|
-		max-speed = <460800>;
 | 
						|
+		max-speed = <230400>;
 | 
						|
 		shutdown-gpios = <&gpio 45 GPIO_ACTIVE_HIGH>;
 | 
						|
+		local-bd-address = [ 00 00 00 00 00 00 ];
 | 
						|
+		fallback-bd-address; // Don't override a valid address
 | 
						|
 		status = "disabled";
 | 
						|
 	};
 | 
						|
 };
 | 
						|
 
 | 
						|
 / {
 | 
						|
+	aliases {
 | 
						|
+		bluetooth = &bt;
 | 
						|
+	};
 | 
						|
+
 | 
						|
 	__overrides__ {
 | 
						|
+		bdaddr = <&bt>,"local-bd-address[",
 | 
						|
+		       <&bt>,"fallback-bd-address?=0",
 | 
						|
+		       <&minibt>,"local-bd-address[",
 | 
						|
+		       <&minibt>,"fallback-bd-address?=0";
 | 
						|
 		krnbt = <&bt>,"status";
 | 
						|
-		krnbt_baudrate = <&bt>,"max-speed:0";
 | 
						|
+		krnbt_baudrate = <&bt>,"max-speed:0", <&minibt>,"max-speed:0";
 | 
						|
 	};
 | 
						|
 };
 | 
						|
--- a/arch/arm/boot/dts/bcm271x-rpi-bt.dtsi
 | 
						|
+++ b/arch/arm/boot/dts/bcm271x-rpi-bt.dtsi
 | 
						|
@@ -5,22 +5,34 @@
 | 
						|
 		compatible = "brcm,bcm43438-bt";
 | 
						|
 		max-speed = <3000000>;
 | 
						|
 		shutdown-gpios = <&expgpio 0 GPIO_ACTIVE_HIGH>;
 | 
						|
-		status = "disabled";
 | 
						|
+		local-bd-address = [ 00 00 00 00 00 00 ];
 | 
						|
+		fallback-bd-address; // Don't override a valid address
 | 
						|
+		status = "okay";
 | 
						|
 	};
 | 
						|
 };
 | 
						|
 
 | 
						|
 &uart1 {
 | 
						|
 	minibt: bluetooth {
 | 
						|
 		compatible = "brcm,bcm43438-bt";
 | 
						|
-		max-speed = <460800>;
 | 
						|
+		max-speed = <230400>;
 | 
						|
 		shutdown-gpios = <&expgpio 0 GPIO_ACTIVE_HIGH>;
 | 
						|
+		local-bd-address = [ 00 00 00 00 00 00 ];
 | 
						|
+		fallback-bd-address; // Don't override a valid address
 | 
						|
 		status = "disabled";
 | 
						|
 	};
 | 
						|
 };
 | 
						|
 
 | 
						|
 / {
 | 
						|
+	aliases {
 | 
						|
+		bluetooth = &bt;
 | 
						|
+	};
 | 
						|
+
 | 
						|
 	__overrides__ {
 | 
						|
+		bdaddr = <&bt>,"local-bd-address[",
 | 
						|
+		       <&bt>,"fallback-bd-address?=0",
 | 
						|
+		       <&minibt>,"local-bd-address[",
 | 
						|
+		       <&minibt>,"fallback-bd-address?=0";
 | 
						|
 		krnbt = <&bt>,"status";
 | 
						|
-		krnbt_baudrate = <&bt>,"max-speed:0";
 | 
						|
+		krnbt_baudrate = <&bt>,"max-speed:0", <&minibt>,"max-speed:0";
 | 
						|
 	};
 | 
						|
 };
 | 
						|
--- a/arch/arm/boot/dts/overlays/README
 | 
						|
+++ b/arch/arm/boot/dts/overlays/README
 | 
						|
@@ -144,6 +144,13 @@ Params:
 | 
						|
                                 See /sys/kernel/debug/raspberrypi_axi_monitor
 | 
						|
                                 for the results.
 | 
						|
 
 | 
						|
+        bdaddr                  Set an alternative Bluetooth address (BDADDR).
 | 
						|
+                                The value should be a 6-byte hexadecimal value,
 | 
						|
+                                with or without colon separators, written least-
 | 
						|
+                                significant-byte first. For example,
 | 
						|
+                                bdaddr=06:05:04:03:02:01
 | 
						|
+                                will set the BDADDR to 01:02:03:04:05:06.
 | 
						|
+
 | 
						|
         cam0_reg                Enables CAM 0 regulator.
 | 
						|
                                 Only required on CM1 & 3.
 | 
						|
 
 | 
						|
@@ -219,9 +226,9 @@ Params:
 | 
						|
         i2s                     Set to "on" to enable the i2s interface
 | 
						|
                                 (default "off")
 | 
						|
 
 | 
						|
-        krnbt                   Set to "on" to enable autoprobing of Bluetooth
 | 
						|
+        krnbt                   Set to "off" to disable autoprobing of Bluetooth
 | 
						|
                                 driver without need of hciattach/btattach
 | 
						|
-                                (default "off")
 | 
						|
+                                (default "on")
 | 
						|
 
 | 
						|
         krnbt_baudrate          Set the baudrate of the PL011 UART when used
 | 
						|
                                 with krnbt=on
 | 
						|
--- a/arch/arm/boot/dts/overlays/disable-bt-overlay.dts
 | 
						|
+++ b/arch/arm/boot/dts/overlays/disable-bt-overlay.dts
 | 
						|
@@ -1,12 +1,7 @@
 | 
						|
 /dts-v1/;
 | 
						|
 /plugin/;
 | 
						|
 
 | 
						|
-/* Disable Bluetooth and restore UART0/ttyAMA0 over GPIOs 14 & 15.
 | 
						|
-   To disable the systemd service that initialises the modem so it doesn't use
 | 
						|
-   the UART:
 | 
						|
-
 | 
						|
-       sudo systemctl disable hciuart
 | 
						|
-*/
 | 
						|
+/* Disable Bluetooth and restore UART0/ttyAMA0 over GPIOs 14 & 15. */
 | 
						|
 
 | 
						|
 #include <dt-bindings/gpio/gpio.h>
 | 
						|
 
 | 
						|
--- a/arch/arm/boot/dts/overlays/miniuart-bt-overlay.dts
 | 
						|
+++ b/arch/arm/boot/dts/overlays/miniuart-bt-overlay.dts
 | 
						|
@@ -40,7 +40,7 @@
 | 
						|
 		target = <&uart1>;
 | 
						|
 		__overlay__ {
 | 
						|
 			pinctrl-names = "default";
 | 
						|
-			pinctrl-0 = <&uart1_pins &bt_pins &fake_bt_cts>;
 | 
						|
+			pinctrl-0 = <&uart1_pins>;
 | 
						|
 			status = "okay";
 | 
						|
 		};
 | 
						|
 	};
 | 
						|
@@ -57,23 +57,13 @@
 | 
						|
 	fragment@4 {
 | 
						|
 		target = <&uart1_pins>;
 | 
						|
 		__overlay__ {
 | 
						|
-			brcm,pins = <32 33>;
 | 
						|
+			brcm,pins = <32 33 30 31>;
 | 
						|
 			brcm,function = <2>; /* alt5=UART1 */
 | 
						|
-			brcm,pull = <0 2>;
 | 
						|
+			brcm,pull = <0 2 2 0>;
 | 
						|
 		};
 | 
						|
 	};
 | 
						|
 
 | 
						|
 	fragment@5 {
 | 
						|
-		target = <&gpio>;
 | 
						|
-		__overlay__ {
 | 
						|
-			fake_bt_cts: fake_bt_cts {
 | 
						|
-				brcm,pins = <31>;
 | 
						|
-				brcm,function = <1>; /* output */
 | 
						|
-			};
 | 
						|
-		};
 | 
						|
-	};
 | 
						|
-
 | 
						|
-	fragment@6 {
 | 
						|
 		target-path = "/aliases";
 | 
						|
 		__overlay__ {
 | 
						|
 			serial0 = "/soc/serial@7e201000";
 | 
						|
@@ -81,13 +71,15 @@
 | 
						|
 		};
 | 
						|
 	};
 | 
						|
 
 | 
						|
-	fragment@7 {
 | 
						|
+	fragment@6 {
 | 
						|
 		target = <&minibt>;
 | 
						|
 		minibt_frag: __overlay__ {
 | 
						|
+			status = "okay";
 | 
						|
 		};
 | 
						|
 	};
 | 
						|
 
 | 
						|
 	__overrides__ {
 | 
						|
 		krnbt = <&minibt_frag>,"status";
 | 
						|
+		krnbt_baudrate = <&minibt_frag>,"max-speed:0";
 | 
						|
 	};
 | 
						|
 };
 |