@@ -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 ,
@@ -715,7 +720,7 @@ static void bcm4377_handle_ack(struct bcm4377_data *bcm4377,
715720 ring -> events [msgid ] = NULL ;
716721 }
717722
718- bitmap_release_region (ring -> msgids , msgid , ring -> n_entries );
723+ bitmap_release_region (ring -> msgids , msgid , 0 );
719724
720725unlock :
721726 spin_unlock_irqrestore (& ring -> lock , flags );
@@ -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+
11931206static 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};
24952530MODULE_DEVICE_TABLE (pci , bcm4377_devid_table );
0 commit comments