@@ -586,22 +586,15 @@ mtk_wed_set_512_support(struct mtk_wed_device *dev, bool enable)
586586 }
587587}
588588
589- #define MTK_WFMDA_RX_DMA_EN BIT(2)
590- static void
591- mtk_wed_check_wfdma_rx_fill ( struct mtk_wed_device * dev , int idx )
589+ static int
590+ mtk_wed_check_wfdma_rx_fill ( struct mtk_wed_device * dev ,
591+ struct mtk_wed_ring * ring )
592592{
593- u32 val ;
594593 int i ;
595594
596- if (!(dev -> rx_ring [idx ].flags & MTK_WED_RING_CONFIGURED ))
597- return ; /* queue is not configured by mt76 */
598-
599595 for (i = 0 ; i < 3 ; i ++ ) {
600- u32 cur_idx ;
596+ u32 cur_idx = readl ( ring -> wpdma + MTK_WED_RING_OFS_CPU_IDX ) ;
601597
602- cur_idx = wed_r32 (dev ,
603- MTK_WED_WPDMA_RING_RX_DATA (idx ) +
604- MTK_WED_RING_OFS_CPU_IDX );
605598 if (cur_idx == MTK_WED_RX_RING_SIZE - 1 )
606599 break ;
607600
@@ -610,12 +603,10 @@ mtk_wed_check_wfdma_rx_fill(struct mtk_wed_device *dev, int idx)
610603
611604 if (i == 3 ) {
612605 dev_err (dev -> hw -> dev , "rx dma enable failed\n" );
613- return ;
606+ return - ETIMEDOUT ;
614607 }
615608
616- val = wifi_r32 (dev , dev -> wlan .wpdma_rx_glo - dev -> wlan .phy_base ) |
617- MTK_WFMDA_RX_DMA_EN ;
618- wifi_w32 (dev , dev -> wlan .wpdma_rx_glo - dev -> wlan .phy_base , val );
609+ return 0 ;
619610}
620611
621612static void
@@ -1546,6 +1537,7 @@ mtk_wed_configure_irq(struct mtk_wed_device *dev, u32 irq_mask)
15461537 wed_w32 (dev , MTK_WED_INT_MASK , irq_mask );
15471538}
15481539
1540+ #define MTK_WFMDA_RX_DMA_EN BIT(2)
15491541static void
15501542mtk_wed_dma_enable (struct mtk_wed_device * dev )
15511543{
@@ -1633,8 +1625,26 @@ mtk_wed_dma_enable(struct mtk_wed_device *dev)
16331625 wdma_set (dev , MTK_WDMA_WRBK_TX_CFG , MTK_WDMA_WRBK_TX_CFG_WRBK_EN );
16341626 }
16351627
1636- for (i = 0 ; i < MTK_WED_RX_QUEUES ; i ++ )
1637- mtk_wed_check_wfdma_rx_fill (dev , i );
1628+ for (i = 0 ; i < MTK_WED_RX_QUEUES ; i ++ ) {
1629+ struct mtk_wed_ring * ring = & dev -> rx_ring [i ];
1630+ u32 val ;
1631+
1632+ if (!(ring -> flags & MTK_WED_RING_CONFIGURED ))
1633+ continue ; /* queue is not configured by mt76 */
1634+
1635+ if (mtk_wed_check_wfdma_rx_fill (dev , ring )) {
1636+ dev_err (dev -> hw -> dev ,
1637+ "rx_ring(%d) dma enable failed\n" , i );
1638+ continue ;
1639+ }
1640+
1641+ val = wifi_r32 (dev ,
1642+ dev -> wlan .wpdma_rx_glo -
1643+ dev -> wlan .phy_base ) | MTK_WFMDA_RX_DMA_EN ;
1644+ wifi_w32 (dev ,
1645+ dev -> wlan .wpdma_rx_glo - dev -> wlan .phy_base ,
1646+ val );
1647+ }
16381648}
16391649
16401650static void
0 commit comments