Message ID | 438185389.274708.1520422108782@email.1und1.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Stefan, > after applying Loic's patch and the necessary patch for the RPi 3 dts file (see below), i will get this output: > > [ 4.873246] Bluetooth: HCI UART driver ver 2.3 > [ 4.873260] Bluetooth: HCI UART protocol H4 registered > [ 4.873265] Bluetooth: HCI UART protocol Three-wire (H5) registered > [ 4.873751] Bluetooth: HCI UART protocol Broadcom registered > [ 4.877279] uart-pl011 3f201000.serial: no DMA platform data > [ 6.952382] Bluetooth: hci0: command 0xfc18 tx timeout > [ 15.192298] Bluetooth: hci0: BCM: failed to write update baudrate (-110) > [ 15.192312] Bluetooth: hci0: Failed to set baudrate > [ 15.316415] Bluetooth: hci0: BCM: chip id 94 > [ 15.318567] Bluetooth: hci0: BCM: features 0x2e > [ 15.341538] Bluetooth: hci0: BCM43430A1 > [ 15.341560] Bluetooth: hci0: BCM43430A1 (001.002.009) build 0000 > [ 19.112670] Bluetooth: hci0: BCM (001.002.009) build 0360 > [ 274.713732] Bluetooth: hci0: command 0x0c14 tx timeout > [ 274.714085] Bluetooth: hci0: Frame reassembly failed (-84) > [ 317.275941] Bluetooth: hci0: last event is not cmd complete (0x0f) > > I don't see these errors on RPi Zero W. Maybe the reason for this is the lack of hardware flowcontrol on RPi 3. Or some of the downstream patches on BlueZ must be adapted for the kernel [1]. > > Btw the bcm43438 is detected even after unloading and reloading the driver. But the timeout occurs also on driver reload. Reducing the baudrate to 115200 doesn't help here. > > Sorry in case this patch gets corrupted by my webmailer. I assume the controller requests a certain time to be ready, so the controller probably misses the first command (update baudrate). And yes the reason it's not reproducible on RPi Zero W is seems related to hardware flow control, the device most likely asserts RTS only when ready. Could you try adding a msleep in the bcm_gpio_set_power method after toggling the shutdown gpio, I don't know about the BCM controller boot time but 50ms should be enough. I'm not sure why it's related to my patch, maybe just a timing question. Regards, Loic
Hi Stefan, >>>>> Add BCM43438 (bluetooth) as a serdev slave device of uart0 (pl011/ttyAMA0). >>>>> This allows to automatically insert the bcm43438 to the bluetooth >>>>> subsystem instead of relying on patched userspace helpers (hciattach). >>>>> >>>>> In order to keep a debug UART we need to switch to uart1. >>>>> >>>>> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> >>>>> --- >>>>> arch/arm/boot/dts/bcm2835-rpi-zero-w.dts | 14 +++++++++++++- >>>>> 1 file changed, 13 insertions(+), 1 deletion(-) >>>>> >>>>> diff --git a/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts b/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts >>>>> index cf53436..b7f79f1 100644 >>>>> --- a/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts >>>>> +++ b/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts >>>>> @@ -131,6 +131,18 @@ >>>>> >>>>> &uart0 { >>>>> pinctrl-names = "default"; >>>>> - pinctrl-0 = <&uart0_gpio14>; >>>>> + pinctrl-0 = <&uart0_gpio32 &uart0_ctsrts_gpio30>; >>>>> + status = "okay"; >>>>> + >>>>> + bluetooth { >>>>> + compatible = "brcm,bcm43438-bt"; >>>>> + max-speed = <2000000>; >>>>> + shutdown-gpios = <&gpio 45 GPIO_ACTIVE_HIGH>; >>>>> + }; >>>>> +}; >>>> >>>> is the shutdown GPIO working as expected with this hardware. So even module unload and reload works fine? >>> >>> Yes, unload and reload works fine. >>> >>>> Meaning we are getting back to the 115200 default baud rate on the UART? >>> >>> I assume that, because reload works as expected. >> >> awesome. That is good news. >> >> Since you said that the GPIO expander driver for the RPi 3 has been accepted, did you test it there as well? If so, then it would be good to get a patch that also provides shutdown-gpios for RPi 3. > > after applying Loic's patch and the necessary patch for the RPi 3 dts file (see below), i will get this output: > > [ 4.873246] Bluetooth: HCI UART driver ver 2.3 > [ 4.873260] Bluetooth: HCI UART protocol H4 registered > [ 4.873265] Bluetooth: HCI UART protocol Three-wire (H5) registered > [ 4.873751] Bluetooth: HCI UART protocol Broadcom registered > [ 4.877279] uart-pl011 3f201000.serial: no DMA platform data > [ 6.952382] Bluetooth: hci0: command 0xfc18 tx timeout > [ 15.192298] Bluetooth: hci0: BCM: failed to write update baudrate (-110) > [ 15.192312] Bluetooth: hci0: Failed to set baudrate > [ 15.316415] Bluetooth: hci0: BCM: chip id 94 > [ 15.318567] Bluetooth: hci0: BCM: features 0x2e > [ 15.341538] Bluetooth: hci0: BCM43430A1 > [ 15.341560] Bluetooth: hci0: BCM43430A1 (001.002.009) build 0000 > [ 19.112670] Bluetooth: hci0: BCM (001.002.009) build 0360 > [ 274.713732] Bluetooth: hci0: command 0x0c14 tx timeout > [ 274.714085] Bluetooth: hci0: Frame reassembly failed (-84) > [ 317.275941] Bluetooth: hci0: last event is not cmd complete (0x0f) > > I don't see these errors on RPi Zero W. Maybe the reason for this is the lack of hardware flowcontrol on RPi 3. Or some of the downstream patches on BlueZ must be adapted for the kernel [1]. > > Btw the bcm43438 is detected even after unloading and reloading the driver. But the timeout occurs also on driver reload. Reducing the baudrate to 115200 doesn't help here. maybe it needs some time after switching the hardware on. Have you tried to sleep for a bit at the end of bcm_gpio_set_power? Can you also dump where the Frame reassembly fails. Or correlate that with the btmon trace of which packets make its through. The 0x0c14 is Read Local Name and maybe we actually have bit errors here. In theory we could also run this hardware in 3-wire protocol mode. I just do not know how to get that one started, but maybe that would be an option if there is some sort of packet loss. However maybe this is really just some timing issue for the hardware to settle its baud rate. However I assume that the firmware loading itself succeeds here. Regards Marcel
Hi Marcel, hi Loic, > Marcel Holtmann <marcel@holtmann.org> hat am 7. März 2018 um 13:12 geschrieben: > > > Hi Stefan, > > >>>>> Add BCM43438 (bluetooth) as a serdev slave device of uart0 (pl011/ttyAMA0). > >>>>> This allows to automatically insert the bcm43438 to the bluetooth > >>>>> subsystem instead of relying on patched userspace helpers (hciattach). > >>>>> > >>>>> In order to keep a debug UART we need to switch to uart1. > >>>>> > >>>>> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> > >>>>> --- > >>>>> arch/arm/boot/dts/bcm2835-rpi-zero-w.dts | 14 +++++++++++++- > >>>>> 1 file changed, 13 insertions(+), 1 deletion(-) > >>>>> > >>>>> diff --git a/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts b/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts > >>>>> index cf53436..b7f79f1 100644 > >>>>> --- a/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts > >>>>> +++ b/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts > >>>>> @@ -131,6 +131,18 @@ > >>>>> > >>>>> &uart0 { > >>>>> pinctrl-names = "default"; > >>>>> - pinctrl-0 = <&uart0_gpio14>; > >>>>> + pinctrl-0 = <&uart0_gpio32 &uart0_ctsrts_gpio30>; > >>>>> + status = "okay"; > >>>>> + > >>>>> + bluetooth { > >>>>> + compatible = "brcm,bcm43438-bt"; > >>>>> + max-speed = <2000000>; > >>>>> + shutdown-gpios = <&gpio 45 GPIO_ACTIVE_HIGH>; > >>>>> + }; > >>>>> +}; > >>>> > >>>> is the shutdown GPIO working as expected with this hardware. So even module unload and reload works fine? > >>> > >>> Yes, unload and reload works fine. > >>> > >>>> Meaning we are getting back to the 115200 default baud rate on the UART? > >>> > >>> I assume that, because reload works as expected. > >> > >> awesome. That is good news. > >> > >> Since you said that the GPIO expander driver for the RPi 3 has been accepted, did you test it there as well? If so, then it would be good to get a patch that also provides shutdown-gpios for RPi 3. > > > > after applying Loic's patch and the necessary patch for the RPi 3 dts file (see below), i will get this output: > > > > [ 4.873246] Bluetooth: HCI UART driver ver 2.3 > > [ 4.873260] Bluetooth: HCI UART protocol H4 registered > > [ 4.873265] Bluetooth: HCI UART protocol Three-wire (H5) registered > > [ 4.873751] Bluetooth: HCI UART protocol Broadcom registered > > [ 4.877279] uart-pl011 3f201000.serial: no DMA platform data > > [ 6.952382] Bluetooth: hci0: command 0xfc18 tx timeout > > [ 15.192298] Bluetooth: hci0: BCM: failed to write update baudrate (-110) > > [ 15.192312] Bluetooth: hci0: Failed to set baudrate > > [ 15.316415] Bluetooth: hci0: BCM: chip id 94 > > [ 15.318567] Bluetooth: hci0: BCM: features 0x2e > > [ 15.341538] Bluetooth: hci0: BCM43430A1 > > [ 15.341560] Bluetooth: hci0: BCM43430A1 (001.002.009) build 0000 > > [ 19.112670] Bluetooth: hci0: BCM (001.002.009) build 0360 > > [ 274.713732] Bluetooth: hci0: command 0x0c14 tx timeout > > [ 274.714085] Bluetooth: hci0: Frame reassembly failed (-84) > > [ 317.275941] Bluetooth: hci0: last event is not cmd complete (0x0f) > > > > I don't see these errors on RPi Zero W. Maybe the reason for this is the lack of hardware flowcontrol on RPi 3. Or some of the downstream patches on BlueZ must be adapted for the kernel [1]. > > > > Btw the bcm43438 is detected even after unloading and reloading the driver. But the timeout occurs also on driver reload. Reducing the baudrate to 115200 doesn't help here. > > maybe it needs some time after switching the hardware on. Have you tried to sleep for a bit at the end of bcm_gpio_set_power? I will try, but this could also be an "issue" of the gpio expander driver. AFAIK the expander is connected via I2C to the GPU. In case the mailbox reply come before the I2C command has been handled by the GPIO expander, we are running out of sync. > > Can you also dump where the Frame reassembly fails. Or correlate that with the btmon trace of which packets make its through. The 0x0c14 is Read Local Name and maybe we actually have bit errors here. > > In theory we could also run this hardware in 3-wire protocol mode. I just do not know how to get that one started, but maybe that would be an option if there is some sort of packet loss. However maybe this is really just some timing issue for the hardware to settle its baud rate. However I assume that the firmware loading itself succeeds here. According to the link from my last email, the RPi 3 is using 3-wire protocol mode. Maybe we should detect the presence of "uart-has-rtscts" in the master node? In absence we better use 3-wire. Stefan > > Regards > > Marcel > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Hi Stefan, >>>>>>> Add BCM43438 (bluetooth) as a serdev slave device of uart0 (pl011/ttyAMA0). >>>>>>> This allows to automatically insert the bcm43438 to the bluetooth >>>>>>> subsystem instead of relying on patched userspace helpers (hciattach). >>>>>>> >>>>>>> In order to keep a debug UART we need to switch to uart1. >>>>>>> >>>>>>> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> >>>>>>> --- >>>>>>> arch/arm/boot/dts/bcm2835-rpi-zero-w.dts | 14 +++++++++++++- >>>>>>> 1 file changed, 13 insertions(+), 1 deletion(-) >>>>>>> >>>>>>> diff --git a/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts b/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts >>>>>>> index cf53436..b7f79f1 100644 >>>>>>> --- a/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts >>>>>>> +++ b/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts >>>>>>> @@ -131,6 +131,18 @@ >>>>>>> >>>>>>> &uart0 { >>>>>>> pinctrl-names = "default"; >>>>>>> - pinctrl-0 = <&uart0_gpio14>; >>>>>>> + pinctrl-0 = <&uart0_gpio32 &uart0_ctsrts_gpio30>; >>>>>>> + status = "okay"; >>>>>>> + >>>>>>> + bluetooth { >>>>>>> + compatible = "brcm,bcm43438-bt"; >>>>>>> + max-speed = <2000000>; >>>>>>> + shutdown-gpios = <&gpio 45 GPIO_ACTIVE_HIGH>; >>>>>>> + }; >>>>>>> +}; >>>>>> >>>>>> is the shutdown GPIO working as expected with this hardware. So even module unload and reload works fine? >>>>> >>>>> Yes, unload and reload works fine. >>>>> >>>>>> Meaning we are getting back to the 115200 default baud rate on the UART? >>>>> >>>>> I assume that, because reload works as expected. >>>> >>>> awesome. That is good news. >>>> >>>> Since you said that the GPIO expander driver for the RPi 3 has been accepted, did you test it there as well? If so, then it would be good to get a patch that also provides shutdown-gpios for RPi 3. >>> >>> after applying Loic's patch and the necessary patch for the RPi 3 dts file (see below), i will get this output: >>> >>> [ 4.873246] Bluetooth: HCI UART driver ver 2.3 >>> [ 4.873260] Bluetooth: HCI UART protocol H4 registered >>> [ 4.873265] Bluetooth: HCI UART protocol Three-wire (H5) registered >>> [ 4.873751] Bluetooth: HCI UART protocol Broadcom registered >>> [ 4.877279] uart-pl011 3f201000.serial: no DMA platform data >>> [ 6.952382] Bluetooth: hci0: command 0xfc18 tx timeout >>> [ 15.192298] Bluetooth: hci0: BCM: failed to write update baudrate (-110) >>> [ 15.192312] Bluetooth: hci0: Failed to set baudrate >>> [ 15.316415] Bluetooth: hci0: BCM: chip id 94 >>> [ 15.318567] Bluetooth: hci0: BCM: features 0x2e >>> [ 15.341538] Bluetooth: hci0: BCM43430A1 >>> [ 15.341560] Bluetooth: hci0: BCM43430A1 (001.002.009) build 0000 >>> [ 19.112670] Bluetooth: hci0: BCM (001.002.009) build 0360 >>> [ 274.713732] Bluetooth: hci0: command 0x0c14 tx timeout >>> [ 274.714085] Bluetooth: hci0: Frame reassembly failed (-84) >>> [ 317.275941] Bluetooth: hci0: last event is not cmd complete (0x0f) >>> >>> I don't see these errors on RPi Zero W. Maybe the reason for this is the lack of hardware flowcontrol on RPi 3. Or some of the downstream patches on BlueZ must be adapted for the kernel [1]. >>> >>> Btw the bcm43438 is detected even after unloading and reloading the driver. But the timeout occurs also on driver reload. Reducing the baudrate to 115200 doesn't help here. >> >> maybe it needs some time after switching the hardware on. Have you tried to sleep for a bit at the end of bcm_gpio_set_power? > > I will try, but this could also be an "issue" of the gpio expander driver. AFAIK the expander is connected via I2C to the GPU. In case the mailbox reply come before the I2C command has been handled by the GPIO expander, we are running out of sync. > >> >> Can you also dump where the Frame reassembly fails. Or correlate that with the btmon trace of which packets make its through. The 0x0c14 is Read Local Name and maybe we actually have bit errors here. >> >> In theory we could also run this hardware in 3-wire protocol mode. I just do not know how to get that one started, but maybe that would be an option if there is some sort of packet loss. However maybe this is really just some timing issue for the hardware to settle its baud rate. However I assume that the firmware loading itself succeeds here. > > According to the link from my last email, the RPi 3 is using 3-wire protocol mode. Maybe we should detect the presence of "uart-has-rtscts" in the master node? In absence we better use 3-wire. currently we are using it in H:4 protocol mode. Using it in H:5 protocol mode (aka 3-wire) would require a lot of extra work. There is some work ongoing for the Realtek hardware that is actually always 3-wire. Maybe the Broadcom hardware auto-detects H:4 vs H:5 protocol and switches accordingly. You could try to work with the Realtek patches and see if we can get that going with the Broadcom chips as well. On the other hand, when not using the shutdown GPIO entry in the DT, does everything work fine for you? Regards Marcel
Stefan Wahren <stefan.wahren@i2se.com> writes: > Hi Marcel, > hi Loic, > >> Marcel Holtmann <marcel@holtmann.org> hat am 7. März 2018 um 13:12 geschrieben: >> >> >> Hi Stefan, >> >> >>>>> Add BCM43438 (bluetooth) as a serdev slave device of uart0 (pl011/ttyAMA0). >> >>>>> This allows to automatically insert the bcm43438 to the bluetooth >> >>>>> subsystem instead of relying on patched userspace helpers (hciattach). >> >>>>> >> >>>>> In order to keep a debug UART we need to switch to uart1. >> >>>>> >> >>>>> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> >> >>>>> --- >> >>>>> arch/arm/boot/dts/bcm2835-rpi-zero-w.dts | 14 +++++++++++++- >> >>>>> 1 file changed, 13 insertions(+), 1 deletion(-) >> >>>>> >> >>>>> diff --git a/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts b/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts >> >>>>> index cf53436..b7f79f1 100644 >> >>>>> --- a/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts >> >>>>> +++ b/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts >> >>>>> @@ -131,6 +131,18 @@ >> >>>>> >> >>>>> &uart0 { >> >>>>> pinctrl-names = "default"; >> >>>>> - pinctrl-0 = <&uart0_gpio14>; >> >>>>> + pinctrl-0 = <&uart0_gpio32 &uart0_ctsrts_gpio30>; >> >>>>> + status = "okay"; >> >>>>> + >> >>>>> + bluetooth { >> >>>>> + compatible = "brcm,bcm43438-bt"; >> >>>>> + max-speed = <2000000>; >> >>>>> + shutdown-gpios = <&gpio 45 GPIO_ACTIVE_HIGH>; >> >>>>> + }; >> >>>>> +}; >> >>>> >> >>>> is the shutdown GPIO working as expected with this hardware. So even module unload and reload works fine? >> >>> >> >>> Yes, unload and reload works fine. >> >>> >> >>>> Meaning we are getting back to the 115200 default baud rate on the UART? >> >>> >> >>> I assume that, because reload works as expected. >> >> >> >> awesome. That is good news. >> >> >> >> Since you said that the GPIO expander driver for the RPi 3 has been accepted, did you test it there as well? If so, then it would be good to get a patch that also provides shutdown-gpios for RPi 3. >> > >> > after applying Loic's patch and the necessary patch for the RPi 3 dts file (see below), i will get this output: >> > >> > [ 4.873246] Bluetooth: HCI UART driver ver 2.3 >> > [ 4.873260] Bluetooth: HCI UART protocol H4 registered >> > [ 4.873265] Bluetooth: HCI UART protocol Three-wire (H5) registered >> > [ 4.873751] Bluetooth: HCI UART protocol Broadcom registered >> > [ 4.877279] uart-pl011 3f201000.serial: no DMA platform data >> > [ 6.952382] Bluetooth: hci0: command 0xfc18 tx timeout >> > [ 15.192298] Bluetooth: hci0: BCM: failed to write update baudrate (-110) >> > [ 15.192312] Bluetooth: hci0: Failed to set baudrate >> > [ 15.316415] Bluetooth: hci0: BCM: chip id 94 >> > [ 15.318567] Bluetooth: hci0: BCM: features 0x2e >> > [ 15.341538] Bluetooth: hci0: BCM43430A1 >> > [ 15.341560] Bluetooth: hci0: BCM43430A1 (001.002.009) build 0000 >> > [ 19.112670] Bluetooth: hci0: BCM (001.002.009) build 0360 >> > [ 274.713732] Bluetooth: hci0: command 0x0c14 tx timeout >> > [ 274.714085] Bluetooth: hci0: Frame reassembly failed (-84) >> > [ 317.275941] Bluetooth: hci0: last event is not cmd complete (0x0f) >> > >> > I don't see these errors on RPi Zero W. Maybe the reason for this is the lack of hardware flowcontrol on RPi 3. Or some of the downstream patches on BlueZ must be adapted for the kernel [1]. >> > >> > Btw the bcm43438 is detected even after unloading and reloading the driver. But the timeout occurs also on driver reload. Reducing the baudrate to 115200 doesn't help here. >> >> maybe it needs some time after switching the hardware on. Have you tried to sleep for a bit at the end of bcm_gpio_set_power? > > I will try, but this could also be an "issue" of the gpio expander > driver. AFAIK the expander is connected via I2C to the GPU. In case > the mailbox reply come before the I2C command has been handled by the > GPIO expander, we are running out of sync. The mailbox command for setting GPIO state is synchronous in terms of sending the i2c command to the GPIO expander HW.
Hi Eric, >>>>>>>> Add BCM43438 (bluetooth) as a serdev slave device of uart0 (pl011/ttyAMA0). >>>>>>>> This allows to automatically insert the bcm43438 to the bluetooth >>>>>>>> subsystem instead of relying on patched userspace helpers (hciattach). >>>>>>>> >>>>>>>> In order to keep a debug UART we need to switch to uart1. >>>>>>>> >>>>>>>> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> >>>>>>>> --- >>>>>>>> arch/arm/boot/dts/bcm2835-rpi-zero-w.dts | 14 +++++++++++++- >>>>>>>> 1 file changed, 13 insertions(+), 1 deletion(-) >>>>>>>> >>>>>>>> diff --git a/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts b/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts >>>>>>>> index cf53436..b7f79f1 100644 >>>>>>>> --- a/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts >>>>>>>> +++ b/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts >>>>>>>> @@ -131,6 +131,18 @@ >>>>>>>> >>>>>>>> &uart0 { >>>>>>>> pinctrl-names = "default"; >>>>>>>> - pinctrl-0 = <&uart0_gpio14>; >>>>>>>> + pinctrl-0 = <&uart0_gpio32 &uart0_ctsrts_gpio30>; >>>>>>>> + status = "okay"; >>>>>>>> + >>>>>>>> + bluetooth { >>>>>>>> + compatible = "brcm,bcm43438-bt"; >>>>>>>> + max-speed = <2000000>; >>>>>>>> + shutdown-gpios = <&gpio 45 GPIO_ACTIVE_HIGH>; >>>>>>>> + }; >>>>>>>> +}; >>>>>>> >>>>>>> is the shutdown GPIO working as expected with this hardware. So even module unload and reload works fine? >>>>>> >>>>>> Yes, unload and reload works fine. >>>>>> >>>>>>> Meaning we are getting back to the 115200 default baud rate on the UART? >>>>>> >>>>>> I assume that, because reload works as expected. >>>>> >>>>> awesome. That is good news. >>>>> >>>>> Since you said that the GPIO expander driver for the RPi 3 has been accepted, did you test it there as well? If so, then it would be good to get a patch that also provides shutdown-gpios for RPi 3. >>>> >>>> after applying Loic's patch and the necessary patch for the RPi 3 dts file (see below), i will get this output: >>>> >>>> [ 4.873246] Bluetooth: HCI UART driver ver 2.3 >>>> [ 4.873260] Bluetooth: HCI UART protocol H4 registered >>>> [ 4.873265] Bluetooth: HCI UART protocol Three-wire (H5) registered >>>> [ 4.873751] Bluetooth: HCI UART protocol Broadcom registered >>>> [ 4.877279] uart-pl011 3f201000.serial: no DMA platform data >>>> [ 6.952382] Bluetooth: hci0: command 0xfc18 tx timeout >>>> [ 15.192298] Bluetooth: hci0: BCM: failed to write update baudrate (-110) >>>> [ 15.192312] Bluetooth: hci0: Failed to set baudrate >>>> [ 15.316415] Bluetooth: hci0: BCM: chip id 94 >>>> [ 15.318567] Bluetooth: hci0: BCM: features 0x2e >>>> [ 15.341538] Bluetooth: hci0: BCM43430A1 >>>> [ 15.341560] Bluetooth: hci0: BCM43430A1 (001.002.009) build 0000 >>>> [ 19.112670] Bluetooth: hci0: BCM (001.002.009) build 0360 >>>> [ 274.713732] Bluetooth: hci0: command 0x0c14 tx timeout >>>> [ 274.714085] Bluetooth: hci0: Frame reassembly failed (-84) >>>> [ 317.275941] Bluetooth: hci0: last event is not cmd complete (0x0f) >>>> >>>> I don't see these errors on RPi Zero W. Maybe the reason for this is the lack of hardware flowcontrol on RPi 3. Or some of the downstream patches on BlueZ must be adapted for the kernel [1]. >>>> >>>> Btw the bcm43438 is detected even after unloading and reloading the driver. But the timeout occurs also on driver reload. Reducing the baudrate to 115200 doesn't help here. >>> >>> maybe it needs some time after switching the hardware on. Have you tried to sleep for a bit at the end of bcm_gpio_set_power? >> >> I will try, but this could also be an "issue" of the gpio expander >> driver. AFAIK the expander is connected via I2C to the GPU. In case >> the mailbox reply come before the I2C command has been handled by the >> GPIO expander, we are running out of sync. > > The mailbox command for setting GPIO state is synchronous in terms of > sending the i2c command to the GPIO expander HW. does that mean the driver does this correctly and really waits for the completion. Or does the GPIO expander might return to quickly and returns a false sense of GPIO state. I think it would be good a sleep of 50ms after the GPIO makes a difference. Maybe the GPIO expander driver needs to take this into account. Reality is that once the Bluetooth driver toggled the GPIO, it goes onto initializing the chip. One other reason might be that no device wakeup GPIO is wired here, that the chip actually needs some time before it is all good to go. Regards Marcel
Marcel Holtmann <marcel@holtmann.org> writes: > Hi Eric, > >>>>>>>>> Add BCM43438 (bluetooth) as a serdev slave device of uart0 (pl011/ttyAMA0). >>>>>>>>> This allows to automatically insert the bcm43438 to the bluetooth >>>>>>>>> subsystem instead of relying on patched userspace helpers (hciattach). >>>>>>>>> >>>>>>>>> In order to keep a debug UART we need to switch to uart1. >>>>>>>>> >>>>>>>>> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> >>>>>>>>> --- >>>>>>>>> arch/arm/boot/dts/bcm2835-rpi-zero-w.dts | 14 +++++++++++++- >>>>>>>>> 1 file changed, 13 insertions(+), 1 deletion(-) >>>>>>>>> >>>>>>>>> diff --git a/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts b/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts >>>>>>>>> index cf53436..b7f79f1 100644 >>>>>>>>> --- a/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts >>>>>>>>> +++ b/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts >>>>>>>>> @@ -131,6 +131,18 @@ >>>>>>>>> >>>>>>>>> &uart0 { >>>>>>>>> pinctrl-names = "default"; >>>>>>>>> - pinctrl-0 = <&uart0_gpio14>; >>>>>>>>> + pinctrl-0 = <&uart0_gpio32 &uart0_ctsrts_gpio30>; >>>>>>>>> + status = "okay"; >>>>>>>>> + >>>>>>>>> + bluetooth { >>>>>>>>> + compatible = "brcm,bcm43438-bt"; >>>>>>>>> + max-speed = <2000000>; >>>>>>>>> + shutdown-gpios = <&gpio 45 GPIO_ACTIVE_HIGH>; >>>>>>>>> + }; >>>>>>>>> +}; >>>>>>>> >>>>>>>> is the shutdown GPIO working as expected with this hardware. So even module unload and reload works fine? >>>>>>> >>>>>>> Yes, unload and reload works fine. >>>>>>> >>>>>>>> Meaning we are getting back to the 115200 default baud rate on the UART? >>>>>>> >>>>>>> I assume that, because reload works as expected. >>>>>> >>>>>> awesome. That is good news. >>>>>> >>>>>> Since you said that the GPIO expander driver for the RPi 3 has been accepted, did you test it there as well? If so, then it would be good to get a patch that also provides shutdown-gpios for RPi 3. >>>>> >>>>> after applying Loic's patch and the necessary patch for the RPi 3 dts file (see below), i will get this output: >>>>> >>>>> [ 4.873246] Bluetooth: HCI UART driver ver 2.3 >>>>> [ 4.873260] Bluetooth: HCI UART protocol H4 registered >>>>> [ 4.873265] Bluetooth: HCI UART protocol Three-wire (H5) registered >>>>> [ 4.873751] Bluetooth: HCI UART protocol Broadcom registered >>>>> [ 4.877279] uart-pl011 3f201000.serial: no DMA platform data >>>>> [ 6.952382] Bluetooth: hci0: command 0xfc18 tx timeout >>>>> [ 15.192298] Bluetooth: hci0: BCM: failed to write update baudrate (-110) >>>>> [ 15.192312] Bluetooth: hci0: Failed to set baudrate >>>>> [ 15.316415] Bluetooth: hci0: BCM: chip id 94 >>>>> [ 15.318567] Bluetooth: hci0: BCM: features 0x2e >>>>> [ 15.341538] Bluetooth: hci0: BCM43430A1 >>>>> [ 15.341560] Bluetooth: hci0: BCM43430A1 (001.002.009) build 0000 >>>>> [ 19.112670] Bluetooth: hci0: BCM (001.002.009) build 0360 >>>>> [ 274.713732] Bluetooth: hci0: command 0x0c14 tx timeout >>>>> [ 274.714085] Bluetooth: hci0: Frame reassembly failed (-84) >>>>> [ 317.275941] Bluetooth: hci0: last event is not cmd complete (0x0f) >>>>> >>>>> I don't see these errors on RPi Zero W. Maybe the reason for this is the lack of hardware flowcontrol on RPi 3. Or some of the downstream patches on BlueZ must be adapted for the kernel [1]. >>>>> >>>>> Btw the bcm43438 is detected even after unloading and reloading the driver. But the timeout occurs also on driver reload. Reducing the baudrate to 115200 doesn't help here. >>>> >>>> maybe it needs some time after switching the hardware on. Have you tried to sleep for a bit at the end of bcm_gpio_set_power? >>> >>> I will try, but this could also be an "issue" of the gpio expander >>> driver. AFAIK the expander is connected via I2C to the GPU. In case >>> the mailbox reply come before the I2C command has been handled by the >>> GPIO expander, we are running out of sync. >> >> The mailbox command for setting GPIO state is synchronous in terms of >> sending the i2c command to the GPIO expander HW. > > does that mean the driver does this correctly and really waits for the > completion. Or does the GPIO expander might return to quickly and > returns a false sense of GPIO state. I think it would be good a sleep > of 50ms after the GPIO makes a difference. Maybe the GPIO expander > driver needs to take this into account. It seems unlikely that you can get to I2C stop before the GPIO expander HW has changed the state of the output. > Reality is that once the Bluetooth driver toggled the GPIO, it goes > onto initializing the chip. One other reason might be that no device > wakeup GPIO is wired here, that the chip actually needs some time > before it is all good to go. This seems much more likely to me. The spec for bcm43438 is easily googleable and has a power-on timing diagram.
Hi, > Eric Anholt <eric@anholt.net> hat am 7. März 2018 um 23:36 geschrieben: > > > Marcel Holtmann <marcel@holtmann.org> writes: > > > Hi Eric, > > > >>>>>>>>> Add BCM43438 (bluetooth) as a serdev slave device of uart0 (pl011/ttyAMA0). > >>>>>>>>> This allows to automatically insert the bcm43438 to the bluetooth > >>>>>>>>> subsystem instead of relying on patched userspace helpers (hciattach). > >>>>>>>>> > >>>>>>>>> In order to keep a debug UART we need to switch to uart1. > >>>>>>>>> > >>>>>>>>> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> > >>>>>>>>> --- > >>>>>>>>> arch/arm/boot/dts/bcm2835-rpi-zero-w.dts | 14 +++++++++++++- > >>>>>>>>> 1 file changed, 13 insertions(+), 1 deletion(-) > >>>>>>>>> > >>>>>>>>> diff --git a/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts b/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts > >>>>>>>>> index cf53436..b7f79f1 100644 > >>>>>>>>> --- a/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts > >>>>>>>>> +++ b/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts > >>>>>>>>> @@ -131,6 +131,18 @@ > >>>>>>>>> > >>>>>>>>> &uart0 { > >>>>>>>>> pinctrl-names = "default"; > >>>>>>>>> - pinctrl-0 = <&uart0_gpio14>; > >>>>>>>>> + pinctrl-0 = <&uart0_gpio32 &uart0_ctsrts_gpio30>; > >>>>>>>>> + status = "okay"; > >>>>>>>>> + > >>>>>>>>> + bluetooth { > >>>>>>>>> + compatible = "brcm,bcm43438-bt"; > >>>>>>>>> + max-speed = <2000000>; > >>>>>>>>> + shutdown-gpios = <&gpio 45 GPIO_ACTIVE_HIGH>; > >>>>>>>>> + }; > >>>>>>>>> +}; > >>>>>>>> > >>>>>>>> is the shutdown GPIO working as expected with this hardware. So even module unload and reload works fine? > >>>>>>> > >>>>>>> Yes, unload and reload works fine. > >>>>>>> > >>>>>>>> Meaning we are getting back to the 115200 default baud rate on the UART? > >>>>>>> > >>>>>>> I assume that, because reload works as expected. > >>>>>> > >>>>>> awesome. That is good news. > >>>>>> > >>>>>> Since you said that the GPIO expander driver for the RPi 3 has been accepted, did you test it there as well? If so, then it would be good to get a patch that also provides shutdown-gpios for RPi 3. > >>>>> > >>>>> after applying Loic's patch and the necessary patch for the RPi 3 dts file (see below), i will get this output: > >>>>> > >>>>> [ 4.873246] Bluetooth: HCI UART driver ver 2.3 > >>>>> [ 4.873260] Bluetooth: HCI UART protocol H4 registered > >>>>> [ 4.873265] Bluetooth: HCI UART protocol Three-wire (H5) registered > >>>>> [ 4.873751] Bluetooth: HCI UART protocol Broadcom registered > >>>>> [ 4.877279] uart-pl011 3f201000.serial: no DMA platform data > >>>>> [ 6.952382] Bluetooth: hci0: command 0xfc18 tx timeout > >>>>> [ 15.192298] Bluetooth: hci0: BCM: failed to write update baudrate (-110) > >>>>> [ 15.192312] Bluetooth: hci0: Failed to set baudrate > >>>>> [ 15.316415] Bluetooth: hci0: BCM: chip id 94 > >>>>> [ 15.318567] Bluetooth: hci0: BCM: features 0x2e > >>>>> [ 15.341538] Bluetooth: hci0: BCM43430A1 > >>>>> [ 15.341560] Bluetooth: hci0: BCM43430A1 (001.002.009) build 0000 > >>>>> [ 19.112670] Bluetooth: hci0: BCM (001.002.009) build 0360 > >>>>> [ 274.713732] Bluetooth: hci0: command 0x0c14 tx timeout > >>>>> [ 274.714085] Bluetooth: hci0: Frame reassembly failed (-84) > >>>>> [ 317.275941] Bluetooth: hci0: last event is not cmd complete (0x0f) > >>>>> > >>>>> I don't see these errors on RPi Zero W. Maybe the reason for this is the lack of hardware flowcontrol on RPi 3. Or some of the downstream patches on BlueZ must be adapted for the kernel [1]. > >>>>> > >>>>> Btw the bcm43438 is detected even after unloading and reloading the driver. But the timeout occurs also on driver reload. Reducing the baudrate to 115200 doesn't help here. > >>>> > >>>> maybe it needs some time after switching the hardware on. Have you tried to sleep for a bit at the end of bcm_gpio_set_power? > >>> > >>> I will try, but this could also be an "issue" of the gpio expander > >>> driver. AFAIK the expander is connected via I2C to the GPU. In case > >>> the mailbox reply come before the I2C command has been handled by the > >>> GPIO expander, we are running out of sync. > >> > >> The mailbox command for setting GPIO state is synchronous in terms of > >> sending the i2c command to the GPIO expander HW. > > > > does that mean the driver does this correctly and really waits for the > > completion. Or does the GPIO expander might return to quickly and > > returns a false sense of GPIO state. I think it would be good a sleep > > of 50ms after the GPIO makes a difference. Maybe the GPIO expander > > driver needs to take this into account. > > It seems unlikely that you can get to I2C stop before the GPIO expander > HW has changed the state of the output. > > > Reality is that once the Bluetooth driver toggled the GPIO, it goes > > onto initializing the chip. One other reason might be that no device > > wakeup GPIO is wired here, that the chip actually needs some time > > before it is all good to go. > > This seems much more likely to me. The spec for bcm43438 is easily > googleable and has a power-on timing diagram. after applying this patch [1] the RPi 3 specific probing errors disappear. But this is only a quick hack. The proper solution would be to extend hci_h5 in order to support the BCM43438. [1] - https://github.com/lategoodbye/rpi-zero/commit/ed5900296dfb7aec7f467477440751e7367a1881 > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Hi Stefan, On 8 March 2018 at 01:02, Stefan Wahren <stefan.wahren@i2se.com> wrote: > Hi, > >> Eric Anholt <eric@anholt.net> hat am 7. März 2018 um 23:36 geschrieben: >> >> >> Marcel Holtmann <marcel@holtmann.org> writes: >> >> > Hi Eric, >> > >> >>>>>>>>> Add BCM43438 (bluetooth) as a serdev slave device of uart0 (pl011/ttyAMA0). >> >>>>>>>>> This allows to automatically insert the bcm43438 to the bluetooth >> >>>>>>>>> subsystem instead of relying on patched userspace helpers (hciattach). >> >>>>>>>>> >> >>>>>>>>> In order to keep a debug UART we need to switch to uart1. >> >>>>>>>>> >> >>>>>>>>> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> >> >>>>>>>>> --- >> >>>>>>>>> arch/arm/boot/dts/bcm2835-rpi-zero-w.dts | 14 +++++++++++++- >> >>>>>>>>> 1 file changed, 13 insertions(+), 1 deletion(-) >> >>>>>>>>> >> >>>>>>>>> diff --git a/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts b/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts >> >>>>>>>>> index cf53436..b7f79f1 100644 >> >>>>>>>>> --- a/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts >> >>>>>>>>> +++ b/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts >> >>>>>>>>> @@ -131,6 +131,18 @@ >> >>>>>>>>> >> >>>>>>>>> &uart0 { >> >>>>>>>>> pinctrl-names = "default"; >> >>>>>>>>> - pinctrl-0 = <&uart0_gpio14>; >> >>>>>>>>> + pinctrl-0 = <&uart0_gpio32 &uart0_ctsrts_gpio30>; >> >>>>>>>>> + status = "okay"; >> >>>>>>>>> + >> >>>>>>>>> + bluetooth { >> >>>>>>>>> + compatible = "brcm,bcm43438-bt"; >> >>>>>>>>> + max-speed = <2000000>; >> >>>>>>>>> + shutdown-gpios = <&gpio 45 GPIO_ACTIVE_HIGH>; >> >>>>>>>>> + }; >> >>>>>>>>> +}; >> >>>>>>>> >> >>>>>>>> is the shutdown GPIO working as expected with this hardware. So even module unload and reload works fine? >> >>>>>>> >> >>>>>>> Yes, unload and reload works fine. >> >>>>>>> >> >>>>>>>> Meaning we are getting back to the 115200 default baud rate on the UART? >> >>>>>>> >> >>>>>>> I assume that, because reload works as expected. >> >>>>>> >> >>>>>> awesome. That is good news. >> >>>>>> >> >>>>>> Since you said that the GPIO expander driver for the RPi 3 has been accepted, did you test it there as well? If so, then it would be good to get a patch that also provides shutdown-gpios for RPi 3. >> >>>>> >> >>>>> after applying Loic's patch and the necessary patch for the RPi 3 dts file (see below), i will get this output: >> >>>>> >> >>>>> [ 4.873246] Bluetooth: HCI UART driver ver 2.3 >> >>>>> [ 4.873260] Bluetooth: HCI UART protocol H4 registered >> >>>>> [ 4.873265] Bluetooth: HCI UART protocol Three-wire (H5) registered >> >>>>> [ 4.873751] Bluetooth: HCI UART protocol Broadcom registered >> >>>>> [ 4.877279] uart-pl011 3f201000.serial: no DMA platform data >> >>>>> [ 6.952382] Bluetooth: hci0: command 0xfc18 tx timeout >> >>>>> [ 15.192298] Bluetooth: hci0: BCM: failed to write update baudrate (-110) >> >>>>> [ 15.192312] Bluetooth: hci0: Failed to set baudrate >> >>>>> [ 15.316415] Bluetooth: hci0: BCM: chip id 94 >> >>>>> [ 15.318567] Bluetooth: hci0: BCM: features 0x2e >> >>>>> [ 15.341538] Bluetooth: hci0: BCM43430A1 >> >>>>> [ 15.341560] Bluetooth: hci0: BCM43430A1 (001.002.009) build 0000 >> >>>>> [ 19.112670] Bluetooth: hci0: BCM (001.002.009) build 0360 >> >>>>> [ 274.713732] Bluetooth: hci0: command 0x0c14 tx timeout >> >>>>> [ 274.714085] Bluetooth: hci0: Frame reassembly failed (-84) >> >>>>> [ 317.275941] Bluetooth: hci0: last event is not cmd complete (0x0f) >> >>>>> >> >>>>> I don't see these errors on RPi Zero W. Maybe the reason for this is the lack of hardware flowcontrol on RPi 3. Or some of the downstream patches on BlueZ must be adapted for the kernel [1]. >> >>>>> >> >>>>> Btw the bcm43438 is detected even after unloading and reloading the driver. But the timeout occurs also on driver reload. Reducing the baudrate to 115200 doesn't help here. >> >>>> >> >>>> maybe it needs some time after switching the hardware on. Have you tried to sleep for a bit at the end of bcm_gpio_set_power? >> >>> >> >>> I will try, but this could also be an "issue" of the gpio expander >> >>> driver. AFAIK the expander is connected via I2C to the GPU. In case >> >>> the mailbox reply come before the I2C command has been handled by the >> >>> GPIO expander, we are running out of sync. >> >> >> >> The mailbox command for setting GPIO state is synchronous in terms of >> >> sending the i2c command to the GPIO expander HW. >> > >> > does that mean the driver does this correctly and really waits for the >> > completion. Or does the GPIO expander might return to quickly and >> > returns a false sense of GPIO state. I think it would be good a sleep >> > of 50ms after the GPIO makes a difference. Maybe the GPIO expander >> > driver needs to take this into account. >> >> It seems unlikely that you can get to I2C stop before the GPIO expander >> HW has changed the state of the output. >> >> > Reality is that once the Bluetooth driver toggled the GPIO, it goes >> > onto initializing the chip. One other reason might be that no device >> > wakeup GPIO is wired here, that the chip actually needs some time >> > before it is all good to go. >> >> This seems much more likely to me. The spec for bcm43438 is easily >> googleable and has a power-on timing diagram. > > after applying this patch [1] the RPi 3 specific probing errors disappear. > > But this is only a quick hack. The proper solution would be to extend hci_h5 in order to support the BCM43438. > > [1] - https://github.com/lategoodbye/rpi-zero/commit/ed5900296dfb7aec7f467477440751e7367a1881 I think this patch is perfectly acceptable, this is an hardware timing the driver has to handle. For sure H5 would improve robustness... Regards, Loic
Hi Loic, >>>>>>>>>>>> Add BCM43438 (bluetooth) as a serdev slave device of uart0 (pl011/ttyAMA0). >>>>>>>>>>>> This allows to automatically insert the bcm43438 to the bluetooth >>>>>>>>>>>> subsystem instead of relying on patched userspace helpers (hciattach). >>>>>>>>>>>> >>>>>>>>>>>> In order to keep a debug UART we need to switch to uart1. >>>>>>>>>>>> >>>>>>>>>>>> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> >>>>>>>>>>>> --- >>>>>>>>>>>> arch/arm/boot/dts/bcm2835-rpi-zero-w.dts | 14 +++++++++++++- >>>>>>>>>>>> 1 file changed, 13 insertions(+), 1 deletion(-) >>>>>>>>>>>> >>>>>>>>>>>> diff --git a/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts b/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts >>>>>>>>>>>> index cf53436..b7f79f1 100644 >>>>>>>>>>>> --- a/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts >>>>>>>>>>>> +++ b/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts >>>>>>>>>>>> @@ -131,6 +131,18 @@ >>>>>>>>>>>> >>>>>>>>>>>> &uart0 { >>>>>>>>>>>> pinctrl-names = "default"; >>>>>>>>>>>> - pinctrl-0 = <&uart0_gpio14>; >>>>>>>>>>>> + pinctrl-0 = <&uart0_gpio32 &uart0_ctsrts_gpio30>; >>>>>>>>>>>> + status = "okay"; >>>>>>>>>>>> + >>>>>>>>>>>> + bluetooth { >>>>>>>>>>>> + compatible = "brcm,bcm43438-bt"; >>>>>>>>>>>> + max-speed = <2000000>; >>>>>>>>>>>> + shutdown-gpios = <&gpio 45 GPIO_ACTIVE_HIGH>; >>>>>>>>>>>> + }; >>>>>>>>>>>> +}; >>>>>>>>>>> >>>>>>>>>>> is the shutdown GPIO working as expected with this hardware. So even module unload and reload works fine? >>>>>>>>>> >>>>>>>>>> Yes, unload and reload works fine. >>>>>>>>>> >>>>>>>>>>> Meaning we are getting back to the 115200 default baud rate on the UART? >>>>>>>>>> >>>>>>>>>> I assume that, because reload works as expected. >>>>>>>>> >>>>>>>>> awesome. That is good news. >>>>>>>>> >>>>>>>>> Since you said that the GPIO expander driver for the RPi 3 has been accepted, did you test it there as well? If so, then it would be good to get a patch that also provides shutdown-gpios for RPi 3. >>>>>>>> >>>>>>>> after applying Loic's patch and the necessary patch for the RPi 3 dts file (see below), i will get this output: >>>>>>>> >>>>>>>> [ 4.873246] Bluetooth: HCI UART driver ver 2.3 >>>>>>>> [ 4.873260] Bluetooth: HCI UART protocol H4 registered >>>>>>>> [ 4.873265] Bluetooth: HCI UART protocol Three-wire (H5) registered >>>>>>>> [ 4.873751] Bluetooth: HCI UART protocol Broadcom registered >>>>>>>> [ 4.877279] uart-pl011 3f201000.serial: no DMA platform data >>>>>>>> [ 6.952382] Bluetooth: hci0: command 0xfc18 tx timeout >>>>>>>> [ 15.192298] Bluetooth: hci0: BCM: failed to write update baudrate (-110) >>>>>>>> [ 15.192312] Bluetooth: hci0: Failed to set baudrate >>>>>>>> [ 15.316415] Bluetooth: hci0: BCM: chip id 94 >>>>>>>> [ 15.318567] Bluetooth: hci0: BCM: features 0x2e >>>>>>>> [ 15.341538] Bluetooth: hci0: BCM43430A1 >>>>>>>> [ 15.341560] Bluetooth: hci0: BCM43430A1 (001.002.009) build 0000 >>>>>>>> [ 19.112670] Bluetooth: hci0: BCM (001.002.009) build 0360 >>>>>>>> [ 274.713732] Bluetooth: hci0: command 0x0c14 tx timeout >>>>>>>> [ 274.714085] Bluetooth: hci0: Frame reassembly failed (-84) >>>>>>>> [ 317.275941] Bluetooth: hci0: last event is not cmd complete (0x0f) >>>>>>>> >>>>>>>> I don't see these errors on RPi Zero W. Maybe the reason for this is the lack of hardware flowcontrol on RPi 3. Or some of the downstream patches on BlueZ must be adapted for the kernel [1]. >>>>>>>> >>>>>>>> Btw the bcm43438 is detected even after unloading and reloading the driver. But the timeout occurs also on driver reload. Reducing the baudrate to 115200 doesn't help here. >>>>>>> >>>>>>> maybe it needs some time after switching the hardware on. Have you tried to sleep for a bit at the end of bcm_gpio_set_power? >>>>>> >>>>>> I will try, but this could also be an "issue" of the gpio expander >>>>>> driver. AFAIK the expander is connected via I2C to the GPU. In case >>>>>> the mailbox reply come before the I2C command has been handled by the >>>>>> GPIO expander, we are running out of sync. >>>>> >>>>> The mailbox command for setting GPIO state is synchronous in terms of >>>>> sending the i2c command to the GPIO expander HW. >>>> >>>> does that mean the driver does this correctly and really waits for the >>>> completion. Or does the GPIO expander might return to quickly and >>>> returns a false sense of GPIO state. I think it would be good a sleep >>>> of 50ms after the GPIO makes a difference. Maybe the GPIO expander >>>> driver needs to take this into account. >>> >>> It seems unlikely that you can get to I2C stop before the GPIO expander >>> HW has changed the state of the output. >>> >>>> Reality is that once the Bluetooth driver toggled the GPIO, it goes >>>> onto initializing the chip. One other reason might be that no device >>>> wakeup GPIO is wired here, that the chip actually needs some time >>>> before it is all good to go. >>> >>> This seems much more likely to me. The spec for bcm43438 is easily >>> googleable and has a power-on timing diagram. >> >> after applying this patch [1] the RPi 3 specific probing errors disappear. >> >> But this is only a quick hack. The proper solution would be to extend hci_h5 in order to support the BCM43438. >> >> [1] - https://github.com/lategoodbye/rpi-zero/commit/ed5900296dfb7aec7f467477440751e7367a1881 > > I think this patch is perfectly acceptable, this is an hardware timing > the driver has to handle. For sure H5 would improve robustness… don’t we have a helper function like wait for 15 msec or CTS ? I know it is not much time that we spend sleeping here, but other hardware does not need it and thus we most likely shouldn’t force a delay on them because of one hardware without hardware flow control. Regards Marcel
Hi Stefan, >>>>>>>>>>> Add BCM43438 (bluetooth) as a serdev slave device of uart0 (pl011/ttyAMA0). >>>>>>>>>>> This allows to automatically insert the bcm43438 to the bluetooth >>>>>>>>>>> subsystem instead of relying on patched userspace helpers (hciattach). >>>>>>>>>>> >>>>>>>>>>> In order to keep a debug UART we need to switch to uart1. >>>>>>>>>>> >>>>>>>>>>> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> >>>>>>>>>>> --- >>>>>>>>>>> arch/arm/boot/dts/bcm2835-rpi-zero-w.dts | 14 +++++++++++++- >>>>>>>>>>> 1 file changed, 13 insertions(+), 1 deletion(-) >>>>>>>>>>> >>>>>>>>>>> diff --git a/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts b/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts >>>>>>>>>>> index cf53436..b7f79f1 100644 >>>>>>>>>>> --- a/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts >>>>>>>>>>> +++ b/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts >>>>>>>>>>> @@ -131,6 +131,18 @@ >>>>>>>>>>> >>>>>>>>>>> &uart0 { >>>>>>>>>>> pinctrl-names = "default"; >>>>>>>>>>> - pinctrl-0 = <&uart0_gpio14>; >>>>>>>>>>> + pinctrl-0 = <&uart0_gpio32 &uart0_ctsrts_gpio30>; >>>>>>>>>>> + status = "okay"; >>>>>>>>>>> + >>>>>>>>>>> + bluetooth { >>>>>>>>>>> + compatible = "brcm,bcm43438-bt"; >>>>>>>>>>> + max-speed = <2000000>; >>>>>>>>>>> + shutdown-gpios = <&gpio 45 GPIO_ACTIVE_HIGH>; >>>>>>>>>>> + }; >>>>>>>>>>> +}; >>>>>>>>>> >>>>>>>>>> is the shutdown GPIO working as expected with this hardware. So even module unload and reload works fine? >>>>>>>>> >>>>>>>>> Yes, unload and reload works fine. >>>>>>>>> >>>>>>>>>> Meaning we are getting back to the 115200 default baud rate on the UART? >>>>>>>>> >>>>>>>>> I assume that, because reload works as expected. >>>>>>>> >>>>>>>> awesome. That is good news. >>>>>>>> >>>>>>>> Since you said that the GPIO expander driver for the RPi 3 has been accepted, did you test it there as well? If so, then it would be good to get a patch that also provides shutdown-gpios for RPi 3. >>>>>>> >>>>>>> after applying Loic's patch and the necessary patch for the RPi 3 dts file (see below), i will get this output: >>>>>>> >>>>>>> [ 4.873246] Bluetooth: HCI UART driver ver 2.3 >>>>>>> [ 4.873260] Bluetooth: HCI UART protocol H4 registered >>>>>>> [ 4.873265] Bluetooth: HCI UART protocol Three-wire (H5) registered >>>>>>> [ 4.873751] Bluetooth: HCI UART protocol Broadcom registered >>>>>>> [ 4.877279] uart-pl011 3f201000.serial: no DMA platform data >>>>>>> [ 6.952382] Bluetooth: hci0: command 0xfc18 tx timeout >>>>>>> [ 15.192298] Bluetooth: hci0: BCM: failed to write update baudrate (-110) >>>>>>> [ 15.192312] Bluetooth: hci0: Failed to set baudrate >>>>>>> [ 15.316415] Bluetooth: hci0: BCM: chip id 94 >>>>>>> [ 15.318567] Bluetooth: hci0: BCM: features 0x2e >>>>>>> [ 15.341538] Bluetooth: hci0: BCM43430A1 >>>>>>> [ 15.341560] Bluetooth: hci0: BCM43430A1 (001.002.009) build 0000 >>>>>>> [ 19.112670] Bluetooth: hci0: BCM (001.002.009) build 0360 >>>>>>> [ 274.713732] Bluetooth: hci0: command 0x0c14 tx timeout >>>>>>> [ 274.714085] Bluetooth: hci0: Frame reassembly failed (-84) >>>>>>> [ 317.275941] Bluetooth: hci0: last event is not cmd complete (0x0f) >>>>>>> >>>>>>> I don't see these errors on RPi Zero W. Maybe the reason for this is the lack of hardware flowcontrol on RPi 3. Or some of the downstream patches on BlueZ must be adapted for the kernel [1]. >>>>>>> >>>>>>> Btw the bcm43438 is detected even after unloading and reloading the driver. But the timeout occurs also on driver reload. Reducing the baudrate to 115200 doesn't help here. >>>>>> >>>>>> maybe it needs some time after switching the hardware on. Have you tried to sleep for a bit at the end of bcm_gpio_set_power? >>>>> >>>>> I will try, but this could also be an "issue" of the gpio expander >>>>> driver. AFAIK the expander is connected via I2C to the GPU. In case >>>>> the mailbox reply come before the I2C command has been handled by the >>>>> GPIO expander, we are running out of sync. >>>> >>>> The mailbox command for setting GPIO state is synchronous in terms of >>>> sending the i2c command to the GPIO expander HW. >>> >>> does that mean the driver does this correctly and really waits for the >>> completion. Or does the GPIO expander might return to quickly and >>> returns a false sense of GPIO state. I think it would be good a sleep >>> of 50ms after the GPIO makes a difference. Maybe the GPIO expander >>> driver needs to take this into account. >> >> It seems unlikely that you can get to I2C stop before the GPIO expander >> HW has changed the state of the output. >> >>> Reality is that once the Bluetooth driver toggled the GPIO, it goes >>> onto initializing the chip. One other reason might be that no device >>> wakeup GPIO is wired here, that the chip actually needs some time >>> before it is all good to go. >> >> This seems much more likely to me. The spec for bcm43438 is easily >> googleable and has a power-on timing diagram. > > after applying this patch [1] the RPi 3 specific probing errors disappear. > > But this is only a quick hack. The proper solution would be to extend hci_h5 in order to support the BCM43438. a lot of people are running everything in H:4 since it is a lot simpler. And since it is all wired so closely, you normally do not have bit error even on high speeds. However at the end of the day it is still an UART and running it without flow control is a bit funky. I looked a little bit in hci_h5.c and I don’t think it is worth trying to hack serdev support into it. It looks easy on the front, but it feels so hackish. I need to check what it takes to write a plain serdev 3-Wire UART driver that can drive serdev based Broadcom devices directly. Then we might be able to easily extend it with vendor support similar to how we do it in btusb.c. Regards Marcel
Hi Lukas, >>>>>>>> after applying Loic's patch and the necessary patch for the >>>>>>>> RPi 3 dts file (see below), i will get this output: >>>>>>>> >>>>>>>> [ 4.873246] Bluetooth: HCI UART driver ver 2.3 >>>>>>>> [ 4.873260] Bluetooth: HCI UART protocol H4 registered >>>>>>>> [ 4.873265] Bluetooth: HCI UART protocol Three-wire (H5) registered >>>>>>>> [ 4.873751] Bluetooth: HCI UART protocol Broadcom registered >>>>>>>> [ 4.877279] uart-pl011 3f201000.serial: no DMA platform data >>>>>>>> [ 6.952382] Bluetooth: hci0: command 0xfc18 tx timeout >>>>>>>> [ 15.192298] Bluetooth: hci0: BCM: failed to write update baudrate (-110) >>>>>>>> [ 15.192312] Bluetooth: hci0: Failed to set baudrate >>>>>>>> [ 15.316415] Bluetooth: hci0: BCM: chip id 94 >>>>>>>> [ 15.318567] Bluetooth: hci0: BCM: features 0x2e >>>>>>>> [ 15.341538] Bluetooth: hci0: BCM43430A1 >>>>>>>> [ 15.341560] Bluetooth: hci0: BCM43430A1 (001.002.009) build 0000 >>>>>>>> [ 19.112670] Bluetooth: hci0: BCM (001.002.009) build 0360 >>>>>>>> [ 274.713732] Bluetooth: hci0: command 0x0c14 tx timeout >>>>>>>> [ 274.714085] Bluetooth: hci0: Frame reassembly failed (-84) >>>>>>>> [ 317.275941] Bluetooth: hci0: last event is not cmd complete (0x0f) >>>>>>>> >>>>>>>> I don't see these errors on RPi Zero W. Maybe the reason for >>>>>>>> this is the lack of hardware flowcontrol on RPi 3. >>>>>>> >>>>>>> maybe it needs some time after switching the hardware on. Have >>>>>>> you tried to sleep for a bit at the end of bcm_gpio_set_power? >> >> after applying this patch [1] the RPi 3 specific probing errors disappear. >> >> But this is only a quick hack. The proper solution would be to extend >> hci_h5 in order to support the BCM43438. >> >> [1] - https://github.com/lategoodbye/rpi-zero/commit/ed5900296dfb7aec7f467477440751e7367a1881 > > Users of the MacBookPro13,1 and MacBookPro14,1 are reporting similar > timeouts when the Bluetooth controller is reset on ->setup. > > These are the models without touchbar. The models with touchbar > (MBP13,2, MBP13,3, MBP14,2, MBP14,3) as well as the 12" MacBooks > (MB8,1, MB9,1, MB10,1) do not suffer from this issue. > > Christoph Gysin (+cc) reports that applying your patch on 4.16-rc4 gets > Bluetooth working on his MBP13,1: > https://github.com/Dunedan/mbp-2016-linux/issues/29#issuecomment-371434970 > > For some reason, not toggling the device_wake pin in bcm_gpio_set_power() > also fixed the issue for those users. They did complain about stuttering > audio though. > > Users of the touchbar models reported that stuttering audio only occurs > when the GNOME Bluetooth control panel is open. Closing it made the > stuttering audio go away. But apparently on the non-touchbar models, > the stuttering persisted regardless. Both the stuttering audio as well as > the timeouts on ->setup might be explained by a lack of hardware flow > control on those models. The chipset (and thus the UART) is identical > on the touchbar versus non-touchbar models. It would seem odd if Apple > did not wire CTS consistently on all models. do you know if Apple is actually running H:4 or if they run H:5 (3-Wire) within macOS. I think the Broadcom chips will auto-detect the transport protocol. At least on the RPi3 it seems like that. Regards Marcel
diff --git a/arch/arm/boot/dts/bcm2837-rpi-3-b.dts b/arch/arm/boot/dts/bcm2837-rpi-3-b.dts index 0b31d99..3e87ed0 100644 --- a/arch/arm/boot/dts/bcm2837-rpi-3-b.dts +++ b/arch/arm/boot/dts/bcm2837-rpi-3-b.dts @@ -20,9 +20,14 @@ leds { act { - gpios = <&gpio 47 GPIO_ACTIVE_HIGH>; + gpios = <&expgpio 2 GPIO_ACTIVE_HIGH>; }; }; + + wifi_pwrseq: wifi-pwrseq { + compatible = "mmc-pwrseq-simple"; + reset-gpios = <&expgpio 1 GPIO_ACTIVE_HIGH>; + }; }; &firmware { @@ -42,6 +47,10 @@ }; }; +&hdmi { + hpd-gpios = <&expgpio 4 GPIO_ACTIVE_LOW>; +}; + /* uart0 communicates with the BT module */ &uart0 { pinctrl-names = "default"; @@ -51,6 +60,7 @@ bluetooth { compatible = "brcm,bcm43438-bt"; max-speed = <2000000>; + shutdown-gpios = <&expgpio 0 GPIO_ACTIVE_HIGH>; }; }; @@ -63,11 +73,19 @@ /* SDHCI is used to control the SDIO for wireless */ &sdhci { + #address-cells = <1>; + #size-cells = <0>; pinctrl-names = "default"; pinctrl-0 = <&emmc_gpio34>; status = "okay"; bus-width = <4>; non-removable; + mmc-pwrseq = <&wifi_pwrseq>; + + brcmf: wifi@1 { + reg = <1>; + compatible = "brcm,bcm4329-fmac"; + }; }; /* SDHOST is used to drive the SD card */