Skip to contentSkip to conversation

Add bluetooth support for Orange Pi 3

PATCH RESEND Superseded [email protected] 4 participants 15 messages Aug 23, 2019 – Oct 7, 2019

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

cover Add bluetooth support for Orange Pi 3

From: Ondrej Jirman <[email protected]>

(Resend to add missing lists, sorry for the noise.)

This series implements bluetooth support for Xunlong Orange Pi 3 board.

The board uses AP6256 WiFi/BT 5.0 chip.

Summary of changes:

- add more delay to let initialize the chip
- let the kernel detect firmware file path
- add new compatible and update dt-bindings
- update Orange Pi 3 / H6 DTS

Please take a look.

thank you and regards,
Ondrej Jirman

Ondrej Jirman (5):
dt-bindings: net: Add compatible for BCM4345C5 bluetooth device
bluetooth: bcm: Add support for loading firmware for BCM4345C5
bluetooth: hci_bcm: Give more time to come out of reset
arm64: dts: allwinner: h6: Add pin configs for uart1
arm64: dts: allwinner: orange-pi-3: Enable UART1 / Bluetooth

 .../bindings/net/broadcom-bluetooth.txt       |  1 +
 .../dts/allwinner/sun50i-h6-orangepi-3.dts    | 19 +++++++++++++++++++
 arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi  | 10 ++++++++++
 drivers/bluetooth/btbcm.c                     |  3 +++
 drivers/bluetooth/hci_bcm.c                   |  3 ++-
 5 files changed, 35 insertions(+), 1 deletion(-)
Signature · 1 line
2.23.0
#1 lore raw

PATCH RESEND 1/5 dt-bindings: net: Add compatible for BCM4345C5 bluetooth device

From: Ondrej Jirman <[email protected]>

This is present in the AP6526 WiFi/Bluetooth 5.0 module.

---
 Documentation/devicetree/bindings/net/broadcom-bluetooth.txt | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/net/broadcom-bluetooth.txt +1 -0
index c26f4e11037c..4fa00e2eafcf 100644
@@ -13,6 +13,7 @@ Required properties:
    * "brcm,bcm20702a1"
    * "brcm,bcm4330-bt"
    * "brcm,bcm43438-bt"
+   * "brcm,bcm4345c5"
 
 Optional properties:
 
Signature · 1 line
2.23.0
maintainer Acked-by on v1 1/5
#2 lore raw

Re: [RESEND PATCH 1/5] dt-bindings: net: Add compatible for BCM4345C5 bluetooth device

Quoted 9 lines · On Fri, 23 Aug 2019 12:31:35 +0200, [email protected] wrote:

From: Ondrej Jirman <[email protected]>

This is present in the AP6526 WiFi/Bluetooth 5.0 module.

---
 Documentation/devicetree/bindings/net/broadcom-bluetooth.txt | 1 +
 1 file changed, 1 insertion(+)
#3 lore raw

PATCH RESEND 2/5 bluetooth: bcm: Add support for loading firmware for BCM4345C5

In reply to [email protected]

From: Ondrej Jirman <[email protected]>

Detect BCM4345C5 and load a corresponding firmware file.

---
Checkpatch reports a spurious error.

 drivers/bluetooth/btbcm.c   | 3 +++
 drivers/bluetooth/hci_bcm.c | 1 +
 2 files changed, 4 insertions(+)
drivers/bluetooth/btbcm.c +3 -0
index 124ef0a3e1dd..2d2e6d862068 100644
@@ -23,6 +23,7 @@
 #define BDADDR_BCM43430A0 (&(bdaddr_t) {{0xac, 0x1f, 0x12, 0xa0, 0x43, 0x43}})
 #define BDADDR_BCM4324B3 (&(bdaddr_t) {{0x00, 0x00, 0x00, 0xb3, 0x24, 0x43}})
 #define BDADDR_BCM4330B1 (&(bdaddr_t) {{0x00, 0x00, 0x00, 0xb1, 0x30, 0x43}})
+#define BDADDR_BCM4345C5 (&(bdaddr_t) {{0xac, 0x1f, 0x00, 0xc5, 0x45, 0x43}})
 #define BDADDR_BCM43341B (&(bdaddr_t) {{0xac, 0x1f, 0x00, 0x1b, 0x34, 0x43}})
 
 int btbcm_check_bdaddr(struct hci_dev *hdev)
@@ -73,6 +74,7 @@ int btbcm_check_bdaddr(struct hci_dev *hdev)
 	    !bacmp(&bda->bdaddr, BDADDR_BCM2076B1) ||
 	    !bacmp(&bda->bdaddr, BDADDR_BCM4324B3) ||
 	    !bacmp(&bda->bdaddr, BDADDR_BCM4330B1) ||
+	    !bacmp(&bda->bdaddr, BDADDR_BCM4345C5) ||
 	    !bacmp(&bda->bdaddr, BDADDR_BCM43430A0) ||
 	    !bacmp(&bda->bdaddr, BDADDR_BCM43341B)) {
 		bt_dev_info(hdev, "BCM: Using default device address (%pMR)",
@@ -332,6 +334,7 @@ static const struct bcm_subver_table bcm_uart_subver_table[] = {
 	{ 0x2122, "BCM4343A0"	},	/* 001.001.034 */
 	{ 0x2209, "BCM43430A1"  },	/* 001.002.009 */
 	{ 0x6119, "BCM4345C0"	},	/* 003.001.025 */
+	{ 0x6606, "BCM4345C5"	},	/* 003.006.006 */
 	{ 0x230f, "BCM4356A2"	},	/* 001.003.015 */
 	{ 0x220e, "BCM20702A1"  },	/* 001.002.014 */
 	{ 0x4217, "BCM4329B1"   },	/* 002.002.023 */
drivers/bluetooth/hci_bcm.c +1 -0
index 4d9de20bab7b..95c312ae94cf 100644
@@ -1419,6 +1419,7 @@ static void bcm_serdev_remove(struct serdev_device *serdev)
 #ifdef CONFIG_OF
 static const struct of_device_id bcm_bluetooth_of_match[] = {
 	{ .compatible = "brcm,bcm20702a1" },
+	{ .compatible = "brcm,bcm4345c5" },
 	{ .compatible = "brcm,bcm4330-bt" },
 	{ .compatible = "brcm,bcm43438-bt" },
 	{ },
Signature · 1 line
2.23.0
#4 lore raw

PATCH RESEND 3/5 bluetooth: hci_bcm: Give more time to come out of reset

In reply to [email protected]

From: Ondrej Jirman <[email protected]>

Some supported devices need more time to come out of reset (eg. BCM4345C5 in AP6256).

I don't have/found a datasheet, so the value was arrive at experimentally with the Oprange Pi 3 board. Without increased delay, I got intermittent failures during probe. This is a Bluetooth 5.0 device, so maybe that's why it takes longer to initialize than the others.

---
 drivers/bluetooth/hci_bcm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bluetooth/hci_bcm.c +1 -1
index 95c312ae94cf..7646636f2d18 100644
@@ -260,7 +260,7 @@ static int bcm_gpio_set_power(struct bcm_device *dev, bool powered)
 	}
 
 	/* wait for device to power on and come out of reset */
-	usleep_range(10000, 20000);
+	usleep_range(100000, 120000);
 
 	dev->res_enabled = powered;
 
Signature · 1 line
2.23.0
#5 lore raw

PATCH RESEND 4/5 arm64: dts: allwinner: h6: Add pin configs for uart1

In reply to [email protected]

From: Ondrej Jirman <[email protected]>

Orange Pi 3 uses UART1 for bluetooth. Add pinconfigs so that we can use them.

---
 arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi +10 -0
index 67f920e0fc33..7657e816096b 100644
@@ -298,6 +298,16 @@
 				pins = "PH0", "PH1";
 				function = "uart0";
 			};
+
+			uart1_pins: uart1-pins {
+				pins = "PG6", "PG7";
+				function = "uart1";
+			};
+
+			uart1_rts_cts_pins: uart1-rts-cts-pins {
+				pins = "PG8", "PG9";
+				function = "uart1";
+			};
 		};
 
 		gic: interrupt-controller@3021000 {
Signature · 1 line
2.23.0
#6 lore raw

PATCH RESEND 5/5 arm64: dts: allwinner: orange-pi-3: Enable UART1 / Bluetooth

In reply to [email protected]

From: Ondrej Jirman <[email protected]>

The board contains AP6256 WiFi/BT module that has its bluetooth part connected to SoC's UART1 port. Enable this port, and add node for the bluetooth device.

Bluetooth part is named bcm4345c5.

You'll need a BCM4345C5.hcd firmware file that can be found in the Xulongs's repository for H6:

https://github.com/orangepi-xunlong/OrangePiH6_external/tree/master/ap6256

The driver expects the firmware at the following path relative to the firmware directory:

brcm/BCM4345C5.hcd

---
 .../dts/allwinner/sun50i-h6-orangepi-3.dts    | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts +19 -0
index 49d954369087..a9e776446c35 100644
@@ -15,6 +15,7 @@
 
 	aliases {
 		serial0 = &uart0;
+		serial1 = &uart1;
 	};
 
 	chosen {
@@ -271,6 +272,24 @@
 	status = "okay";
 };
 
+/* There's the BT part of the AP6256 connected to that UART */
+&uart1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
+	uart-has-rtscts;
+	status = "okay";
+
+	bluetooth {
+		compatible = "brcm,bcm4345c5";
+		clocks = <&rtc 1>;
+		clock-names = "lpo";
+		device-wakeup-gpios = <&r_pio 1 2 GPIO_ACTIVE_HIGH>; /* PM2 */
+		host-wakeup-gpios = <&r_pio 1 1 GPIO_ACTIVE_HIGH>; /* PM1 */
+		shutdown-gpios = <&r_pio 1 4 GPIO_ACTIVE_HIGH>; /* PM4 */
+		max-speed = <1500000>;
+	};
+};
+
 &usb2otg {
 	/*
 	 * This board doesn't have a controllable VBUS even though it
Signature · 1 line
2.23.0
maintainer
#7 lore raw
In reply to [email protected]

Hi Ondrej,

Quoted 25 lines

(Resend to add missing lists, sorry for the noise.)

This series implements bluetooth support for Xunlong Orange Pi 3 board.

The board uses AP6256 WiFi/BT 5.0 chip.

Summary of changes:

- add more delay to let initialize the chip
- let the kernel detect firmware file path
- add new compatible and update dt-bindings
- update Orange Pi 3 / H6 DTS

Please take a look.

thank you and regards,
Ondrej Jirman

Ondrej Jirman (5):
dt-bindings: net: Add compatible for BCM4345C5 bluetooth device
bluetooth: bcm: Add support for loading firmware for BCM4345C5
bluetooth: hci_bcm: Give more time to come out of reset
arm64: dts: allwinner: h6: Add pin configs for uart1
arm64: dts: allwinner: orange-pi-3: Enable UART1 / Bluetooth

Quoted 6 lines
.../bindings/net/broadcom-bluetooth.txt       |  1 +
.../dts/allwinner/sun50i-h6-orangepi-3.dts    | 19 +++++++++++++++++++
arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi  | 10 ++++++++++
drivers/bluetooth/btbcm.c                     |  3 +++
drivers/bluetooth/hci_bcm.c                   |  3 ++-
5 files changed, 35 insertions(+), 1 deletion(-)

all 5 patches have been applied to bluetooth-next tree.

Regards

Marcel

#8 lore raw

Hi Marcel,

Quoted 25 lines · Marcel Holtmann
Quoted 25 lines

(Resend to add missing lists, sorry for the noise.)

This series implements bluetooth support for Xunlong Orange Pi 3 board.

The board uses AP6256 WiFi/BT 5.0 chip.

Summary of changes:

- add more delay to let initialize the chip
- let the kernel detect firmware file path
- add new compatible and update dt-bindings
- update Orange Pi 3 / H6 DTS

Please take a look.

thank you and regards,
Ondrej Jirman

Ondrej Jirman (5):
dt-bindings: net: Add compatible for BCM4345C5 bluetooth device
bluetooth: bcm: Add support for loading firmware for BCM4345C5
bluetooth: hci_bcm: Give more time to come out of reset
arm64: dts: allwinner: h6: Add pin configs for uart1
arm64: dts: allwinner: orange-pi-3: Enable UART1 / Bluetooth

Quoted 8 lines
Quoted 6 lines
.../bindings/net/broadcom-bluetooth.txt       |  1 +
.../dts/allwinner/sun50i-h6-orangepi-3.dts    | 19 +++++++++++++++++++
arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi  | 10 ++++++++++
drivers/bluetooth/btbcm.c                     |  3 +++
drivers/bluetooth/hci_bcm.c                   |  3 ++-
5 files changed, 35 insertions(+), 1 deletion(-)

all 5 patches have been applied to bluetooth-next tree.

The DTS patches (last 2) should go through the arm-soc tree, can you drop them?

Thanks!
Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

maintainer
#9 lore raw

Hi Maxime,

Quoted 32 lines
Quoted 32 lines
Quoted 31 lines

(Resend to add missing lists, sorry for the noise.)

This series implements bluetooth support for Xunlong Orange Pi 3 board.

The board uses AP6256 WiFi/BT 5.0 chip.

Summary of changes:

- add more delay to let initialize the chip
- let the kernel detect firmware file path
- add new compatible and update dt-bindings
- update Orange Pi 3 / H6 DTS

Please take a look.

thank you and regards,
Ondrej Jirman

Ondrej Jirman (5):
dt-bindings: net: Add compatible for BCM4345C5 bluetooth device
bluetooth: bcm: Add support for loading firmware for BCM4345C5
bluetooth: hci_bcm: Give more time to come out of reset
arm64: dts: allwinner: h6: Add pin configs for uart1
arm64: dts: allwinner: orange-pi-3: Enable UART1 / Bluetooth

.../bindings/net/broadcom-bluetooth.txt       |  1 +
.../dts/allwinner/sun50i-h6-orangepi-3.dts    | 19 +++++++++++++++++++
arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi  | 10 ++++++++++
drivers/bluetooth/btbcm.c                     |  3 +++
drivers/bluetooth/hci_bcm.c                   |  3 ++-
5 files changed, 35 insertions(+), 1 deletion(-)
Quoted 4 lines
Quoted 1 line

all 5 patches have been applied to bluetooth-next tree.

The DTS patches (last 2) should go through the arm-soc tree, can you drop them?

why is that? We have included DTS changes for Bluetooth devices directly all the time. What is different with this hardware?

Regards

Marcel

#10 lore raw
Quoted 32 lines · Marcel Holtmann
Quoted 32 lines
Quoted 32 lines
Quoted 31 lines

(Resend to add missing lists, sorry for the noise.)

This series implements bluetooth support for Xunlong Orange Pi 3 board.

The board uses AP6256 WiFi/BT 5.0 chip.

Summary of changes:

- add more delay to let initialize the chip
- let the kernel detect firmware file path
- add new compatible and update dt-bindings
- update Orange Pi 3 / H6 DTS

Please take a look.

thank you and regards,
Ondrej Jirman

Ondrej Jirman (5):
dt-bindings: net: Add compatible for BCM4345C5 bluetooth device
bluetooth: bcm: Add support for loading firmware for BCM4345C5
bluetooth: hci_bcm: Give more time to come out of reset
arm64: dts: allwinner: h6: Add pin configs for uart1
arm64: dts: allwinner: orange-pi-3: Enable UART1 / Bluetooth

.../bindings/net/broadcom-bluetooth.txt       |  1 +
.../dts/allwinner/sun50i-h6-orangepi-3.dts    | 19 +++++++++++++++++++
arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi  | 10 ++++++++++
drivers/bluetooth/btbcm.c                     |  3 +++
drivers/bluetooth/hci_bcm.c                   |  3 ++-
5 files changed, 35 insertions(+), 1 deletion(-)
Quoted 7 lines
Quoted 4 lines
Quoted 1 line

all 5 patches have been applied to bluetooth-next tree.

The DTS patches (last 2) should go through the arm-soc tree, can you drop them?

why is that? We have included DTS changes for Bluetooth devices directly all the time. What is different with this hardware?

I guess some maintainers are more relaxed with it than we are then, but for the why, well, it's the usual reasons, the most immediate one being that it reduces to a minimum the conflicts between trees.

The other being that it's not really usual to merge patches supposed to be handled by another maintainer without (at least) his consent. I'm pretty sure you would have asked the same request if I would have merged the bluetooth patches through my tree without notice.

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

maintainer
#11 lore raw

Hi Maxime,

Quoted 44 lines
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 31 lines

(Resend to add missing lists, sorry for the noise.)

This series implements bluetooth support for Xunlong Orange Pi 3 board.

The board uses AP6256 WiFi/BT 5.0 chip.

Summary of changes:

- add more delay to let initialize the chip
- let the kernel detect firmware file path
- add new compatible and update dt-bindings
- update Orange Pi 3 / H6 DTS

Please take a look.

thank you and regards,
Ondrej Jirman

Ondrej Jirman (5):
dt-bindings: net: Add compatible for BCM4345C5 bluetooth device
bluetooth: bcm: Add support for loading firmware for BCM4345C5
bluetooth: hci_bcm: Give more time to come out of reset
arm64: dts: allwinner: h6: Add pin configs for uart1
arm64: dts: allwinner: orange-pi-3: Enable UART1 / Bluetooth

.../bindings/net/broadcom-bluetooth.txt       |  1 +
.../dts/allwinner/sun50i-h6-orangepi-3.dts    | 19 +++++++++++++++++++
arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi  | 10 ++++++++++
drivers/bluetooth/btbcm.c                     |  3 +++
drivers/bluetooth/hci_bcm.c                   |  3 ++-
5 files changed, 35 insertions(+), 1 deletion(-)
Quoted 7 lines
Quoted 4 lines
Quoted 1 line

all 5 patches have been applied to bluetooth-next tree.

The DTS patches (last 2) should go through the arm-soc tree, can you drop them?

why is that? We have included DTS changes for Bluetooth devices directly all the time. What is different with this hardware?

I guess some maintainers are more relaxed with it than we are then, but for the why, well, it's the usual reasons, the most immediate one being that it reduces to a minimum the conflicts between trees.

Quoted 5 lines

The other being that it's not really usual to merge patches supposed to be handled by another maintainer without (at least) his consent. I'm pretty sure you would have asked the same request if I would have merged the bluetooth patches through my tree without notice.

I took the two DTS patches out now and let the submitter deal with getting these merged.

Regards

Marcel

#12 lore raw
Quoted 46 lines · Marcel Holtmann

Hi Maxime,

Quoted 44 lines
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Quoted 31 lines

(Resend to add missing lists, sorry for the noise.)

This series implements bluetooth support for Xunlong Orange Pi 3 board.

The board uses AP6256 WiFi/BT 5.0 chip.

Summary of changes:

- add more delay to let initialize the chip
- let the kernel detect firmware file path
- add new compatible and update dt-bindings
- update Orange Pi 3 / H6 DTS

Please take a look.

thank you and regards,
Ondrej Jirman

Ondrej Jirman (5):
dt-bindings: net: Add compatible for BCM4345C5 bluetooth device
bluetooth: bcm: Add support for loading firmware for BCM4345C5
bluetooth: hci_bcm: Give more time to come out of reset
arm64: dts: allwinner: h6: Add pin configs for uart1
arm64: dts: allwinner: orange-pi-3: Enable UART1 / Bluetooth

.../bindings/net/broadcom-bluetooth.txt       |  1 +
.../dts/allwinner/sun50i-h6-orangepi-3.dts    | 19 +++++++++++++++++++
arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi  | 10 ++++++++++
drivers/bluetooth/btbcm.c                     |  3 +++
drivers/bluetooth/hci_bcm.c                   |  3 ++-
5 files changed, 35 insertions(+), 1 deletion(-)
Quoted 7 lines
Quoted 4 lines
Quoted 1 line

all 5 patches have been applied to bluetooth-next tree.

The DTS patches (last 2) should go through the arm-soc tree, can you drop them?

why is that? We have included DTS changes for Bluetooth devices directly all the time. What is different with this hardware?

I guess some maintainers are more relaxed with it than we are then, but for the why, well, it's the usual reasons, the most immediate one being that it reduces to a minimum the conflicts between trees.

Quoted 8 lines
Quoted 5 lines

The other being that it's not really usual to merge patches supposed to be handled by another maintainer without (at least) his consent. I'm pretty sure you would have asked the same request if I would have merged the bluetooth patches through my tree without notice.

I took the two DTS patches out now and let the submitter deal with getting these merged.

Thanks!
Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

#13 lore raw
In reply to [email protected]

Hi Maxime,

Quoted 6 lines · megous hlavni

From: Ondrej Jirman <[email protected]>

(Resend to add missing lists, sorry for the noise.)

This series implements bluetooth support for Xunlong Orange Pi 3 board.

Quoted 8 lines

The board uses AP6256 WiFi/BT 5.0 chip.

Summary of changes:

- add more delay to let initialize the chip
- let the kernel detect firmware file path
- add new compatible and update dt-bindings
- update Orange Pi 3 / H6 DTS

Please consider the DTS patches for 5.5.

Thanks,
Ondrej

Quoted 27 lines

Please take a look.

thank you and regards,
Ondrej Jirman

Ondrej Jirman (5):
dt-bindings: net: Add compatible for BCM4345C5 bluetooth device
bluetooth: bcm: Add support for loading firmware for BCM4345C5
bluetooth: hci_bcm: Give more time to come out of reset
arm64: dts: allwinner: h6: Add pin configs for uart1
arm64: dts: allwinner: orange-pi-3: Enable UART1 / Bluetooth

 .../bindings/net/broadcom-bluetooth.txt       |  1 +
 .../dts/allwinner/sun50i-h6-orangepi-3.dts    | 19 +++++++++++++++++++
 arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi  | 10 ++++++++++
 drivers/bluetooth/btbcm.c                     |  3 +++
 drivers/bluetooth/hci_bcm.c                   |  3 ++-
 5 files changed, 35 insertions(+), 1 deletion(-)
Signature · 7 lines
2.23.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#14 lore raw
Quoted 11 lines · Ondřej Jirman

Hi Maxime,

Quoted 8 lines · megous hlavni

From: Ondrej Jirman <[email protected]>

(Resend to add missing lists, sorry for the noise.)

This series implements bluetooth support for Xunlong Orange Pi 3 board.

The board uses AP6256 WiFi/BT 5.0 chip.

Quoted 8 lines
Quoted 6 lines

Summary of changes:

- add more delay to let initialize the chip
- let the kernel detect firmware file path
- add new compatible and update dt-bindings
- update Orange Pi 3 / H6 DTS

Please consider the DTS patches for 5.5.

Can you resend them? I don't have access to my old mailbox anymore

Maxime