Linux v5.10 breaks AR3011 fw loading
Hey everyone,
Linux v5.10 broke firmware loading for my AR3011 Bluetooth USB adapter. A git bisect identified the following commit as the culprit:
Quoted 8 lines
commit
b40f58b973865ee98ead884d2bdc7880b896ddb8Author: Rocky Liao <[email protected]> Date: Tue Sep 29 12:23:51 2020 +0800Bluetooth: btusb: Add Qualcomm Bluetooth SoC WCN6855 support
This patch add support for WCN6855 i.e. patch and nvm download support.
The accompanying patch describes the issue further and attempts to offer a fix based on my superficial understanding, which may or may not be adequate.
Regards,
Florian
PATCH 1/1 Bluetooth: btusb: Fallback to 16 bit ROM version lookup
Commit b40f58b97386 ("Bluetooth: btusb: Add Qualcomm Bluetooth SoC WCN6855 support") changes ROM version lookup from 16 bit to 32 bit. Previously, the upper 16 bit of the version number were ignored. This breaks setups, where the upper 16 bits are non-zero, but are now assumed to be zero.
An example of such a device would be
0cf3:3008 Qualcomm Atheros Communications Bluetooth (AR3011) with ROM version 0x1020200 and this corresponding entry in the device table:
{ 0x00000200, 28, 4, 16 }, /* Rome 2.0 */
This patch adds a potential second round of lookups that mimics the old behavior, should no version have been matched by comparing the full 32 bits. During this second round only the lower 16 bits are compared, but only where the upper 16 bits are defined zero in the lookup table.
support")
--- drivers/bluetooth/btusb.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
drivers/bluetooth/btusb.c +16 -1
@@ -4054,6 +4054,7 @@ static int btusb_setup_qca(struct hci_dev *hdev)const struct qca_device_info *info =NULL ;struct qca_version ver;u32 ver_rom; +u16 ver_rom_low;u8 status;int i, err;
@@ -4065,8 +4066,22 @@ static int btusb_setup_qca(struct hci_dev *hdev) ver_rom =le32_to_cpu (ver.rom_version);for (i =0 ; i <ARRAY_SIZE (qca_devices_table); i++) { -if (ver_rom == qca_devices_table[i].rom_version) +if (ver_rom == qca_devices_table[i].rom_version) { info = &qca_devices_table[i]; +break ; + } + } +if (!info) { +// If we don't find an exact version match, try with +// the lower half, but only where the upper half is 0 + ver_rom_low = ver_rom &0xffff ; +for (i =0 ; i <ARRAY_SIZE (qca_devices_table); i++) { +if (!(qca_devices_table[i].rom_version &0xffff0000 ) && + ver_rom_low == qca_devices_table[i].rom_version) { + info = &qca_devices_table[i]; +break ; + } + } }if (!info) {bt_dev_err (hdev,"don't support firmware rome 0x%x" , ver_rom);
Signature · 1 line
2.30.0
Marcel Holtmann
maintainerRe: [PATCH] Bluetooth: btusb: Fallback to 16 bit ROM version lookup
Hi Florian,
Quoted 38 lines
Commit
b40f58b97386("Bluetooth: btusb: Add Qualcomm Bluetooth SoC WCN6855 support") changes ROM version lookup from 16 bit to 32 bit. Previously, the upper 16 bit of the version number were ignored. This breaks setups, where the upper 16 bits are non-zero, but are now assumed to be zero.An example of such a device would be
0cf3:3008 Qualcomm Atheros Communications Bluetooth (AR3011) with ROM version0x1020200and this corresponding entry in the device table:
{0x00000200, 28, 4, 16 }, /* Rome 2.0 */This patch adds a potential second round of lookups that mimics the old behavior, should no version have been matched by comparing the full 32 bits. During this second round only the lower 16 bits are compared, but only where the upper 16 bits are defined zero in the lookup table.
Fixes b40f58b97386 ("Bluetooth: btusb: Add Qualcomm Bluetooth SoC WCN6855support")
Signed-off-by Florian Albrechtskirchinger <[email protected]>---
drivers/bluetooth/btusb.c| 17 ++++++++++++++++-1 file changed, 16 insertions(+), 1 deletion(-)drivers/bluetooth/btusb.c +1
-0@@ -4054,6 +4054,7 @@ static int btusb_setup_qca(struct hci_dev *hdev)const struct qca_device_info *info =NULL ;struct qca_version ver;u32 ver_rom; +u16 ver_rom_low;u8 status;int i, err;@@ -4065,8 +4066,22 @@ static int btusb_setup_qca(struct hci_dev *hdev) ver_rom =le32_to_cpu (ver.rom_version);
drivers/bluetooth/btusb.c static int btusb_setup_qca(struct hci_dev *hdev) · line 4076
Quoted 10 lines
drivers/bluetooth/btusb.c +7
-1for (i =0 ; i <ARRAY_SIZE (qca_devices_table); i++) { -if (ver_rom == qca_devices_table[i].rom_version) +if (ver_rom == qca_devices_table[i].rom_version) { info = &qca_devices_table[i]; +break ; + } + } +if (!info) { +// If we don't find an exact version match, try with +// the lower half, but only where the upper half is 0
please use correct comment style.
drivers/bluetooth/btusb.c static int btusb_setup_qca(struct hci_dev *hdev) · line 4087
Quoted 11 lines
drivers/bluetooth/btusb.c +8
-0+ ver_rom_low = ver_rom &0xffff ; +for (i =0 ; i <ARRAY_SIZE (qca_devices_table); i++) { +if (!(qca_devices_table[i].rom_version &0xffff0000 ) && + ver_rom_low == qca_devices_table[i].rom_version) { + info = &qca_devices_table[i]; +break ; + } + } }if (!info) {bt_dev_err (hdev,"don't support firmware rome 0x%x" , ver_rom);
Regards
Marcel
Re: [PATCH] Bluetooth: btusb: Fallback to 16 bit ROM version lookup
Quoted 41 lines · Marcel Holtmann
Hi Florian,
Quoted 38 lines
Commit
b40f58b97386("Bluetooth: btusb: Add Qualcomm Bluetooth SoC WCN6855 support") changes ROM version lookup from 16 bit to 32 bit. Previously, the upper 16 bit of the version number were ignored. This breaks setups, where the upper 16 bits are non-zero, but are now assumed to be zero.An example of such a device would be
0cf3:3008 Qualcomm Atheros Communications Bluetooth (AR3011) with ROM version0x1020200and this corresponding entry in the device table:
{0x00000200, 28, 4, 16 }, /* Rome 2.0 */This patch adds a potential second round of lookups that mimics the old behavior, should no version have been matched by comparing the full 32 bits. During this second round only the lower 16 bits are compared, but only where the upper 16 bits are defined zero in the lookup table.
Fixes b40f58b97386 ("Bluetooth: btusb: Add Qualcomm Bluetooth SoC WCN6855support")
Signed-off-by Florian Albrechtskirchinger <[email protected]>---
drivers/bluetooth/btusb.c| 17 ++++++++++++++++-1 file changed, 16 insertions(+), 1 deletion(-)drivers/bluetooth/btusb.c +1
-0@@ -4054,6 +4054,7 @@ static int btusb_setup_qca(struct hci_dev *hdev)const struct qca_device_info *info =NULL ;struct qca_version ver;u32 ver_rom; +u16 ver_rom_low;u8 status;int i, err;@@ -4065,8 +4066,22 @@ static int btusb_setup_qca(struct hci_dev *hdev) ver_rom =le32_to_cpu (ver.rom_version);
Quoted 12 lines
drivers/bluetooth/btusb.c static int btusb_setup_qca(struct hci_dev *hdev) · line 4076
Quoted 10 lines
drivers/bluetooth/btusb.c +7
-1for (i =0 ; i <ARRAY_SIZE (qca_devices_table); i++) { -if (ver_rom == qca_devices_table[i].rom_version) +if (ver_rom == qca_devices_table[i].rom_version) { info = &qca_devices_table[i]; +break ; + } + } +if (!info) { +// If we don't find an exact version match, try with +// the lower half, but only where the upper half is 0 please use correct comment style.
Noted for next time. I would've expected checkpatch.pl to catch issues like that?
A proper fix by Hui Wang has already been committed to bluetooth-next.
Quoted 12 lines
drivers/bluetooth/btusb.c static int btusb_setup_qca(struct hci_dev *hdev) · line 4087
Quoted 11 lines
drivers/bluetooth/btusb.c +8
-0+ ver_rom_low = ver_rom &0xffff ; +for (i =0 ; i <ARRAY_SIZE (qca_devices_table); i++) { +if (!(qca_devices_table[i].rom_version &0xffff0000 ) && + ver_rom_low == qca_devices_table[i].rom_version) { + info = &qca_devices_table[i]; +break ; + } + } }if (!info) {bt_dev_err (hdev,"don't support firmware rome 0x%x" , ver_rom);
Quoted 3 lines
Regards
Marcel
- Florian