Skip to content

Commit 73f7375

Browse files
esbendavem330
authored andcommitted
net: ll_temac: Enable DMA when ready, not before
As soon as TAILDESCR_PTR is written, DMA transfers might start. Let's ensure we are ready to receive DMA IRQ's before doing that. Signed-off-by: Esben Haabendal <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7e97a19 commit 73f7375

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

drivers/net/ethernet/xilinx/ll_temac_main.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -314,17 +314,21 @@ static int temac_dma_bd_init(struct net_device *ndev)
314314
CHNL_CTRL_IRQ_EN | CHNL_CTRL_IRQ_ERR_EN |
315315
CHNL_CTRL_IRQ_DLY_EN | CHNL_CTRL_IRQ_COAL_EN);
316316

317-
lp->dma_out(lp, RX_CURDESC_PTR, lp->rx_bd_p);
318-
lp->dma_out(lp, RX_TAILDESC_PTR,
319-
lp->rx_bd_p + (sizeof(*lp->rx_bd_v) * (RX_BD_NUM - 1)));
320-
lp->dma_out(lp, TX_CURDESC_PTR, lp->tx_bd_p);
321-
322317
/* Init descriptor indexes */
323318
lp->tx_bd_ci = 0;
324319
lp->tx_bd_next = 0;
325320
lp->tx_bd_tail = 0;
326321
lp->rx_bd_ci = 0;
327322

323+
/* Enable RX DMA transfers */
324+
wmb();
325+
lp->dma_out(lp, RX_CURDESC_PTR, lp->rx_bd_p);
326+
lp->dma_out(lp, RX_TAILDESC_PTR,
327+
lp->rx_bd_p + (sizeof(*lp->rx_bd_v) * (RX_BD_NUM - 1)));
328+
329+
/* Prepare for TX DMA transfer */
330+
lp->dma_out(lp, TX_CURDESC_PTR, lp->tx_bd_p);
331+
328332
return 0;
329333

330334
out:
@@ -789,6 +793,7 @@ temac_start_xmit(struct sk_buff *skb, struct net_device *ndev)
789793
skb_tx_timestamp(skb);
790794

791795
/* Kick off the transfer */
796+
wmb();
792797
lp->dma_out(lp, TX_TAILDESC_PTR, tail_p); /* DMA start */
793798

794799
return NETDEV_TX_OK;

0 commit comments

Comments
 (0)