@@ -191,8 +191,9 @@ enum dma_reg {
191
191
DMA_STATUS ,
192
192
DMA_SCB_BURST_SIZE ,
193
193
DMA_ARB_CTRL ,
194
- DMA_PRIORITY ,
195
- DMA_RING_PRIORITY ,
194
+ DMA_PRIORITY_0 ,
195
+ DMA_PRIORITY_1 ,
196
+ DMA_PRIORITY_2 ,
196
197
};
197
198
198
199
static const u8 bcmgenet_dma_regs_v3plus [] = {
@@ -201,8 +202,9 @@ static const u8 bcmgenet_dma_regs_v3plus[] = {
201
202
[DMA_STATUS ] = 0x08 ,
202
203
[DMA_SCB_BURST_SIZE ] = 0x0C ,
203
204
[DMA_ARB_CTRL ] = 0x2C ,
204
- [DMA_PRIORITY ] = 0x30 ,
205
- [DMA_RING_PRIORITY ] = 0x38 ,
205
+ [DMA_PRIORITY_0 ] = 0x30 ,
206
+ [DMA_PRIORITY_1 ] = 0x34 ,
207
+ [DMA_PRIORITY_2 ] = 0x38 ,
206
208
};
207
209
208
210
static const u8 bcmgenet_dma_regs_v2 [] = {
@@ -211,17 +213,19 @@ static const u8 bcmgenet_dma_regs_v2[] = {
211
213
[DMA_STATUS ] = 0x08 ,
212
214
[DMA_SCB_BURST_SIZE ] = 0x0C ,
213
215
[DMA_ARB_CTRL ] = 0x30 ,
214
- [DMA_PRIORITY ] = 0x34 ,
215
- [DMA_RING_PRIORITY ] = 0x3C ,
216
+ [DMA_PRIORITY_0 ] = 0x34 ,
217
+ [DMA_PRIORITY_1 ] = 0x38 ,
218
+ [DMA_PRIORITY_2 ] = 0x3C ,
216
219
};
217
220
218
221
static const u8 bcmgenet_dma_regs_v1 [] = {
219
222
[DMA_CTRL ] = 0x00 ,
220
223
[DMA_STATUS ] = 0x04 ,
221
224
[DMA_SCB_BURST_SIZE ] = 0x0C ,
222
225
[DMA_ARB_CTRL ] = 0x30 ,
223
- [DMA_PRIORITY ] = 0x34 ,
224
- [DMA_RING_PRIORITY ] = 0x3C ,
226
+ [DMA_PRIORITY_0 ] = 0x34 ,
227
+ [DMA_PRIORITY_1 ] = 0x38 ,
228
+ [DMA_PRIORITY_2 ] = 0x3C ,
225
229
};
226
230
227
231
/* Set at runtime once bcmgenet version is known */
@@ -1696,7 +1700,8 @@ static void bcmgenet_init_multiq(struct net_device *dev)
1696
1700
{
1697
1701
struct bcmgenet_priv * priv = netdev_priv (dev );
1698
1702
unsigned int i , dma_enable ;
1699
- u32 reg , dma_ctrl , ring_cfg = 0 , dma_priority = 0 ;
1703
+ u32 reg , dma_ctrl , ring_cfg = 0 ;
1704
+ u32 dma_priority [3 ] = {0 , 0 , 0 };
1700
1705
1701
1706
if (!netif_is_multiqueue (dev )) {
1702
1707
netdev_warn (dev , "called with non multi queue aware HW\n" );
@@ -1721,22 +1726,25 @@ static void bcmgenet_init_multiq(struct net_device *dev)
1721
1726
1722
1727
/* Configure ring as descriptor ring and setup priority */
1723
1728
ring_cfg |= 1 << i ;
1724
- dma_priority |= ((GENET_Q0_PRIORITY + i ) <<
1725
- (GENET_MAX_MQ_CNT + 1 ) * i );
1726
1729
dma_ctrl |= 1 << (i + DMA_RING_BUF_EN_SHIFT );
1730
+
1731
+ dma_priority [DMA_PRIO_REG_INDEX (i )] |=
1732
+ ((GENET_Q0_PRIORITY + i ) << DMA_PRIO_REG_SHIFT (i ));
1727
1733
}
1728
1734
1735
+ /* Set ring 16 priority and program the hardware registers */
1736
+ dma_priority [DMA_PRIO_REG_INDEX (DESC_INDEX )] |=
1737
+ ((GENET_Q0_PRIORITY + priv -> hw_params -> tx_queues ) <<
1738
+ DMA_PRIO_REG_SHIFT (DESC_INDEX ));
1739
+ bcmgenet_tdma_writel (priv , dma_priority [0 ], DMA_PRIORITY_0 );
1740
+ bcmgenet_tdma_writel (priv , dma_priority [1 ], DMA_PRIORITY_1 );
1741
+ bcmgenet_tdma_writel (priv , dma_priority [2 ], DMA_PRIORITY_2 );
1742
+
1729
1743
/* Enable rings */
1730
1744
reg = bcmgenet_tdma_readl (priv , DMA_RING_CFG );
1731
1745
reg |= ring_cfg ;
1732
1746
bcmgenet_tdma_writel (priv , reg , DMA_RING_CFG );
1733
1747
1734
- /* Use configured rings priority and set ring #16 priority */
1735
- reg = bcmgenet_tdma_readl (priv , DMA_RING_PRIORITY );
1736
- reg |= ((GENET_Q0_PRIORITY + priv -> hw_params -> tx_queues ) << 20 );
1737
- reg |= dma_priority ;
1738
- bcmgenet_tdma_writel (priv , reg , DMA_PRIORITY );
1739
-
1740
1748
/* Configure ring as descriptor ring and re-enable DMA if enabled */
1741
1749
reg = bcmgenet_tdma_readl (priv , DMA_CTRL );
1742
1750
reg |= dma_ctrl ;
0 commit comments