RE: [PATCH v1 2/2] Bluetooth: btnxpuart: Fix nxp_setup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Marcel,

Thank you for your patch. This change looks good to me.

I think the scenario you are testing/resolving is:
1) Load btnxpuart.ko first (which "may" load BT-only FW if chip is powered on)
2) Power cycle or power on chip
3) Load WLAN driver with combo FW
Right?

Thanks,
Neeraj

> From: Marcel Ziswiler <marcel@xxxxxxxxxxxx>
> Sent: Wednesday, October 18, 2023 8:26 PM
> To: linux-bluetooth@xxxxxxxxxxxxxxx
> Cc: Sherry Sun <sherry.sun@xxxxxxx>; Johan Hedberg
> <johan.hedberg@xxxxxxxxx>; Luiz Augusto von Dentz
> <luiz.dentz@xxxxxxxxx>; Neeraj sanjay kale <neeraj.sanjaykale@xxxxxxx>;
> linux-kernel@xxxxxxxxxxxxxxx; Marcel Holtmann <marcel@xxxxxxxxxxxx>;
> Marcel Ziswiler <marcel.ziswiler@xxxxxxxxxxx>; Amitkumar Karwar
> <amitkumar.karwar@xxxxxxx>; Ilpo Järvinen <ilpo.jarvinen@xxxxxxxxxxxxxxx>
> Subject: [PATCH v1 2/2] Bluetooth: btnxpuart: Fix nxp_setup
> 
> From: Marcel Ziswiler <marcel.ziswiler@xxxxxxxxxxx>
> 
> Unfortunately, nxp_setup() may inadvertently assume that the firmware is
> already running while the module is not even powered yet.
> Fix this by waiting up to 10 seconds for the CTS to go up as the combo
> firmware might be loaded by the Wi-Fi driver over SDIO (mwifiex_sdio).
> 
> Fixes: 689ca16e5232 ("Bluetooth: NXP: Add protocol support for NXP
> Bluetooth chipsets")
> 
> Signed-off-by: Marcel Ziswiler <marcel.ziswiler@xxxxxxxxxxx>
> 
> ---
> This is what may happen without this fix:
> [  284.588177] Bluetooth: hci0: Opcode 0x0c03 failed: -110 [  286.636167]
> Bluetooth: hci0: Setting wake-up method failed (-110) Unfortunately, even
> re-loading the btnxpuart kernel module would not recover from this
> condition.
> 
>  drivers/bluetooth/btnxpuart.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/bluetooth/btnxpuart.c b/drivers/bluetooth/btnxpuart.c
> index 9cb7529eef09..4b83a0aa3459 100644
> --- a/drivers/bluetooth/btnxpuart.c
> +++ b/drivers/bluetooth/btnxpuart.c
> @@ -1021,6 +1021,16 @@ static int nxp_setup(struct hci_dev *hdev)
>                 if (err < 0)
>                         return err;
>         } else {
> +               /* The combo firmware might be loaded by the Wi-Fi driver over
> SDIO (mwifiex_sdio).
> +                * We wait up to 10s for the CTS to go up. Afterwards, we know that
> the firmware is
> +                * really ready.
> +                */
> +               err = serdev_device_wait_for_cts(nxpdev->serdev, true, 10000);
> +               if (err) {
> +                       bt_dev_err(nxpdev->hdev, "Wait for CTS failed with %d", err);
> +                       return err;
> +               }
> +
>                 bt_dev_dbg(hdev, "FW already running.");
>                 clear_bit(BTNXPUART_FW_DOWNLOADING, &nxpdev->tx_state);
>         }
> --
> 2.36.1





[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux