mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] Bluetooth for the RTL8852BS on BPI-F3
@ 2026-11-10  7:46 Frédéric Mahé
  2026-11-10  7:46 ` [PATCH 1/2] dt-bindings: net: bluetooth: realtek: Add RTL8852BS Frédéric Mahé
  2026-11-10  7:46 ` [PATCH 2/2] riscv: dts: spacemit: enable Bluetooth on BPI-F3 Frédéric Mahé
  0 siblings, 2 replies; 5+ messages in thread
From: Frédéric Mahé @ 2026-11-10  7:46 UTC (permalink / raw)
  To: Marcel Holtmann, Luiz Augusto von Dentz, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Yixun Lan
  Cc: Vasily Khoruzhick, Alistair Francis, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Troy Mitchell,
	linux-bluetooth, devicetree, linux-riscv, spacemit, linux-kernel,
	Frédéric Mahé

The BPI-F3 (SpacemiT K1) carries an RTL8852BS Wi-Fi + Bluetooth module.
Wi-Fi (SDIO) has no upstream driver, but Bluetooth on UART works with
the existing hci_h5/btrtl code and linux-firmware's rtl8852bs files.

Patch 1 documents the compatible, with rtl8822cs-bt as fallback, so no
driver change is needed. Patch 2 enables it on the BPI-F3.

GPIO usage was tested one line at a time: GPIO 63 is the power/enable
line and GPIO 64 the device wake line. The vendor DT also drives
GPIO 65 and GPIO 67; Bluetooth works without them (and RSSI is the
same with GPIO 67 high or low), so they are left out.

Frédéric Mahé (2):
  dt-bindings: net: bluetooth: realtek: Add RTL8852BS
  riscv: dts: spacemit: enable Bluetooth on BPI-F3

 .../bindings/net/bluetooth/realtek,bluetooth.yaml | 11 +++++++----
 arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts   | 15 +++++++++++++++
 2 files changed, 22 insertions(+), 4 deletions(-)


base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
-- 
2.47.3


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] dt-bindings: net: bluetooth: realtek: Add RTL8852BS
  2026-11-10  7:46 [PATCH 0/2] Bluetooth for the RTL8852BS on BPI-F3 Frédéric Mahé
@ 2026-11-10  7:46 ` Frédéric Mahé
  2026-11-10 18:56   ` Conor Dooley
  2026-11-10  7:46 ` [PATCH 2/2] riscv: dts: spacemit: enable Bluetooth on BPI-F3 Frédéric Mahé
  1 sibling, 1 reply; 5+ messages in thread
From: Frédéric Mahé @ 2026-11-10  7:46 UTC (permalink / raw)
  To: Marcel Holtmann, Luiz Augusto von Dentz, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Yixun Lan
  Cc: Vasily Khoruzhick, Alistair Francis, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Troy Mitchell,
	linux-bluetooth, devicetree, linux-riscv, spacemit, linux-kernel,
	Frédéric Mahé

The RTL8852BS is a Wi-Fi 6 + Bluetooth 5.2 chip with Wi-Fi on SDIO
and Bluetooth on UART (H5). Its Bluetooth part works with the
RTL8822CS driver data, so use realtek,rtl8822cs-bt as fallback.

This patch was prepared with the help of an AI assistant (Claude),
which also ran the tests.

Signed-off-by: Frédéric Mahé <frederic.mahe@cirad.fr>
---
 .../bindings/net/bluetooth/realtek,bluetooth.yaml     | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/bluetooth/realtek,bluetooth.yaml b/Documentation/devicetree/bindings/net/bluetooth/realtek,bluetooth.yaml
index 7d567122b..ffdf13b05 100644
--- a/Documentation/devicetree/bindings/net/bluetooth/realtek,bluetooth.yaml
+++ b/Documentation/devicetree/bindings/net/bluetooth/realtek,bluetooth.yaml
@@ -4,16 +4,16 @@
 $id: http://devicetree.org/schemas/net/bluetooth/realtek,bluetooth.yaml#
 $schema: http://devicetree.org/meta-schemas/core.yaml#
 
-title: RTL8723BS/RTL8723CS/RTL8821CS/RTL8822CS Bluetooth
+title: RTL8723BS/RTL8723CS/RTL8821CS/RTL8822CS/RTL8852BS Bluetooth
 
 maintainers:
   - Vasily Khoruzhick <anarsoul@gmail.com>
   - Alistair Francis <alistair@alistair23.me>
 
 description:
-  RTL8723BS/RTL8723CS/RTL8821CS/RTL8822CS is a WiFi + BT chip. WiFi part
-  is connected over SDIO, while BT is connected over serial. It speaks
-  H5 protocol with few extra commands to upload firmware and change
+  RTL8723BS/RTL8723CS/RTL8821CS/RTL8822CS/RTL8852BS is a WiFi + BT chip.
+  WiFi part is connected over SDIO, while BT is connected over serial. It
+  speaks H5 protocol with few extra commands to upload firmware and change
   module speed.
 
 properties:
@@ -28,6 +28,9 @@ properties:
           - enum:
               - realtek,rtl8821cs-bt
           - const: realtek,rtl8723bs-bt
+      - items:
+          - const: realtek,rtl8852bs-bt
+          - const: realtek,rtl8822cs-bt
 
   device-wake-gpios:
     maxItems: 1
-- 
2.47.3


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/2] riscv: dts: spacemit: enable Bluetooth on BPI-F3
  2026-11-10  7:46 [PATCH 0/2] Bluetooth for the RTL8852BS on BPI-F3 Frédéric Mahé
  2026-11-10  7:46 ` [PATCH 1/2] dt-bindings: net: bluetooth: realtek: Add RTL8852BS Frédéric Mahé
@ 2026-11-10  7:46 ` Frédéric Mahé
  2026-11-10  8:44   ` Troy Mitchell
  1 sibling, 1 reply; 5+ messages in thread
From: Frédéric Mahé @ 2026-11-10  7:46 UTC (permalink / raw)
  To: Marcel Holtmann, Luiz Augusto von Dentz, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Yixun Lan
  Cc: Vasily Khoruzhick, Alistair Francis, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti, Troy Mitchell,
	linux-bluetooth, devicetree, linux-riscv, spacemit, linux-kernel,
	Frédéric Mahé

The BPI-F3 has an RTL8852BS module whose Bluetooth part is on UART2,
with hardware flow control. GPIO 63 powers Bluetooth on and GPIO 64
is the device wake line.

The firmware config switches the UART to 1.5 Mbaud, so take the UART2
clock from the 48 MHz slow_uart2 clock.

Tested with a laptop: scan, pairing, and l2ping in both directions,
including incoming connections while the UART is runtime suspended.
An 8-hour soak (an HCI command every 20 s) showed no errors.

This patch was prepared with the help of an AI assistant (Claude),
which also ran the tests.

Signed-off-by: Frédéric Mahé <frederic.mahe@cirad.fr>
---
 arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
index 58035d886..280adc9dc 100644
--- a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
+++ b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
@@ -383,6 +383,21 @@ &uart0 {
 	status = "okay";
 };
 
+&uart2 {
+	assigned-clocks = <&syscon_apbc CLK_UART2>;
+	assigned-clock-parents = <&syscon_mpmu CLK_SLOW_UART2>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart2_0_cfg>, <&uart2_0_cts_rts_cfg>;
+	uart-has-rtscts;
+	status = "okay";
+
+	bluetooth {
+		compatible = "realtek,rtl8852bs-bt", "realtek,rtl8822cs-bt";
+		enable-gpios = <&gpio K1_GPIO(63) GPIO_ACTIVE_HIGH>;
+		device-wake-gpios = <&gpio K1_GPIO(64) GPIO_ACTIVE_HIGH>;
+	};
+};
+
 &usbphy2 {
 	status = "okay";
 };
-- 
2.47.3


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] riscv: dts: spacemit: enable Bluetooth on BPI-F3
  2026-11-10  7:46 ` [PATCH 2/2] riscv: dts: spacemit: enable Bluetooth on BPI-F3 Frédéric Mahé
@ 2026-11-10  8:44   ` Troy Mitchell
  0 siblings, 0 replies; 5+ messages in thread
From: Troy Mitchell @ 2026-11-10  8:44 UTC (permalink / raw)
  To: Frédéric Mahé
  Cc: Marcel Holtmann, Luiz Augusto von Dentz, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Yixun Lan, Vasily Khoruzhick,
	Alistair Francis, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Alexandre Ghiti, Troy Mitchell, linux-bluetooth, devicetree,
	linux-riscv, spacemit, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1441 bytes --]

On Tue, 10 Nov 2026 08:46:07 +0100, Frédéric Mahé wrote:
> The BPI-F3 has an RTL8852BS module whose Bluetooth part is on UART2,
> with hardware flow control. GPIO 63 powers Bluetooth on and GPIO 64
> is the device wake line.
>
> The firmware config switches the UART to 1.5 Mbaud, so take the UART2
> clock from the 48 MHz slow_uart2 clock.
slow_uart2 is a programmable divider (MPMU_SUCCR_1), not a fixed
48 MHz clock. Its rate is whatever the bootloader left there.

[...]
> diff --git a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> index 58035d886..280adc9dc 100644
> --- a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> +++ b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
> @@ -383,6 +383,21 @@ &uart0 {
>  	status = "okay";
>  };
>  
> +&uart2 {
> +	assigned-clocks = <&syscon_apbc CLK_UART2>;
> +	assigned-clock-parents = <&syscon_mpmu CLK_SLOW_UART2>;
Please add CLK_SLOW_UART2 to assigned-clocks and set it explicitly:

	assigned-clock-rates = <0>, <48000000>;

> +	pinctrl-names = "default";
> +	pinctrl-0 = <&uart2_0_cfg>, <&uart2_0_cts_rts_cfg>;
> +	uart-has-rtscts;
> +	status = "okay";
> +
> +	bluetooth {
> +		compatible = "realtek,rtl8852bs-bt", "realtek,rtl8822cs-bt";
> +		enable-gpios = <&gpio K1_GPIO(63) GPIO_ACTIVE_HIGH>;
> +		device-wake-gpios = <&gpio K1_GPIO(64) GPIO_ACTIVE_HIGH>;
> +	};
> +};

-- 
Troy Mitchell

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] dt-bindings: net: bluetooth: realtek: Add RTL8852BS
  2026-11-10  7:46 ` [PATCH 1/2] dt-bindings: net: bluetooth: realtek: Add RTL8852BS Frédéric Mahé
@ 2026-11-10 18:56   ` Conor Dooley
  0 siblings, 0 replies; 5+ messages in thread
From: Conor Dooley @ 2026-11-10 18:56 UTC (permalink / raw)
  To: Frédéric Mahé
  Cc: Marcel Holtmann, Luiz Augusto von Dentz, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Yixun Lan, Vasily Khoruzhick,
	Alistair Francis, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Alexandre Ghiti, Troy Mitchell, linux-bluetooth, devicetree,
	linux-riscv, spacemit, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 75 bytes --]

Acked-by: Conor Dooley <conor.dooley@microchip.com>
pw-bot: not-applicable

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-10 18:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-10  7:46 [PATCH 0/2] Bluetooth for the RTL8852BS on BPI-F3 Frédéric Mahé
2026-11-10  7:46 ` [PATCH 1/2] dt-bindings: net: bluetooth: realtek: Add RTL8852BS Frédéric Mahé
2026-11-10 18:56   ` Conor Dooley
2026-11-10  7:46 ` [PATCH 2/2] riscv: dts: spacemit: enable Bluetooth on BPI-F3 Frédéric Mahé
2026-11-10  8:44   ` Troy Mitchell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®