bluetooth: cyw43xxx: support autobaud feature

Newer AIROC controllers like the CYW55573 don't support changing the
baudrate in Download Mode. However, a higher baud rate can be used
directly to sent HCI Reset.

This commit adds the KConfig flag CONFIG_AIROC_DOWNLOAD_MODE to enable
the new behaviour.

Signed-off-by: Matthias Ringwald <matthias@ringwald.ch>
This commit is contained in:
Matthias Ringwald 2024-04-01 13:20:55 +02:00 committed by Dan Kalowsky
commit e50f03404e
2 changed files with 31 additions and 2 deletions

View file

@ -196,6 +196,22 @@ config AIROC_CUSTOM_FIRMWARE_HCD_BLOB
Path to BT firmware HCD file for custom or vendor CYW43xx modules. Path to BT firmware HCD file for custom or vendor CYW43xx modules.
It can be absolute path, or relative from project folder. It can be absolute path, or relative from project folder.
config AIROC_AUTOBAUD_MODE
bool "Autobaud mode"
help
Use Autobaud feature of AIROC Controller for fast firmware download
Newer AIROC Controllers such as CYW555xx only allow firmware
upload in Download Mode after a Recovery Reset.
In Download Mode the Baud Rate vendor command cannot be used
initially. Instead, Autobaud mode allows to direct use a higher
baud rate.
Autobaud mode is not required on older AIROC controllers.
https://infineon.github.io/btsdk-docs/BT-SDK/AIROC-HCI-Firmware-Download.pdf
# Change size of command lengths. It for vendor commands related to # Change size of command lengths. It for vendor commands related to
# firmware downloading. # firmware downloading.
config BT_BUF_CMD_TX_SIZE config BT_BUF_CMD_TX_SIZE

View file

@ -251,14 +251,27 @@ int bt_h4_vnd_setup(const struct device *dev)
/* BT settling time after power on */ /* BT settling time after power on */
(void)k_msleep(BT_POWER_ON_SETTLING_TIME_MS); (void)k_msleep(BT_POWER_ON_SETTLING_TIME_MS);
/* Newer controllers like CYW555xx require Download mode for firmware upload.
* In Download mode, the baudrate cannot be changed without the Minidriver.
* We use auto-baud mode to use a higher baud rate directly.
*/
if (IS_ENABLED(CONFIG_AIROC_AUTOBAUD_MODE) &&
(fw_download_speed != default_uart_speed)) {
err = bt_hci_uart_set_baudrate(dev, fw_download_speed);
if (err) {
return err;
}
}
/* Send HCI_RESET */ /* Send HCI_RESET */
err = bt_hci_cmd_send_sync(BT_HCI_OP_RESET, NULL, NULL); err = bt_hci_cmd_send_sync(BT_HCI_OP_RESET, NULL, NULL);
if (err) { if (err) {
return err; return err;
} }
/* Re-configure baudrate for BT Controller */ /* Re-configure baudrate for BT Controller (if we haven't already) */
if (fw_download_speed != default_uart_speed) { if (!IS_ENABLED(CONFIG_AIROC_AUTOBAUD_MODE) &&
(fw_download_speed != default_uart_speed)) {
err = bt_update_controller_baudrate(dev, fw_download_speed); err = bt_update_controller_baudrate(dev, fw_download_speed);
if (err) { if (err) {
return err; return err;