* [PATCH v2] Bluetooth: btnxpuart: Add an error message if FW dump trigger fails
@ 2025-04-03 15:02 Neeraj Sanjay Kale
2025-04-03 15:02 ` [PATCH v1] Bluetooth: btnxpuart: Revert baudrate change in nxp_shutdown Neeraj Sanjay Kale
2025-04-03 20:20 ` [PATCH v2] Bluetooth: btnxpuart: Add an error message if FW dump trigger fails patchwork-bot+bluetooth
0 siblings, 2 replies; 4+ messages in thread
From: Neeraj Sanjay Kale @ 2025-04-03 15:02 UTC (permalink / raw)
To: marcel, luiz.dentz
Cc: linux-bluetooth, linux-kernel, amitkumar.karwar,
neeraj.sanjaykale, sherry.sun
This prints an error message if the FW Dump trigger command fails. This
scenario is mainly observed in legacy chipsets 8987 and 8997 and also
IW416, where this feature is unavailable due to memory constraints.
Fixes: 998e447f443f ("Bluetooth: btnxpuart: Add support for HCI coredump feature")
Signed-off-by: Neeraj Sanjay Kale <neeraj.sanjaykale@nxp.com>
---
v2: Create this as a separate patch. (Neeraj)
---
drivers/bluetooth/btnxpuart.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/bluetooth/btnxpuart.c b/drivers/bluetooth/btnxpuart.c
index 5091dea762a0..96dd098cee98 100644
--- a/drivers/bluetooth/btnxpuart.c
+++ b/drivers/bluetooth/btnxpuart.c
@@ -1286,7 +1286,9 @@ static void nxp_coredump(struct hci_dev *hdev)
u8 pcmd = 2;
skb = nxp_drv_send_cmd(hdev, HCI_NXP_TRIGGER_DUMP, 1, &pcmd);
- if (!IS_ERR(skb))
+ if (IS_ERR(skb))
+ bt_dev_err(hdev, "Failed to trigger FW Dump. (%ld)", PTR_ERR(skb));
+ else
kfree_skb(skb);
}
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v1] Bluetooth: btnxpuart: Revert baudrate change in nxp_shutdown
2025-04-03 15:02 [PATCH v2] Bluetooth: btnxpuart: Add an error message if FW dump trigger fails Neeraj Sanjay Kale
@ 2025-04-03 15:02 ` Neeraj Sanjay Kale
2025-04-03 20:20 ` patchwork-bot+bluetooth
2025-04-03 20:20 ` [PATCH v2] Bluetooth: btnxpuart: Add an error message if FW dump trigger fails patchwork-bot+bluetooth
1 sibling, 1 reply; 4+ messages in thread
From: Neeraj Sanjay Kale @ 2025-04-03 15:02 UTC (permalink / raw)
To: marcel, luiz.dentz
Cc: linux-bluetooth, linux-kernel, amitkumar.karwar,
neeraj.sanjaykale, sherry.sun
This reverts the change baudrate logic in nxp_shutdown.
Earlier, when the driver was removed, it restored the controller
baudrate to fw_init_baudrate, so that on re-loading the driver, things
work fine.
However, if the driver was removed while hci0 interface is down, the
change baudrate vendor command could not be sent by the driver. When the
driver was re-loaded, host and controller baudrate would be mismatched
and hci initialization would fail. The only way to recover would be to
reboot the system.
This issue was fixed by moving the restore baudrate logic from
nxp_serdev_remove() to nxp_shutdown().
This fix however caused another issue with the command "hciconfig hci0
reset", which makes hci0 DOWN and UP immediately.
Running "bluetoothctl power off" and "bluetoothctl power on" in a tight
loop works fine.
To maintain support for "hciconfig reset" command, the above mentioned fix
is reverted.
Fixes: 6fca6781d19d ("Bluetooth: btnxpuart: Move vendor specific initialization to .post_init")
Signed-off-by: Neeraj Sanjay Kale <neeraj.sanjaykale@nxp.com>
---
drivers/bluetooth/btnxpuart.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/drivers/bluetooth/btnxpuart.c b/drivers/bluetooth/btnxpuart.c
index 96dd098cee98..604ab2bba231 100644
--- a/drivers/bluetooth/btnxpuart.c
+++ b/drivers/bluetooth/btnxpuart.c
@@ -1447,9 +1447,6 @@ static int nxp_shutdown(struct hci_dev *hdev)
/* HCI_NXP_IND_RESET command may not returns any response */
if (!IS_ERR(skb))
kfree_skb(skb);
- } else if (nxpdev->current_baudrate != nxpdev->fw_init_baudrate) {
- nxpdev->new_baudrate = nxpdev->fw_init_baudrate;
- nxp_set_baudrate_cmd(hdev, NULL);
}
return 0;
@@ -1801,13 +1798,15 @@ static void nxp_serdev_remove(struct serdev_device *serdev)
clear_bit(BTNXPUART_FW_DOWNLOADING, &nxpdev->tx_state);
wake_up_interruptible(&nxpdev->check_boot_sign_wait_q);
wake_up_interruptible(&nxpdev->fw_dnld_done_wait_q);
- }
-
- if (test_bit(HCI_RUNNING, &hdev->flags)) {
- /* Ensure shutdown callback is executed before unregistering, so
- * that baudrate is reset to initial value.
+ } else {
+ /* Restore FW baudrate to fw_init_baudrate if changed.
+ * This will ensure FW baudrate is in sync with
+ * driver baudrate in case this driver is re-inserted.
*/
- nxp_shutdown(hdev);
+ if (nxpdev->current_baudrate != nxpdev->fw_init_baudrate) {
+ nxpdev->new_baudrate = nxpdev->fw_init_baudrate;
+ nxp_set_baudrate_cmd(hdev, NULL);
+ }
}
ps_cleanup(nxpdev);
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] Bluetooth: btnxpuart: Add an error message if FW dump trigger fails
2025-04-03 15:02 [PATCH v2] Bluetooth: btnxpuart: Add an error message if FW dump trigger fails Neeraj Sanjay Kale
2025-04-03 15:02 ` [PATCH v1] Bluetooth: btnxpuart: Revert baudrate change in nxp_shutdown Neeraj Sanjay Kale
@ 2025-04-03 20:20 ` patchwork-bot+bluetooth
1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+bluetooth @ 2025-04-03 20:20 UTC (permalink / raw)
To: Neeraj Sanjay Kale
Cc: marcel, luiz.dentz, linux-bluetooth, linux-kernel,
amitkumar.karwar, sherry.sun
Hello:
This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Thu, 3 Apr 2025 20:32:22 +0530 you wrote:
> This prints an error message if the FW Dump trigger command fails. This
> scenario is mainly observed in legacy chipsets 8987 and 8997 and also
> IW416, where this feature is unavailable due to memory constraints.
>
> Fixes: 998e447f443f ("Bluetooth: btnxpuart: Add support for HCI coredump feature")
> Signed-off-by: Neeraj Sanjay Kale <neeraj.sanjaykale@nxp.com>
>
> [...]
Here is the summary with links:
- [v2] Bluetooth: btnxpuart: Add an error message if FW dump trigger fails
https://git.kernel.org/bluetooth/bluetooth-next/c/061e4972c48c
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] Bluetooth: btnxpuart: Revert baudrate change in nxp_shutdown
2025-04-03 15:02 ` [PATCH v1] Bluetooth: btnxpuart: Revert baudrate change in nxp_shutdown Neeraj Sanjay Kale
@ 2025-04-03 20:20 ` patchwork-bot+bluetooth
0 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+bluetooth @ 2025-04-03 20:20 UTC (permalink / raw)
To: Neeraj Sanjay Kale
Cc: marcel, luiz.dentz, linux-bluetooth, linux-kernel,
amitkumar.karwar, sherry.sun
Hello:
This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Thu, 3 Apr 2025 20:32:23 +0530 you wrote:
> This reverts the change baudrate logic in nxp_shutdown.
>
> Earlier, when the driver was removed, it restored the controller
> baudrate to fw_init_baudrate, so that on re-loading the driver, things
> work fine.
>
> However, if the driver was removed while hci0 interface is down, the
> change baudrate vendor command could not be sent by the driver. When the
> driver was re-loaded, host and controller baudrate would be mismatched
> and hci initialization would fail. The only way to recover would be to
> reboot the system.
>
> [...]
Here is the summary with links:
- [v1] Bluetooth: btnxpuart: Revert baudrate change in nxp_shutdown
https://git.kernel.org/bluetooth/bluetooth-next/c/17931d1b6d0c
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-04-03 20:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-03 15:02 [PATCH v2] Bluetooth: btnxpuart: Add an error message if FW dump trigger fails Neeraj Sanjay Kale
2025-04-03 15:02 ` [PATCH v1] Bluetooth: btnxpuart: Revert baudrate change in nxp_shutdown Neeraj Sanjay Kale
2025-04-03 20:20 ` patchwork-bot+bluetooth
2025-04-03 20:20 ` [PATCH v2] Bluetooth: btnxpuart: Add an error message if FW dump trigger fails patchwork-bot+bluetooth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox