Commit 02d056a3 authored by Marek Vasut's avatar Marek Vasut Committed by Luiz Augusto von Dentz

Bluetooth: hci_bcm: Add CYW4373A0 support

CYW4373A0 is a Wi-Fi + Bluetooth combo device from Cypress.
This chip is present e.g. on muRata 2AE module.

This chip has additional quirk where the HCI command 0xfc45, used on
older chips to switch UART clock from 24 MHz to 48 MHz, to support
baudrates over 3 Mbdps, is no longer recognized by this newer chip.
This newer chip can configure the 4 Mbdps baudrate without the need
to issue HCI command 0xfc45, so add flag to indicate this and do not
issue the command on this chip to avoid failure to set 4 Mbdps baud
rate.

It is not clear whether there is a way to determine which chip does
and which chip does not support the HCI command 0xfc45, other than
trial and error.
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarMarek Vasut <marex@denx.de>
Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
parent 892913f0
...@@ -53,11 +53,13 @@ ...@@ -53,11 +53,13 @@
* struct bcm_device_data - device specific data * struct bcm_device_data - device specific data
* @no_early_set_baudrate: Disallow set baudrate before driver setup() * @no_early_set_baudrate: Disallow set baudrate before driver setup()
* @drive_rts_on_open: drive RTS signal on ->open() when platform requires it * @drive_rts_on_open: drive RTS signal on ->open() when platform requires it
* @no_uart_clock_set: UART clock set command for >3Mbps mode is unavailable
* @max_autobaud_speed: max baudrate supported by device in autobaud mode * @max_autobaud_speed: max baudrate supported by device in autobaud mode
*/ */
struct bcm_device_data { struct bcm_device_data {
bool no_early_set_baudrate; bool no_early_set_baudrate;
bool drive_rts_on_open; bool drive_rts_on_open;
bool no_uart_clock_set;
u32 max_autobaud_speed; u32 max_autobaud_speed;
}; };
...@@ -100,6 +102,7 @@ struct bcm_device_data { ...@@ -100,6 +102,7 @@ struct bcm_device_data {
* @is_suspended: whether flow control is currently disabled * @is_suspended: whether flow control is currently disabled
* @no_early_set_baudrate: don't set_baudrate before setup() * @no_early_set_baudrate: don't set_baudrate before setup()
* @drive_rts_on_open: drive RTS signal on ->open() when platform requires it * @drive_rts_on_open: drive RTS signal on ->open() when platform requires it
* @no_uart_clock_set: UART clock set command for >3Mbps mode is unavailable
* @pcm_int_params: keep the initial PCM configuration * @pcm_int_params: keep the initial PCM configuration
* @use_autobaud_mode: start Bluetooth device in autobaud mode * @use_autobaud_mode: start Bluetooth device in autobaud mode
* @max_autobaud_speed: max baudrate supported by device in autobaud mode * @max_autobaud_speed: max baudrate supported by device in autobaud mode
...@@ -140,6 +143,7 @@ struct bcm_device { ...@@ -140,6 +143,7 @@ struct bcm_device {
#endif #endif
bool no_early_set_baudrate; bool no_early_set_baudrate;
bool drive_rts_on_open; bool drive_rts_on_open;
bool no_uart_clock_set;
bool use_autobaud_mode; bool use_autobaud_mode;
u8 pcm_int_params[5]; u8 pcm_int_params[5];
u32 max_autobaud_speed; u32 max_autobaud_speed;
...@@ -172,10 +176,11 @@ static inline void host_set_baudrate(struct hci_uart *hu, unsigned int speed) ...@@ -172,10 +176,11 @@ static inline void host_set_baudrate(struct hci_uart *hu, unsigned int speed)
static int bcm_set_baudrate(struct hci_uart *hu, unsigned int speed) static int bcm_set_baudrate(struct hci_uart *hu, unsigned int speed)
{ {
struct hci_dev *hdev = hu->hdev; struct hci_dev *hdev = hu->hdev;
struct bcm_data *bcm = hu->priv;
struct sk_buff *skb; struct sk_buff *skb;
struct bcm_update_uart_baud_rate param; struct bcm_update_uart_baud_rate param;
if (speed > 3000000) { if (speed > 3000000 && !bcm->dev->no_uart_clock_set) {
struct bcm_write_uart_clock_setting clock; struct bcm_write_uart_clock_setting clock;
clock.type = BCM_UART_CLOCK_48MHZ; clock.type = BCM_UART_CLOCK_48MHZ;
...@@ -1529,6 +1534,7 @@ static int bcm_serdev_probe(struct serdev_device *serdev) ...@@ -1529,6 +1534,7 @@ static int bcm_serdev_probe(struct serdev_device *serdev)
bcmdev->max_autobaud_speed = data->max_autobaud_speed; bcmdev->max_autobaud_speed = data->max_autobaud_speed;
bcmdev->no_early_set_baudrate = data->no_early_set_baudrate; bcmdev->no_early_set_baudrate = data->no_early_set_baudrate;
bcmdev->drive_rts_on_open = data->drive_rts_on_open; bcmdev->drive_rts_on_open = data->drive_rts_on_open;
bcmdev->no_uart_clock_set = data->no_uart_clock_set;
} }
return hci_uart_register_device(&bcmdev->serdev_hu, &bcm_proto); return hci_uart_register_device(&bcmdev->serdev_hu, &bcm_proto);
...@@ -1550,6 +1556,10 @@ static struct bcm_device_data bcm43438_device_data = { ...@@ -1550,6 +1556,10 @@ static struct bcm_device_data bcm43438_device_data = {
.drive_rts_on_open = true, .drive_rts_on_open = true,
}; };
static struct bcm_device_data cyw4373a0_device_data = {
.no_uart_clock_set = true,
};
static struct bcm_device_data cyw55572_device_data = { static struct bcm_device_data cyw55572_device_data = {
.max_autobaud_speed = 921600, .max_autobaud_speed = 921600,
}; };
...@@ -1566,6 +1576,7 @@ static const struct of_device_id bcm_bluetooth_of_match[] = { ...@@ -1566,6 +1576,7 @@ static const struct of_device_id bcm_bluetooth_of_match[] = {
{ .compatible = "brcm,bcm4349-bt", .data = &bcm43438_device_data }, { .compatible = "brcm,bcm4349-bt", .data = &bcm43438_device_data },
{ .compatible = "brcm,bcm43540-bt", .data = &bcm4354_device_data }, { .compatible = "brcm,bcm43540-bt", .data = &bcm4354_device_data },
{ .compatible = "brcm,bcm4335a0" }, { .compatible = "brcm,bcm4335a0" },
{ .compatible = "cypress,cyw4373a0-bt", .data = &cyw4373a0_device_data },
{ .compatible = "infineon,cyw55572-bt", .data = &cyw55572_device_data }, { .compatible = "infineon,cyw55572-bt", .data = &cyw55572_device_data },
{ }, { },
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment