This series enables the in-kernel Bluetooth driver to work with the
Broadcom Wifi/Bluetooth module on the BeagleV Starlight and StarFive
VisionFive V1 boards.
Previously Bluetooth only worked with some GPIO twiddling and a custom
program to load firmware from userspace.
Emil Renner Berthing (2):
riscv: dts: starfive: Add JH7100 high speed UARTs
riscv: dts: starfive: Enable Bluetooth on JH7100 boards
.../boot/dts/starfive/jh7100-common.dtsi | 49 +++++++++++++++++++
arch/riscv/boot/dts/starfive/jh7100.dtsi | 26 ++++++++++
2 files changed, 75 insertions(+)
--
2.43.0
From: Emil Renner Berthing <[email protected]>
Add missing device tree nodes for UART0 and UART1 on the StarFive JH7100
SoC. UART0 is used for Bluetooth on the BeagleV Starlight and StarFive
VisionFive V1 boards.
Signed-off-by: Emil Renner Berthing <[email protected]>
---
arch/riscv/boot/dts/starfive/jh7100.dtsi | 26 ++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/arch/riscv/boot/dts/starfive/jh7100.dtsi b/arch/riscv/boot/dts/starfive/jh7100.dtsi
index 9a2e9583af88..34c1622d5496 100644
--- a/arch/riscv/boot/dts/starfive/jh7100.dtsi
+++ b/arch/riscv/boot/dts/starfive/jh7100.dtsi
@@ -258,6 +258,32 @@ sysmain: syscon@11850000 {
reg = <0x0 0x11850000 0x0 0x10000>;
};
+ uart0: serial@11870000 {
+ compatible = "starfive,jh7100-hsuart", "snps,dw-apb-uart";
+ reg = <0x0 0x11870000 0x0 0x10000>;
+ clocks = <&clkgen JH7100_CLK_UART0_CORE>,
+ <&clkgen JH7100_CLK_UART0_APB>;
+ clock-names = "baudclk", "apb_pclk";
+ resets = <&rstgen JH7100_RSTN_UART0_APB>;
+ interrupts = <92>;
+ reg-io-width = <4>;
+ reg-shift = <2>;
+ status = "disabled";
+ };
+
+ uart1: serial@11880000 {
+ compatible = "starfive,jh7100-hsuart", "snps,dw-apb-uart";
+ reg = <0x0 0x11880000 0x0 0x10000>;
+ clocks = <&clkgen JH7100_CLK_UART1_CORE>,
+ <&clkgen JH7100_CLK_UART1_APB>;
+ clock-names = "baudclk", "apb_pclk";
+ resets = <&rstgen JH7100_RSTN_UART1_APB>;
+ interrupts = <93>;
+ reg-io-width = <4>;
+ reg-shift = <2>;
+ status = "disabled";
+ };
+
i2c0: i2c@118b0000 {
compatible = "snps,designware-i2c";
reg = <0x0 0x118b0000 0x0 0x10000>;
--
2.43.0
From: Emil Renner Berthing <[email protected]>
Add pinctrl and UART nodes for the Broadcom Wifi/Bluetooth module on the
BeagleV Starlight and StarFive VisionFive V1 boards.
Signed-off-by: Emil Renner Berthing <[email protected]>
---
.../boot/dts/starfive/jh7100-common.dtsi | 49 +++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/arch/riscv/boot/dts/starfive/jh7100-common.dtsi b/arch/riscv/boot/dts/starfive/jh7100-common.dtsi
index ae1a6aeb0aea..1f79481bfd96 100644
--- a/arch/riscv/boot/dts/starfive/jh7100-common.dtsi
+++ b/arch/riscv/boot/dts/starfive/jh7100-common.dtsi
@@ -289,6 +289,41 @@ GPO_SDIO1_PAD_CDATA_OEN_BIT3,
};
};
+ uart0_pins: uart0-0 {
+ rx-pins {
+ pinmux = <GPIOMUX(40, GPO_LOW, GPO_DISABLE,
+ GPI_UART0_PAD_SIN)>;
+ bias-pull-up;
+ drive-strength = <14>;
+ input-enable;
+ input-schmitt-enable;
+ };
+ tx-pins {
+ pinmux = <GPIOMUX(41, GPO_UART0_PAD_SOUT,
+ GPO_ENABLE, GPI_NONE)>;
+ bias-disable;
+ drive-strength = <35>;
+ input-disable;
+ input-schmitt-disable;
+ };
+ cts-pins {
+ pinmux = <GPIOMUX(39, GPO_LOW, GPO_DISABLE,
+ GPI_UART0_PAD_CTSN)>;
+ bias-pull-down;
+ drive-strength = <14>;
+ input-enable;
+ input-schmitt-enable;
+ };
+ rts-pins {
+ pinmux = <GPIOMUX(42, GPO_UART0_PAD_RTSN,
+ GPO_ENABLE, GPI_NONE)>;
+ bias-disable;
+ drive-strength = <35>;
+ input-disable;
+ input-schmitt-disable;
+ };
+ };
+
uart3_pins: uart3-0 {
rx-pins {
pinmux = <GPIOMUX(13, GPO_LOW, GPO_DISABLE,
@@ -393,6 +428,20 @@ wifi@1 {
};
};
+&uart0 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&uart0_pins>;
+ uart-has-rtscts;
+ status = "okay";
+
+ bluetooth {
+ compatible = "brcm,bcm4330-bt";
+ max-speed = <4000000>;
+ device-wakeup-gpios = <&gpio 38 GPIO_ACTIVE_HIGH>;
+ reset-gpios = <&gpio 35 GPIO_ACTIVE_LOW>;
+ };
+};
+
&uart3 {
pinctrl-names = "default";
pinctrl-0 = <&uart3_pins>;
--
2.43.0
On Mai 08 2024, Emil Renner Berthing wrote:
> This series enables the in-kernel Bluetooth driver to work with the
> Broadcom Wifi/Bluetooth module on the BeagleV Starlight and StarFive
> VisionFive V1 boards.
That does not work for me:
[ +0.369276] Bluetooth: hci0: command 0x1001 tx timeout
[ +0.025545] Bluetooth: hci0: BCM: Reading local version info failed (-110)
--
Andreas Schwab, [email protected]
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
Andreas Schwab wrote:
> On Mai 08 2024, Emil Renner Berthing wrote:
>
> > This series enables the in-kernel Bluetooth driver to work with the
> > Broadcom Wifi/Bluetooth module on the BeagleV Starlight and StarFive
> > VisionFive V1 boards.
>
> That does not work for me:
>
> [ +0.369276] Bluetooth: hci0: command 0x1001 tx timeout
> [ +0.025545] Bluetooth: hci0: BCM: Reading local version info failed (-110)
Hi Andreas,
You don't include any information useful for debugging this, but if it get's
far enough to load the firmware could you at least make sure you run the
version below, so that's at least the same.
https://github.com/esmil/linux/blob/visionfive/firmware/brcm/BCM43430A1.hcd
/Emil
On Mai 10 2024, Emil Renner Berthing wrote:
> You don't include any information useful for debugging this, but if it get's
> far enough to load the firmware could you at least make sure you run the
> version below, so that's at least the same.
>
> https://github.com/esmil/linux/blob/visionfive/firmware/brcm/BCM43430A1.hcd
That didn't change anything (and there are no messages related to
firmware loading from hci_uart).
[ +0.879623] Bluetooth: Core ver 2.22
[ +0.004843] NET: Registered PF_BLUETOOTH protocol family
[ +0.008787] Bluetooth: HCI device and connection manager initialized
[ +0.021944] Bluetooth: HCI socket layer initialized
[ +0.008488] Bluetooth: L2CAP socket layer initialized
[ +0.006333] Bluetooth: SCO socket layer initialized
[ +0.097478] Bluetooth: HCI UART driver ver 2.3
[ +0.007943] Bluetooth: HCI UART protocol H4 registered
[ +0.006066] Bluetooth: HCI UART protocol BCSP registered
[ +0.006962] Bluetooth: HCI UART protocol LL registered
[ +0.000015] Bluetooth: HCI UART protocol ATH3K registered
[ +0.000084] Bluetooth: HCI UART protocol Three-wire (H5) registered
[ +0.000247] Bluetooth: HCI UART protocol Intel registered
[ +0.000455] Bluetooth: HCI UART protocol Broadcom registered
[ +0.000084] Bluetooth: HCI UART protocol QCA registered
[ +0.000008] Bluetooth: HCI UART protocol AG6XX registered
[ +0.000057] Bluetooth: HCI UART protocol Marvell registered
[ +0.051854] hci_uart_bcm serial0-0: supply vbat not found, using dummy regulator
[ +0.000387] hci_uart_bcm serial0-0: supply vddio not found, using dummy regulator
[ +0.094658] hci_uart_bcm serial0-0: No reset resource, using default baud rate
[ +0.990297] Bluetooth: hci0: command 0x1001 tx timeout
[ +0.022893] Bluetooth: hci0: BCM: Reading local version info failed (-110)
[ +3.306159] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ +0.013336] Bluetooth: BNEP filters: protocol multicast
[ +0.124262] Bluetooth: BNEP socket layer initialized
--
Andreas Schwab, [email protected]
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
Emil,
On Fri, May 10, 2024 at 11:35:34AM +0200, Andreas Schwab wrote:
> On Mai 10 2024, Emil Renner Berthing wrote:
>
> > You don't include any information useful for debugging this, but if it get's
> > far enough to load the firmware could you at least make sure you run the
> > version below, so that's at least the same.
> >
> > https://github.com/esmil/linux/blob/visionfive/firmware/brcm/BCM43430A1.hcd
>
> That didn't change anything (and there are no messages related to
> firmware loading from hci_uart).
Looking at things to apply post -rc1, are you still looking into this
issue?
Thanks,
Conor.
>
> [ +0.879623] Bluetooth: Core ver 2.22
> [ +0.004843] NET: Registered PF_BLUETOOTH protocol family
> [ +0.008787] Bluetooth: HCI device and connection manager initialized
> [ +0.021944] Bluetooth: HCI socket layer initialized
> [ +0.008488] Bluetooth: L2CAP socket layer initialized
> [ +0.006333] Bluetooth: SCO socket layer initialized
> [ +0.097478] Bluetooth: HCI UART driver ver 2.3
> [ +0.007943] Bluetooth: HCI UART protocol H4 registered
> [ +0.006066] Bluetooth: HCI UART protocol BCSP registered
> [ +0.006962] Bluetooth: HCI UART protocol LL registered
> [ +0.000015] Bluetooth: HCI UART protocol ATH3K registered
> [ +0.000084] Bluetooth: HCI UART protocol Three-wire (H5) registered
> [ +0.000247] Bluetooth: HCI UART protocol Intel registered
> [ +0.000455] Bluetooth: HCI UART protocol Broadcom registered
> [ +0.000084] Bluetooth: HCI UART protocol QCA registered
> [ +0.000008] Bluetooth: HCI UART protocol AG6XX registered
> [ +0.000057] Bluetooth: HCI UART protocol Marvell registered
> [ +0.051854] hci_uart_bcm serial0-0: supply vbat not found, using dummy regulator
> [ +0.000387] hci_uart_bcm serial0-0: supply vddio not found, using dummy regulator
> [ +0.094658] hci_uart_bcm serial0-0: No reset resource, using default baud rate
> [ +0.990297] Bluetooth: hci0: command 0x1001 tx timeout
> [ +0.022893] Bluetooth: hci0: BCM: Reading local version info failed (-110)
> [ +3.306159] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
> [ +0.013336] Bluetooth: BNEP filters: protocol multicast
> [ +0.124262] Bluetooth: BNEP socket layer initialized
>
> --
> Andreas Schwab, [email protected]
> GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
> "And now for something completely different."
On Tue, May 28, 2024 at 05:37:32PM +0200, Andreas Schwab wrote:
> On Mai 28 2024, Conor Dooley wrote:
>
> > Looking at things to apply post -rc1, are you still looking into this
> > issue?
>
> I don't know what to look for.
Fortunately for you, it is Emil I was asking :) I thought I'd addressed
the mail to him.
On Mai 28 2024, Conor Dooley wrote:
> Looking at things to apply post -rc1, are you still looking into this
> issue?
I don't know what to look for.
--
Andreas Schwab, [email protected]
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
Andreas Schwab wrote:
> On Mai 10 2024, Emil Renner Berthing wrote:
>
> > You don't include any information useful for debugging this, but if it get's
> > far enough to load the firmware could you at least make sure you run the
> > version below, so that's at least the same.
> >
> > https://github.com/esmil/linux/blob/visionfive/firmware/brcm/BCM43430A1.hcd
>
> That didn't change anything (and there are no messages related to
> firmware loading from hci_uart).
>
> [ +0.879623] Bluetooth: Core ver 2.22
> [ +0.004843] NET: Registered PF_BLUETOOTH protocol family
> [ +0.008787] Bluetooth: HCI device and connection manager initialized
> [ +0.021944] Bluetooth: HCI socket layer initialized
> [ +0.008488] Bluetooth: L2CAP socket layer initialized
> [ +0.006333] Bluetooth: SCO socket layer initialized
> [ +0.097478] Bluetooth: HCI UART driver ver 2.3
> [ +0.007943] Bluetooth: HCI UART protocol H4 registered
> [ +0.006066] Bluetooth: HCI UART protocol BCSP registered
> [ +0.006962] Bluetooth: HCI UART protocol LL registered
> [ +0.000015] Bluetooth: HCI UART protocol ATH3K registered
> [ +0.000084] Bluetooth: HCI UART protocol Three-wire (H5) registered
> [ +0.000247] Bluetooth: HCI UART protocol Intel registered
> [ +0.000455] Bluetooth: HCI UART protocol Broadcom registered
> [ +0.000084] Bluetooth: HCI UART protocol QCA registered
> [ +0.000008] Bluetooth: HCI UART protocol AG6XX registered
> [ +0.000057] Bluetooth: HCI UART protocol Marvell registered
> [ +0.051854] hci_uart_bcm serial0-0: supply vbat not found, using dummy regulator
> [ +0.000387] hci_uart_bcm serial0-0: supply vddio not found, using dummy regulator
> [ +0.094658] hci_uart_bcm serial0-0: No reset resource, using default baud rate
> [ +0.990297] Bluetooth: hci0: command 0x1001 tx timeout
> [ +0.022893] Bluetooth: hci0: BCM: Reading local version info failed (-110)
> [ +3.306159] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
> [ +0.013336] Bluetooth: BNEP filters: protocol multicast
> [ +0.124262] Bluetooth: BNEP socket layer initialized
Oddly it doesn't work on my Starlight board either. I was thinking the firmware
might set up pinconf differently, but comparing
/sys/kernel/debug/pinctrl/11910000.pinctrl-pinctrl-starfive/pinconf-pins
on the two boards shows no differences. I've also not been able to spot any
differences in how the AP6236 module is connected in the schematics for the two
boards, so not really sure how to proceed.
If you're also testing on the Starlight board then I can update the
patch to just
enable Bluetooth on that I guess.
/Emil
Emil Renner Berthing wrote:
> Andreas Schwab wrote:
> > On Mai 10 2024, Emil Renner Berthing wrote:
> >
> > > You don't include any information useful for debugging this, but if it get's
> > > far enough to load the firmware could you at least make sure you run the
> > > version below, so that's at least the same.
> > >
> > > https://github.com/esmil/linux/blob/visionfive/firmware/brcm/BCM43430A1.hcd
> >
> > That didn't change anything (and there are no messages related to
> > firmware loading from hci_uart).
> >
> > [ +0.879623] Bluetooth: Core ver 2.22
> > [ +0.004843] NET: Registered PF_BLUETOOTH protocol family
> > [ +0.008787] Bluetooth: HCI device and connection manager initialized
> > [ +0.021944] Bluetooth: HCI socket layer initialized
> > [ +0.008488] Bluetooth: L2CAP socket layer initialized
> > [ +0.006333] Bluetooth: SCO socket layer initialized
> > [ +0.097478] Bluetooth: HCI UART driver ver 2.3
> > [ +0.007943] Bluetooth: HCI UART protocol H4 registered
> > [ +0.006066] Bluetooth: HCI UART protocol BCSP registered
> > [ +0.006962] Bluetooth: HCI UART protocol LL registered
> > [ +0.000015] Bluetooth: HCI UART protocol ATH3K registered
> > [ +0.000084] Bluetooth: HCI UART protocol Three-wire (H5) registered
> > [ +0.000247] Bluetooth: HCI UART protocol Intel registered
> > [ +0.000455] Bluetooth: HCI UART protocol Broadcom registered
> > [ +0.000084] Bluetooth: HCI UART protocol QCA registered
> > [ +0.000008] Bluetooth: HCI UART protocol AG6XX registered
> > [ +0.000057] Bluetooth: HCI UART protocol Marvell registered
> > [ +0.051854] hci_uart_bcm serial0-0: supply vbat not found, using dummy regulator
> > [ +0.000387] hci_uart_bcm serial0-0: supply vddio not found, using dummy regulator
> > [ +0.094658] hci_uart_bcm serial0-0: No reset resource, using default baud rate
> > [ +0.990297] Bluetooth: hci0: command 0x1001 tx timeout
> > [ +0.022893] Bluetooth: hci0: BCM: Reading local version info failed (-110)
> > [ +3.306159] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
> > [ +0.013336] Bluetooth: BNEP filters: protocol multicast
> > [ +0.124262] Bluetooth: BNEP socket layer initialized
>
> Oddly it doesn't work on my Starlight board either. I was thinking the firmware
> might set up pinconf differently, but comparing
>
> /sys/kernel/debug/pinctrl/11910000.pinctrl-pinctrl-starfive/pinconf-pins
>
> on the two boards shows no differences. I've also not been able to spot any
> differences in how the AP6236 module is connected in the schematics for the two
> boards, so not really sure how to proceed.
>
> If you're also testing on the Starlight board then I can update the patch to just
> enable Bluetooth on that I guess.
* I meant update the patch to only enable bluetooth on the VisionFive V1 of
course.
/Emil
On Mai 29 2024, Emil Renner Berthing wrote:
> Oddly it doesn't work on my Starlight board either. I was thinking the firmware
> might set up pinconf differently, but comparing
>
> /sys/kernel/debug/pinctrl/11910000.pinctrl-pinctrl-starfive/pinconf-pins
>
> on the two boards shows no differences. I've also not been able to spot any
> differences in how the AP6236 module is connected in the schematics for the two
> boards, so not really sure how to proceed.
I see no difference between Starlight and Visionfive boards, both fail
the same way.
I also see that sometimes the firmware greeting from brcmfmac occurs
_after_ the timeout error from hci0:
# journalctl -b -2 | grep -e brcmf_c_preinit_dcmds -e hci0:
May 16 12:01:54 beaglev kernel: Bluetooth: hci0: command 0x1001 tx timeout
May 16 12:01:54 beaglev kernel: Bluetooth: hci0: BCM: Reading local version info failed (-110)
May 16 12:01:54 beaglev kernel: brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM43430/1 wl0: Mar 30 2021 01:12:21 version 7.45.98.118 (7d96287 CY) FWID 01-32059766
Is this perhaps a race with the firmware loading?
--
Andreas Schwab, [email protected]
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
Hi Andreas,
On 2024-05-29 10:53 AM, Andreas Schwab wrote:
> On Mai 29 2024, Emil Renner Berthing wrote:
>
>> Oddly it doesn't work on my Starlight board either. I was thinking the firmware
>> might set up pinconf differently, but comparing
>>
>> /sys/kernel/debug/pinctrl/11910000.pinctrl-pinctrl-starfive/pinconf-pins
>>
>> on the two boards shows no differences. I've also not been able to spot any
>> differences in how the AP6236 module is connected in the schematics for the two
>> boards, so not really sure how to proceed.
>
> I see no difference between Starlight and Visionfive boards, both fail
> the same way.
>
> I also see that sometimes the firmware greeting from brcmfmac occurs
> _after_ the timeout error from hci0:
>
> # journalctl -b -2 | grep -e brcmf_c_preinit_dcmds -e hci0:
> May 16 12:01:54 beaglev kernel: Bluetooth: hci0: command 0x1001 tx timeout
> May 16 12:01:54 beaglev kernel: Bluetooth: hci0: BCM: Reading local version info failed (-110)
> May 16 12:01:54 beaglev kernel: brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM43430/1 wl0: Mar 30 2021 01:12:21 version 7.45.98.118 (7d96287 CY) FWID 01-32059766
>
> Is this perhaps a race with the firmware loading?
brcmfmac is the WiFi driver. The WiFi and Bluetooth parts of the module are
functionally independent -- different drivers, different firmware, different DT
nodes. So the brcmfmac line is not relevant to debugging Bluetooth issues.
If the Bluetooth part has some dependency (pinconf, reset pin, clock, regulator,
etc.), then such dependency must be declared specifically for the Bluetooth in
the DT. Those seem to be correct, so maybe the issue is the maximum UART
frequency, if the signal integrity is marginal. Have you tried reducing that?
Regards,
Samuel
On Mai 29 2024, Samuel Holland wrote:
> If the Bluetooth part has some dependency (pinconf, reset pin, clock, regulator,
> etc.), then such dependency must be declared specifically for the Bluetooth in
> the DT. Those seem to be correct, so maybe the issue is the maximum UART
> frequency, if the signal integrity is marginal. Have you tried reducing that?
How to do that?
--
Andreas Schwab, [email protected]
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."