Skip to contentSkip to conversation

Bluetooth: hci_bcm: Improve FW load time on CYW55572

PATCH Superseded Hakan Jansson 6 participants 16 messages Jun 20, 2022 – Jun 29, 2022

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Bluetooth: hci_bcm: Improve FW load time on CYW55572

These patches add an optional device specific data member to specify max baudrate of a device when in autobaud mode. This allows the host to set a first baudrate higher than "init speed" to improve FW load time.

The host baudrate will later be changed to "init speed" (as usual) once FW loading is complete and the device has been reset to begin normal operation.

Hakan Jansson (4):
dt-bindings: net: broadcom-bluetooth: Add CYW55572 DT binding
Bluetooth: hci_bcm: Add DT compatible for CYW55572
Bluetooth: hci_bcm: Prevent early baudrate setting in autobaud mode
Bluetooth: hci_bcm: Increase host baudrate for CYW55572 in autobaud
mode

 .../bindings/net/broadcom-bluetooth.yaml      |  1 +
 drivers/bluetooth/hci_bcm.c                   | 24 +++++++++++++------
 2 files changed, 18 insertions(+), 7 deletions(-)

base-commit: 0b537674e072a37dec2fcefef4df2317b58aaa3f

Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/4 dt-bindings: net: broadcom-bluetooth: Add CYW55572 DT binding

CYW55572 is a Wi-Fi + Bluetooth combo device from Infineon. Extend the binding with its DT compatible.

---
 Documentation/devicetree/bindings/net/broadcom-bluetooth.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/net/broadcom-bluetooth.yaml +1 -0
index df59575840fe..71fe9b17f8f1 100644
@@ -24,6 +24,7 @@ properties:
       - brcm,bcm43540-bt
       - brcm,bcm4335a0
       - brcm,bcm4349-bt
+      - infineon,cyw55572-bt
 
   shutdown-gpios:
     maxItems: 1
Signature · 1 line
2.25.1
#2 lore raw

Re: [PATCH 1/4] dt-bindings: net: broadcom-bluetooth: Add CYW55572 DT binding

Quoted 13 lines · Hakan Jansson

CYW55572 is a Wi-Fi + Bluetooth combo device from Infineon. Extend the binding with its DT compatible.

---
 Documentation/devicetree/bindings/net/broadcom-bluetooth.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/net/broadcom-bluetooth.yaml +0 -0
index df59575840fe..71fe9b17f8f1 100644

Documentation/devicetree/bindings/net/broadcom-bluetooth.yaml properties: · line 27

Quoted 4 lines
Documentation/devicetree/bindings/net/broadcom-bluetooth.yaml +1 -0
@@ -24,6 +24,7 @@ properties:
       - brcm,bcm43540-bt
       - brcm,bcm4335a0
       - brcm,bcm4349-bt
+      - infineon,cyw55572-bt

Patch is okay, but just to be sure - is it entirely different device from Infineon or some variant of Broadcom block? Are all existing properties applicable to it as well?

Best regards,
Krzysztof

#3 lore raw

Re: [PATCH 1/4] dt-bindings: net: broadcom-bluetooth: Add CYW55572 DT binding

Hi Krzysztof,

Thanks for replying.

Quoted 8 lines · Krzysztof Kozlowski
Quoted 8 lines

CYW55572 is a Wi-Fi + Bluetooth combo device from Infineon. Extend the binding with its DT compatible.

---
  Documentation/devicetree/bindings/net/broadcom-bluetooth.yaml | 1 +
  1 file changed, 1 insertion(+)
Quoted 11 lines

Documentation/devicetree/bindings/net/broadcom-bluetooth.yaml properties: · line 27

Quoted 9 lines
Documentation/devicetree/bindings/net/broadcom-bluetooth.yaml +1 -0
index df59575840fe..71fe9b17f8f1 100644
@@ -24,6 +24,7 @@ properties:
        - brcm,bcm43540-bt
        - brcm,bcm4335a0
        - brcm,bcm4349-bt
+      - infineon,cyw55572-bt

Patch is okay, but just to be sure - is it entirely different device from Infineon or some variant of Broadcom block?

CYW55572 is a new device from Infineon. It is not the same as any Broadcom device.

Quoted 2 lines

Are all existing
properties applicable to it as well?

Yes, all existing properties are applicable.

Regards,
Håkan

maintainer
#4 lore raw

Re: [PATCH 1/4] dt-bindings: net: broadcom-bluetooth: Add CYW55572 DT binding

Quoted 25 lines · Hakan Jansson

Hi Krzysztof,

Thanks for replying.

Quoted 8 lines · Krzysztof Kozlowski
Quoted 8 lines

CYW55572 is a Wi-Fi + Bluetooth combo device from Infineon. Extend the binding with its DT compatible.

---
  Documentation/devicetree/bindings/net/broadcom-bluetooth.yaml | 1 +
  1 file changed, 1 insertion(+)
Quoted 11 lines

Documentation/devicetree/bindings/net/broadcom-bluetooth.yaml properties: · line 27

Quoted 9 lines
Documentation/devicetree/bindings/net/broadcom-bluetooth.yaml +1 -0
index df59575840fe..71fe9b17f8f1 100644
@@ -24,6 +24,7 @@ properties:
        - brcm,bcm43540-bt
        - brcm,bcm4335a0
        - brcm,bcm4349-bt
+      - infineon,cyw55572-bt

Patch is okay, but just to be sure - is it entirely different device from Infineon or some variant of Broadcom block?

Quoted 7 lines

CYW55572 is a new device from Infineon. It is not the same as any Broadcom device.

Quoted 2 lines

Are all existing
properties applicable to it as well?

Yes, all existing properties are applicable.

Including 'brcm,bt-pcm-int-params'? I don't see a BT reset signal either, but maybe that's not pinned out in the AzureWave module which was the only documentation details I could find[1].

I think a separate doc will be better as it can be more precise as to what's allowed or not. It's fine to reuse the same property names though.

Rob

[1] https://www.azurewave.com/img/infineon/AW-XH316_DS_DF_A_STD.pdf

#5 lore raw

Re: [PATCH 1/4] dt-bindings: net: broadcom-bluetooth: Add CYW55572 DT binding

Hi Rob,

Quoted 25 lines · Rob Herring
Quoted 24 lines · Hakan Jansson

Hi Krzysztof,

Thanks for replying.

Quoted 19 lines · Krzysztof Kozlowski
Quoted 13 lines

CYW55572 is a Wi-Fi + Bluetooth combo device from Infineon. Extend the binding with its DT compatible.

---
   Documentation/devicetree/bindings/net/broadcom-bluetooth.yaml | 1 +
   1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/net/broadcom-bluetooth.yaml +0 -0
index df59575840fe..71fe9b17f8f1 100644

Documentation/devicetree/bindings/net/broadcom-bluetooth.yaml properties: · line 27

Quoted 4 lines
Documentation/devicetree/bindings/net/broadcom-bluetooth.yaml +1 -0
@@ -24,6 +24,7 @@ properties:
         - brcm,bcm43540-bt
         - brcm,bcm4335a0
         - brcm,bcm4349-bt
+      - infineon,cyw55572-bt

Patch is okay, but just to be sure - is it entirely different device from Infineon or some variant of Broadcom block?

Quoted 7 lines
Quoted 6 lines

CYW55572 is a new device from Infineon. It is not the same as any Broadcom device.

Quoted 2 lines

Are all existing
properties applicable to it as well?

Yes, all existing properties are applicable.

Including 'brcm,bt-pcm-int-params'?

Yes, 'brcm,bt-pcm-int-params' is also applicable to CYW55572.

Quoted 3 lines

I don't see a BT reset signal
either, but maybe that's not pinned out in the AzureWave module which was the only documentation details I could find[1].

That's correct, CYW55572 does not have a BT reset signal. Most of the existing listed compatible devices does not seem to have a BT reset signal either so I think this is in line with the intention of the existing document and driver implementation.

Quoted 3 lines

I think a separate doc will be better as it can be more precise as to what's allowed or not. It's fine to reuse the same property names though.

I don't really see anything besides the optional BT reset property that would be changed in a separate doc.  As a separate doc would mean a duplication of data that would need to be maintained in two more or less identical docs, perhaps it would be better to modify the existing doc to clarify for which compatible devices that the BT reset property applies? (Which I believe are only these three: bcm20702a1, bcm4329-bt and bcm4330-bt)

Quoted 3 lines

Rob

[1] https://www.azurewave.com/img/infineon/AW-XH316_DS_DF_A_STD.pdf

Thanks,
Håkan

maintainer
#6 lore raw

Re: [PATCH 1/4] dt-bindings: net: broadcom-bluetooth: Add CYW55572 DT binding

Quoted 51 lines · Hakan Jansson

Hi Rob,

Quoted 25 lines · Rob Herring
Quoted 24 lines · Hakan Jansson

Hi Krzysztof,

Thanks for replying.

Quoted 19 lines · Krzysztof Kozlowski
Quoted 13 lines

CYW55572 is a Wi-Fi + Bluetooth combo device from Infineon. Extend the binding with its DT compatible.

---
   Documentation/devicetree/bindings/net/broadcom-bluetooth.yaml | 1 +
   1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/net/broadcom-bluetooth.yaml +0 -0
index df59575840fe..71fe9b17f8f1 100644

Documentation/devicetree/bindings/net/broadcom-bluetooth.yaml properties: · line 27

Quoted 4 lines
Documentation/devicetree/bindings/net/broadcom-bluetooth.yaml +1 -0
@@ -24,6 +24,7 @@ properties:
         - brcm,bcm43540-bt
         - brcm,bcm4335a0
         - brcm,bcm4349-bt
+      - infineon,cyw55572-bt

Patch is okay, but just to be sure - is it entirely different device from Infineon or some variant of Broadcom block?

Quoted 7 lines
Quoted 6 lines

CYW55572 is a new device from Infineon. It is not the same as any Broadcom device.

Quoted 2 lines

Are all existing
properties applicable to it as well?

Yes, all existing properties are applicable.

Including 'brcm,bt-pcm-int-params'?

Yes, 'brcm,bt-pcm-int-params' is also applicable to CYW55572.

Quoted 3 lines

I don't see a BT reset signal
either, but maybe that's not pinned out in the AzureWave module which was the only documentation details I could find[1].

That's correct, CYW55572 does not have a BT reset signal. Most of the existing listed compatible devices does not seem to have a BT reset signal either so I think this is in line with the intention of the existing document and driver implementation.

Quoted 3 lines

I think a separate doc will be better as it can be more precise as to what's allowed or not. It's fine to reuse the same property names though.

Quoted 7 lines

I don't really see anything besides the optional BT reset property that would be changed in a separate doc.  As a separate doc would mean a duplication of data that would need to be maintained in two more or less identical docs, perhaps it would be better to modify the existing doc to clarify for which compatible devices that the BT reset property applies? (Which I believe are only these three: bcm20702a1, bcm4329-bt and bcm4330-bt)

Okay, I guess this is fine in the same doc. Any conditionals to tighten up the constraints would be welcome.

Rob

#7 lore raw

Re: [PATCH 1/4] dt-bindings: net: broadcom-bluetooth: Add CYW55572 DT binding

Quoted 56 lines · Rob Herring
Quoted 48 lines · Hakan Jansson

Hi Rob,

Quoted 25 lines · Rob Herring
Quoted 24 lines · Hakan Jansson

Hi Krzysztof,

Thanks for replying.

Quoted 19 lines · Krzysztof Kozlowski
Quoted 13 lines

CYW55572 is a Wi-Fi + Bluetooth combo device from Infineon. Extend the binding with its DT compatible.

---
    Documentation/devicetree/bindings/net/broadcom-bluetooth.yaml | 1 +
    1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/net/broadcom-bluetooth.yaml +0 -0
index df59575840fe..71fe9b17f8f1 100644

Documentation/devicetree/bindings/net/broadcom-bluetooth.yaml properties: · line 27

Quoted 4 lines
Documentation/devicetree/bindings/net/broadcom-bluetooth.yaml +1 -0
@@ -24,6 +24,7 @@ properties:
          - brcm,bcm43540-bt
          - brcm,bcm4335a0
          - brcm,bcm4349-bt
+      - infineon,cyw55572-bt

Patch is okay, but just to be sure - is it entirely different device from Infineon or some variant of Broadcom block?

Quoted 7 lines
Quoted 6 lines

CYW55572 is a new device from Infineon. It is not the same as any Broadcom device.

Quoted 2 lines

Are all existing
properties applicable to it as well?

Yes, all existing properties are applicable.

Including 'brcm,bt-pcm-int-params'?

Yes, 'brcm,bt-pcm-int-params' is also applicable to CYW55572.

Quoted 3 lines

I don't see a BT reset signal
either, but maybe that's not pinned out in the AzureWave module which was the only documentation details I could find[1].

That's correct, CYW55572 does not have a BT reset signal. Most of the existing listed compatible devices does not seem to have a BT reset signal either so I think this is in line with the intention of the existing document and driver implementation.

Quoted 3 lines

I think a separate doc will be better as it can be more precise as to what's allowed or not. It's fine to reuse the same property names though.

Quoted 7 lines

I don't really see anything besides the optional BT reset property that would be changed in a separate doc. As a separate doc would mean a duplication of data that would need to be maintained in two more or less identical docs, perhaps it would be better to modify the existing doc to clarify for which compatible devices that the BT reset property applies? (Which I believe are only these three: bcm20702a1, bcm4329-bt and bcm4330-bt)

Quoted 4 lines

Okay, I guess this is fine in the same doc. Any conditionals to tighten up the constraints would be welcome.

Rob

Ok, I'll add a patch with conditionals and resubmit a new rev of the patch series.

/Håkan

#8 lore raw
In reply to Hakan Jansson

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=651965

---Test result---

Test Summary:

CheckPatch                    PASS      3.18 seconds
GitLint                       PASS      1.74 seconds
SubjectPrefix                 FAIL      0.30 seconds
BuildKernel                   PASS      33.93 seconds
BuildKernel32                 PASS      31.21 seconds
Incremental Build with patchesPASS      60.36 seconds
TestRunner: Setup             PASS      509.25 seconds
TestRunner: l2cap-tester      PASS      17.92 seconds
TestRunner: bnep-tester       PASS      6.17 seconds
TestRunner: mgmt-tester       PASS      107.42 seconds
TestRunner: rfcomm-tester     PASS      10.00 seconds
TestRunner: sco-tester        PASS      9.60 seconds
TestRunner: smp-tester        PASS      9.57 seconds
TestRunner: userchan-tester   PASS      6.40 seconds

Details
##############################
Test: SubjectPrefix - FAIL - 0.30 seconds
Check subject contains "Bluetooth" prefix
"Bluetooth: " is not specified in the subject

---
Regards,
Linux Bluetooth

Acked-by on v1 1/4
#9 lore raw

Re: [PATCH 1/4] dt-bindings: net: broadcom-bluetooth: Add CYW55572 DT binding

In reply to Hakan Jansson
Quoted 8 lines · Hakan Jansson

CYW55572 is a Wi-Fi + Bluetooth combo device from Infineon. Extend the binding with its DT compatible.

---
 Documentation/devicetree/bindings/net/broadcom-bluetooth.yaml | 1 +
 1 file changed, 1 insertion(+)

Best regards,
Krzysztof

#10 lore raw

PATCH 2/4 Bluetooth: hci_bcm: Add DT compatible for CYW55572

In reply to Hakan Jansson

CYW55572 is a Wi-Fi + Bluetooth combo device from Infineon.

---
 drivers/bluetooth/hci_bcm.c | 1 +
 1 file changed, 1 insertion(+)
drivers/bluetooth/hci_bcm.c +1 -0
index 6f834ff1b44b..9a129867a4c0 100644
@@ -1557,6 +1557,7 @@ static const struct of_device_id bcm_bluetooth_of_match[] = {
 	{ .compatible = "brcm,bcm4349-bt", .data = &bcm43438_device_data },
 	{ .compatible = "brcm,bcm43540-bt", .data = &bcm4354_device_data },
 	{ .compatible = "brcm,bcm4335a0" },
+	{ .compatible = "infineon,cyw55572-bt" },
 	{ },
 };
 MODULE_DEVICE_TABLE(of, bcm_bluetooth_of_match);
Signature · 1 line
2.25.1
#11 lore raw

PATCH 3/4 Bluetooth: hci_bcm: Prevent early baudrate setting in autobaud mode

In reply to Hakan Jansson

Always prevent trying to set device baudrate before calling setup() when using autobaud mode.

This was previously happening for devices which had device specific data with member no_early_set_baudrate set to 0.

---
 drivers/bluetooth/hci_bcm.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/bluetooth/hci_bcm.c +1 -4
index 9a129867a4c0..0ae627c293c5 100644
@@ -484,7 +484,7 @@ static int bcm_open(struct hci_uart *hu)
 		/* If oper_speed is set, ldisc/serdev will set the baudrate
 		 * before calling setup()
 		 */
-		if (!bcm->dev->no_early_set_baudrate)
+		if (!bcm->dev->no_early_set_baudrate && !bcm->dev->use_autobaud_mode)
 			hu->oper_speed = bcm->dev->oper_speed;
 
 		err = bcm_gpio_set_power(bcm->dev, true);
@@ -1204,9 +1204,6 @@ static int bcm_of_probe(struct bcm_device *bdev)
 {
 	bdev->use_autobaud_mode = device_property_read_bool(bdev->dev,
 							    "brcm,requires-autobaud-mode");
-	if (bdev->use_autobaud_mode)
-		bdev->no_early_set_baudrate = true;
-
 	device_property_read_u32(bdev->dev, "max-speed", &bdev->oper_speed);
 	device_property_read_u8_array(bdev->dev, "brcm,bt-pcm-int-params",
 				      bdev->pcm_int_params, 5);
Signature · 1 line
2.25.1
Reviewed-by on v1 3/4
#12 lore raw

Re: [PATCH 3/4] Bluetooth: hci_bcm: Prevent early baudrate setting in autobaud mode

Quoted 7 lines · Hakan Jansson

Always prevent trying to set device baudrate before calling setup() when using autobaud mode.

This was previously happening for devices which had device specific data with member no_early_set_baudrate set to 0.

Yours,
Linus Walleij

#13 lore raw

PATCH 4/4 Bluetooth: hci_bcm: Increase host baudrate for CYW55572 in autobaud mode

In reply to Hakan Jansson

Add device specific data for max baudrate in autobaud mode. This allows the host to use a baudrate higher than "init speed" when loading FW in autobaud mode.

---
 drivers/bluetooth/hci_bcm.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)
drivers/bluetooth/hci_bcm.c +16 -4
index 0ae627c293c5..d7e0b75db8a6 100644
@@ -53,10 +53,12 @@
  * struct bcm_device_data - device specific data
  * @no_early_set_baudrate: Disallow set baudrate before driver setup()
  * @drive_rts_on_open: drive RTS signal on ->open() when platform requires it
+ * @max_autobaud_speed: max baudrate supported by device in autobaud mode
  */
 struct bcm_device_data {
 	bool	no_early_set_baudrate;
 	bool	drive_rts_on_open;
+	u32	max_autobaud_speed;
 };
 
 /**
@@ -100,6 +102,7 @@ struct bcm_device_data {
  * @drive_rts_on_open: drive RTS signal on ->open() when platform requires it
  * @pcm_int_params: keep the initial PCM configuration
  * @use_autobaud_mode: start Bluetooth device in autobaud mode
+ * @max_autobaud_speed: max baudrate supported by device in autobaud mode
  */
 struct bcm_device {
 	/* Must be the first member, hci_serdev.c expects this. */
@@ -139,6 +142,7 @@ struct bcm_device {
 	bool			drive_rts_on_open;
 	bool			use_autobaud_mode;
 	u8			pcm_int_params[5];
+	u32			max_autobaud_speed;
 };
 
 /* generic bcm uart resources */
@@ -479,7 +483,10 @@ static int bcm_open(struct hci_uart *hu)
 		else if (bcm->dev->drive_rts_on_open)
 			hci_uart_set_flow_control(hu, true);
 
-		hu->init_speed = bcm->dev->init_speed;
+		if (bcm->dev->use_autobaud_mode && bcm->dev->max_autobaud_speed)
+			hu->init_speed = min(bcm->dev->oper_speed, bcm->dev->max_autobaud_speed);
+		else
+			hu->init_speed = bcm->dev->init_speed;
 
 		/* If oper_speed is set, ldisc/serdev will set the baudrate
 		 * before calling setup()
@@ -585,8 +592,8 @@ static int bcm_setup(struct hci_uart *hu)
 		return 0;
 
 	/* Init speed if any */
-	if (hu->init_speed)
-		speed = hu->init_speed;
+	if (bcm->dev && bcm->dev->init_speed)
+		speed = bcm->dev->init_speed;
 	else if (hu->proto->init_speed)
 		speed = hu->proto->init_speed;
 	else
@@ -1519,6 +1526,7 @@ static int bcm_serdev_probe(struct serdev_device *serdev)
 
 	data = device_get_match_data(bcmdev->dev);
 	if (data) {
+		bcmdev->max_autobaud_speed = data->max_autobaud_speed;
 		bcmdev->no_early_set_baudrate = data->no_early_set_baudrate;
 		bcmdev->drive_rts_on_open = data->drive_rts_on_open;
 	}
@@ -1542,6 +1550,10 @@ static struct bcm_device_data bcm43438_device_data = {
 	.drive_rts_on_open = true,
 };
 
+static struct bcm_device_data cyw55572_device_data = {
+	.max_autobaud_speed = 921600,
+};
+
 static const struct of_device_id bcm_bluetooth_of_match[] = {
 	{ .compatible = "brcm,bcm20702a1" },
 	{ .compatible = "brcm,bcm4329-bt" },
@@ -1554,7 +1566,7 @@ static const struct of_device_id bcm_bluetooth_of_match[] = {
 	{ .compatible = "brcm,bcm4349-bt", .data = &bcm43438_device_data },
 	{ .compatible = "brcm,bcm43540-bt", .data = &bcm4354_device_data },
 	{ .compatible = "brcm,bcm4335a0" },
-	{ .compatible = "infineon,cyw55572-bt" },
+	{ .compatible = "infineon,cyw55572-bt", .data = &cyw55572_device_data },
 	{ },
 };
 MODULE_DEVICE_TABLE(of, bcm_bluetooth_of_match);
Signature · 1 line
2.25.1
#14 lore raw

Re: [PATCH 4/4] Bluetooth: hci_bcm: Increase host baudrate for CYW55572 in autobaud mode

[Your To: header field has:

To: unlisted-recipients:; (no To-header on input)

which is added to the receiver list when replying to all in Mozilla Thunderbird 91.10.0. ]

Dear Hakan,

Am 20.06.22 um 14:01 schrieb Hakan Jansson:

Quoted 3 lines

Add device specific data for max baudrate in autobaud mode. This allows the host to use a baudrate higher than "init speed" when loading FW in autobaud mode.

Please mention 921600 in the commit message, and maybe also document what the current default is.

Please also add the measurement data to the commit message, that means, how much is the time to load the firmware decreased.

Quoted 11 lines
---
  drivers/bluetooth/hci_bcm.c | 20 ++++++++++++++++----
  1 file changed, 16 insertions(+), 4 deletions(-)
drivers/bluetooth/hci_bcm.c +0 -0
index 0ae627c293c5..d7e0b75db8a6 100644

drivers/bluetooth/hci_bcm.c line 61

Quoted 9 lines
drivers/bluetooth/hci_bcm.c +2 -0
@@ -53,10 +53,12 @@
   * struct bcm_device_data - device specific data
   * @no_early_set_baudrate: Disallow set baudrate before driver setup()
   * @drive_rts_on_open: drive RTS signal on ->open() when platform requires it
+ * @max_autobaud_speed: max baudrate supported by device in autobaud mode
   */
  struct bcm_device_data {
  	bool	no_early_set_baudrate;
  	bool	drive_rts_on_open;
+	u32	max_autobaud_speed;

Why specify the length, and not just unsigned int? Maybe also add the unit to the variable name?

Quoted 12 lines
drivers/bluetooth/hci_bcm.c +1 -0
  };
 
  /**
@@ -100,6 +102,7 @@ struct bcm_device_data {
   * @drive_rts_on_open: drive RTS signal on ->open() when platform requires it
   * @pcm_int_params: keep the initial PCM configuration
   * @use_autobaud_mode: start Bluetooth device in autobaud mode
+ * @max_autobaud_speed: max baudrate supported by device in autobaud mode
   */
  struct bcm_device {
  	/* Must be the first member, hci_serdev.c expects this. */

drivers/bluetooth/hci_bcm.c struct bcm_device { · line 145

Quoted 4 lines
drivers/bluetooth/hci_bcm.c +1 -0
@@ -139,6 +142,7 @@ struct bcm_device {
  	bool			drive_rts_on_open;
  	bool			use_autobaud_mode;
  	u8			pcm_int_params[5];
+	u32			max_autobaud_speed;

Ditto.

Quoted 46 lines
drivers/bluetooth/hci_bcm.c +11 -3
  };
 
  /* generic bcm uart resources */
@@ -479,7 +483,10 @@ static int bcm_open(struct hci_uart *hu)
  		else if (bcm->dev->drive_rts_on_open)
  			hci_uart_set_flow_control(hu, true);
 
-		hu->init_speed = bcm->dev->init_speed;
+		if (bcm->dev->use_autobaud_mode && bcm->dev->max_autobaud_speed)
+			hu->init_speed = min(bcm->dev->oper_speed, bcm->dev->max_autobaud_speed);
+		else
+			hu->init_speed = bcm->dev->init_speed;
 
  		/* If oper_speed is set, ldisc/serdev will set the baudrate
  		 * before calling setup()
@@ -585,8 +592,8 @@ static int bcm_setup(struct hci_uart *hu)
  		return 0;
 
  	/* Init speed if any */
-	if (hu->init_speed)
-		speed = hu->init_speed;
+	if (bcm->dev && bcm->dev->init_speed)
+		speed = bcm->dev->init_speed;
  	else if (hu->proto->init_speed)
  		speed = hu->proto->init_speed;
  	else
@@ -1519,6 +1526,7 @@ static int bcm_serdev_probe(struct serdev_device *serdev)
 
  	data = device_get_match_data(bcmdev->dev);
  	if (data) {
+		bcmdev->max_autobaud_speed = data->max_autobaud_speed;
  		bcmdev->no_early_set_baudrate = data->no_early_set_baudrate;
  		bcmdev->drive_rts_on_open = data->drive_rts_on_open;
  	}
@@ -1542,6 +1550,10 @@ static struct bcm_device_data bcm43438_device_data = {
  	.drive_rts_on_open = true,
  };
 
+static struct bcm_device_data cyw55572_device_data = {
+	.max_autobaud_speed = 921600,
+};
+
  static const struct of_device_id bcm_bluetooth_of_match[] = {
  	{ .compatible = "brcm,bcm20702a1" },
  	{ .compatible = "brcm,bcm4329-bt" },

drivers/bluetooth/hci_bcm.c static const struct of_device_id bcm_bluetooth_of_match[] = { · line 1572

Quoted 8 lines
drivers/bluetooth/hci_bcm.c +1 -1
@@ -1554,7 +1566,7 @@ static const struct of_device_id bcm_bluetooth_of_match[] = {
  	{ .compatible = "brcm,bcm4349-bt", .data = &bcm43438_device_data },
  	{ .compatible = "brcm,bcm43540-bt", .data = &bcm4354_device_data },
  	{ .compatible = "brcm,bcm4335a0" },
-	{ .compatible = "infineon,cyw55572-bt" },
+	{ .compatible = "infineon,cyw55572-bt", .data = &cyw55572_device_data },
  	{ },
  };
  MODULE_DEVICE_TABLE(of, bcm_bluetooth_of_match);

Kind regards,

Paul

#15 lore raw

Re: [PATCH 4/4] Bluetooth: hci_bcm: Increase host baudrate for CYW55572 in autobaud mode

Hi Paul,

Quoted 6 lines · Paul Menzel
Quoted 3 lines

Add device specific data for max baudrate in autobaud mode. This allows the host to use a baudrate higher than "init speed" when loading FW in autobaud mode.

Please mention 921600 in the commit message, and maybe also document what the current default is.

Sure, I can do that if I submit a new rev. The default is 115200.

Quoted 2 lines

Please also add the measurement data to the commit message, that means, how much is the time to load the firmware decreased.

The actual load time will depend on the specific FW used but I could add an example. It would be in the order of seconds.

Quoted 15 lines
Quoted 15 lines

---
  drivers/bluetooth/hci_bcm.c | 20 ++++++++++++++++----

  1 file changed, 16 insertions(+), 4 deletions(-)
drivers/bluetooth/hci_bcm.c +1 -0
index 0ae627c293c5..d7e0b75db8a6 100644
@@ -53,10 +53,12 @@
    * struct bcm_device_data - device specific data
    * @no_early_set_baudrate: Disallow set baudrate before driver setup()
    * @drive_rts_on_open: drive RTS signal on ->open() when platform requires it
+ * @max_autobaud_speed: max baudrate supported by device in autobaud 

mode

Quoted 8 lines
Quoted 5 lines

   */
  struct bcm_device_data {
      bool    no_early_set_baudrate;
      bool    drive_rts_on_open;
+     u32     max_autobaud_speed;

Why specify the length, and not just unsigned int? Maybe also add the unit to the variable name?

See below.

Quoted 11 lines
Quoted 11 lines

  };

  /**

drivers/bluetooth/hci_bcm.c +1 -0
@@ -100,6 +102,7 @@ struct bcm_device_data {
    * @drive_rts_on_open: drive RTS signal on ->open() when platform requires it
    * @pcm_int_params: keep the initial PCM configuration
    * @use_autobaud_mode: start Bluetooth device in autobaud mode
+ * @max_autobaud_speed: max baudrate supported by device in autobaud 

mode
   */
  struct bcm_device {

Quoted 8 lines

drivers/bluetooth/hci_bcm.c struct bcm_device { · line 145

Quoted 6 lines

      /* Must be the first member, hci_serdev.c expects this. */

drivers/bluetooth/hci_bcm.c +1 -0
@@ -139,6 +142,7 @@ struct bcm_device {
       bool                    drive_rts_on_open;
       bool                    use_autobaud_mode;
       u8                      pcm_int_params[5];
+     u32                     max_autobaud_speed;

Ditto.

I'm trying to following the style of the existing code which already had struct members "oper_speed" and "init_speed" declared as u32.

Regards,
Håkan