Skip to content

Commit 3d5f43d

Browse files
committed
Merge branch 'refs/heads/bits/100-bluetooth' into asahi-wip
2 parents 58e0a5c + 8ec770b commit 3d5f43d

5 files changed

Lines changed: 72 additions & 16 deletions

File tree

drivers/bluetooth/btintel.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2658,6 +2658,9 @@ static int btintel_setup_combined(struct hci_dev *hdev)
26582658
set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED,
26592659
&hdev->quirks);
26602660

2661+
/* These variants don't seem to support LE Coded PHY */
2662+
set_bit(HCI_QUIRK_BROKEN_LE_CODED, &hdev->quirks);
2663+
26612664
/* Setup MSFT Extension support */
26622665
btintel_set_msft_opcode(hdev, ver.hw_variant);
26632666

@@ -2729,6 +2732,9 @@ static int btintel_setup_combined(struct hci_dev *hdev)
27292732
*/
27302733
set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, &hdev->quirks);
27312734

2735+
/* These variants don't seem to support LE Coded PHY */
2736+
set_bit(HCI_QUIRK_BROKEN_LE_CODED, &hdev->quirks);
2737+
27322738
/* Set Valid LE States quirk */
27332739
set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks);
27342740

drivers/bluetooth/hci_bcm4377.c

Lines changed: 49 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,16 @@ enum bcm4377_chip {
2626
BCM4377 = 0,
2727
BCM4378,
2828
BCM4387,
29+
BCM4388,
2930
};
3031

3132
#define BCM4377_DEVICE_ID 0x5fa0
3233
#define BCM4378_DEVICE_ID 0x5f69
3334
#define BCM4387_DEVICE_ID 0x5f71
35+
#define BCM4388_DEVICE_ID 0x5f72
3436

35-
#define BCM4377_TIMEOUT 1000
37+
#define BCM4377_TIMEOUT msecs_to_jiffies(1000)
38+
#define BCM4377_BOOT_TIMEOUT msecs_to_jiffies(5000)
3639

3740
/*
3841
* These devices only support DMA transactions inside a 32bit window
@@ -506,12 +509,14 @@ struct bcm4377_hw {
506509
u32 bar0_window1;
507510
u32 bar0_window2;
508511
u32 bar0_core2_window2;
512+
u32 bar2_offset;
509513

510514
unsigned long has_bar0_core2_window2 : 1;
511515
unsigned long clear_pciecfg_subsystem_ctrl_bit19 : 1;
512516
unsigned long disable_aspm : 1;
513517
unsigned long broken_ext_scan : 1;
514518
unsigned long broken_mws_transport_config : 1;
519+
unsigned long broken_le_coded : 1;
515520

516521
int (*send_calibration)(struct bcm4377_data *bcm4377);
517522
int (*send_ptb)(struct bcm4377_data *bcm4377,
@@ -829,8 +834,8 @@ static irqreturn_t bcm4377_irq(int irq, void *data)
829834
struct bcm4377_data *bcm4377 = data;
830835
u32 bootstage, rti_status;
831836

832-
bootstage = ioread32(bcm4377->bar2 + BCM4377_BAR2_BOOTSTAGE);
833-
rti_status = ioread32(bcm4377->bar2 + BCM4377_BAR2_RTI_STATUS);
837+
bootstage = ioread32(bcm4377->bar2 + bcm4377->hw->bar2_offset + BCM4377_BAR2_BOOTSTAGE);
838+
rti_status = ioread32(bcm4377->bar2 + bcm4377->hw->bar2_offset + BCM4377_BAR2_RTI_STATUS);
834839

835840
if (bootstage != bcm4377->bootstage ||
836841
rti_status != bcm4377->rti_status) {
@@ -1190,6 +1195,14 @@ static int bcm4387_send_calibration(struct bcm4377_data *bcm4377)
11901195
bcm4377->taurus_cal_size);
11911196
}
11921197

1198+
static int bcm4388_send_calibration(struct bcm4377_data *bcm4377)
1199+
{
1200+
/* Guess that these always use beamforming */
1201+
return __bcm4378_send_calibration(
1202+
bcm4377, bcm4377->taurus_beamforming_cal_blob,
1203+
bcm4377->taurus_beamforming_cal_size);
1204+
}
1205+
11931206
static const struct firmware *bcm4377_request_blob(struct bcm4377_data *bcm4377,
11941207
const char *suffix)
11951208
{
@@ -1813,8 +1826,8 @@ static int bcm4377_boot(struct bcm4377_data *bcm4377)
18131826
int ret = 0;
18141827
u32 bootstage, rti_status;
18151828

1816-
bootstage = ioread32(bcm4377->bar2 + BCM4377_BAR2_BOOTSTAGE);
1817-
rti_status = ioread32(bcm4377->bar2 + BCM4377_BAR2_RTI_STATUS);
1829+
bootstage = ioread32(bcm4377->bar2 + bcm4377->hw->bar2_offset + BCM4377_BAR2_BOOTSTAGE);
1830+
rti_status = ioread32(bcm4377->bar2 + bcm4377->hw->bar2_offset + BCM4377_BAR2_RTI_STATUS);
18181831

18191832
if (bootstage != 0) {
18201833
dev_err(&bcm4377->pdev->dev, "bootstage is %d and not 0\n",
@@ -1848,15 +1861,18 @@ static int bcm4377_boot(struct bcm4377_data *bcm4377)
18481861
iowrite32(BCM4377_DMA_MASK,
18491862
bcm4377->bar0 + BCM4377_BAR0_HOST_WINDOW_SIZE);
18501863

1851-
iowrite32(lower_32_bits(fw_dma), bcm4377->bar2 + BCM4377_BAR2_FW_LO);
1852-
iowrite32(upper_32_bits(fw_dma), bcm4377->bar2 + BCM4377_BAR2_FW_HI);
1853-
iowrite32(fw->size, bcm4377->bar2 + BCM4377_BAR2_FW_SIZE);
1864+
iowrite32(lower_32_bits(fw_dma),
1865+
bcm4377->bar2 + bcm4377->hw->bar2_offset + BCM4377_BAR2_FW_LO);
1866+
iowrite32(upper_32_bits(fw_dma),
1867+
bcm4377->bar2 + bcm4377->hw->bar2_offset + BCM4377_BAR2_FW_HI);
1868+
iowrite32(fw->size,
1869+
bcm4377->bar2 + bcm4377->hw->bar2_offset + BCM4377_BAR2_FW_SIZE);
18541870
iowrite32(0, bcm4377->bar0 + BCM4377_BAR0_FW_DOORBELL);
18551871

18561872
dev_dbg(&bcm4377->pdev->dev, "waiting for firmware to boot\n");
18571873

18581874
ret = wait_for_completion_interruptible_timeout(&bcm4377->event,
1859-
BCM4377_TIMEOUT);
1875+
BCM4377_BOOT_TIMEOUT);
18601876
if (ret == 0) {
18611877
ret = -ETIMEDOUT;
18621878
goto out_dma_free;
@@ -1907,16 +1923,16 @@ static int bcm4377_setup_rti(struct bcm4377_data *bcm4377)
19071923
dev_dbg(&bcm4377->pdev->dev, "RTI is in state 1\n");
19081924

19091925
/* allow access to the entire IOVA space again */
1910-
iowrite32(0, bcm4377->bar2 + BCM4377_BAR2_RTI_WINDOW_LO);
1911-
iowrite32(0, bcm4377->bar2 + BCM4377_BAR2_RTI_WINDOW_HI);
1926+
iowrite32(0, bcm4377->bar2 + bcm4377->hw->bar2_offset + BCM4377_BAR2_RTI_WINDOW_LO);
1927+
iowrite32(0, bcm4377->bar2 + bcm4377->hw->bar2_offset + BCM4377_BAR2_RTI_WINDOW_HI);
19121928
iowrite32(BCM4377_DMA_MASK,
1913-
bcm4377->bar2 + BCM4377_BAR2_RTI_WINDOW_SIZE);
1929+
bcm4377->bar2 + bcm4377->hw->bar2_offset + BCM4377_BAR2_RTI_WINDOW_SIZE);
19141930

19151931
/* setup "Converged IPC" context */
19161932
iowrite32(lower_32_bits(bcm4377->ctx_dma),
1917-
bcm4377->bar2 + BCM4377_BAR2_CONTEXT_ADDR_LO);
1933+
bcm4377->bar2 + bcm4377->hw->bar2_offset + BCM4377_BAR2_CONTEXT_ADDR_LO);
19181934
iowrite32(upper_32_bits(bcm4377->ctx_dma),
1919-
bcm4377->bar2 + BCM4377_BAR2_CONTEXT_ADDR_HI);
1935+
bcm4377->bar2 + bcm4377->hw->bar2_offset + BCM4377_BAR2_CONTEXT_ADDR_HI);
19201936
iowrite32(2, bcm4377->bar0 + BCM4377_BAR0_RTI_CONTROL);
19211937

19221938
ret = wait_for_completion_interruptible_timeout(&bcm4377->event,
@@ -2372,6 +2388,8 @@ static int bcm4377_probe(struct pci_dev *pdev, const struct pci_device_id *id)
23722388
set_bit(HCI_QUIRK_BROKEN_MWS_TRANSPORT_CONFIG, &hdev->quirks);
23732389
if (bcm4377->hw->broken_ext_scan)
23742390
set_bit(HCI_QUIRK_BROKEN_EXT_SCAN, &hdev->quirks);
2391+
if (bcm4377->hw->broken_le_coded)
2392+
set_bit(HCI_QUIRK_BROKEN_LE_CODED, &hdev->quirks);
23752393

23762394
pci_set_drvdata(pdev, bcm4377);
23772395
hci_set_drvdata(hdev, bcm4377);
@@ -2461,6 +2479,7 @@ static const struct bcm4377_hw bcm4377_hw_variants[] = {
24612479
.bar0_core2_window2 = 0x18107000,
24622480
.has_bar0_core2_window2 = true,
24632481
.broken_mws_transport_config = true,
2482+
.broken_le_coded = true,
24642483
.send_calibration = bcm4378_send_calibration,
24652484
.send_ptb = bcm4378_send_ptb,
24662485
},
@@ -2474,9 +2493,24 @@ static const struct bcm4377_hw bcm4377_hw_variants[] = {
24742493
.has_bar0_core2_window2 = true,
24752494
.clear_pciecfg_subsystem_ctrl_bit19 = true,
24762495
.broken_mws_transport_config = true,
2496+
.broken_le_coded = true,
24772497
.send_calibration = bcm4387_send_calibration,
24782498
.send_ptb = bcm4378_send_ptb,
24792499
},
2500+
2501+
[BCM4388] = {
2502+
.id = 0x4388,
2503+
.otp_offset = 0x415c,
2504+
.bar2_offset = 0x200000,
2505+
.bar0_window1 = 0x18002000,
2506+
.bar0_window2 = 0x18109000,
2507+
.bar0_core2_window2 = 0x18106000,
2508+
.has_bar0_core2_window2 = true,
2509+
.broken_mws_transport_config = true,
2510+
.broken_le_coded = true,
2511+
.send_calibration = bcm4388_send_calibration,
2512+
.send_ptb = bcm4378_send_ptb,
2513+
},
24802514
};
24812515

24822516
#define BCM4377_DEVID_ENTRY(id) \
@@ -2490,6 +2524,7 @@ static const struct pci_device_id bcm4377_devid_table[] = {
24902524
BCM4377_DEVID_ENTRY(4377),
24912525
BCM4377_DEVID_ENTRY(4378),
24922526
BCM4377_DEVID_ENTRY(4387),
2527+
BCM4377_DEVID_ENTRY(4388),
24932528
{},
24942529
};
24952530
MODULE_DEVICE_TABLE(pci, bcm4377_devid_table);

include/net/bluetooth/hci.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,16 @@ enum {
309309
* to support it.
310310
*/
311311
HCI_QUIRK_BROKEN_SET_RPA_TIMEOUT,
312+
313+
/*
314+
* When this quirk is set, LE Coded PHY shall not be used. This is
315+
* required for some Intel controllers which erroneously claim to
316+
* support it but it causes problems with extended scanning.
317+
*
318+
* This quirk can be set before hci_register_dev is called or
319+
* during the hdev->setup vendor callback.
320+
*/
321+
HCI_QUIRK_BROKEN_LE_CODED,
312322
};
313323

314324
/* HCI device flags */

include/net/bluetooth/hci_core.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1713,7 +1713,9 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
17131713
#define scan_2m(dev) (((dev)->le_tx_def_phys & HCI_LE_SET_PHY_2M) || \
17141714
((dev)->le_rx_def_phys & HCI_LE_SET_PHY_2M))
17151715

1716-
#define le_coded_capable(dev) (((dev)->le_features[1] & HCI_LE_PHY_CODED))
1716+
#define le_coded_capable(dev) (((dev)->le_features[1] & HCI_LE_PHY_CODED) && \
1717+
!test_bit(HCI_QUIRK_BROKEN_LE_CODED, \
1718+
&(dev)->quirks))
17171719

17181720
#define scan_coded(dev) (((dev)->le_tx_def_phys & HCI_LE_SET_PHY_CODED) || \
17191721
((dev)->le_rx_def_phys & HCI_LE_SET_PHY_CODED))

net/bluetooth/hci_sync.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4684,7 +4684,10 @@ static const struct {
46844684
"advertised, but not supported."),
46854685
HCI_QUIRK_BROKEN(SET_RPA_TIMEOUT,
46864686
"HCI LE Set Random Private Address Timeout command is "
4687-
"advertised, but not supported.")
4687+
"advertised, but not supported."),
4688+
HCI_QUIRK_BROKEN(LE_CODED,
4689+
"HCI LE Coded PHY feature bit is set, "
4690+
"but its usage is not supported.")
46884691
};
46894692

46904693
/* This function handles hdev setup stage:

0 commit comments

Comments
 (0)