Skip to content

Commit 45d0da4

Browse files
Dejin Zhengdavem330
authored andcommitted
net: stmmac: use readl_poll_timeout() function in dwmac4_dma_reset()
The dwmac4_dma_reset() function use an open coded of readl_poll_timeout(). Replace the open coded handling with the proper function. Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent ff8ed73 commit 45d0da4

1 file changed

Lines changed: 4 additions & 11 deletions

File tree

‎drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c‎

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77

88
#include <linux/io.h>
9+
#include <linux/iopoll.h>
910
#include <linux/delay.h>
1011
#include "common.h"
1112
#include "dwmac4_dma.h"
@@ -14,22 +15,14 @@
1415
int dwmac4_dma_reset(void __iomem *ioaddr)
1516
{
1617
u32 value = readl(ioaddr + DMA_BUS_MODE);
17-
int limit;
1818

1919
/* DMA SW reset */
2020
value |= DMA_BUS_MODE_SFT_RESET;
2121
writel(value, ioaddr + DMA_BUS_MODE);
22-
limit = 10;
23-
while (limit--) {
24-
if (!(readl(ioaddr + DMA_BUS_MODE) & DMA_BUS_MODE_SFT_RESET))
25-
break;
26-
mdelay(10);
27-
}
28-
29-
if (limit < 0)
30-
return -EBUSY;
3122

32-
return 0;
23+
return readl_poll_timeout(ioaddr + DMA_BUS_MODE, value,
24+
!(value & DMA_BUS_MODE_SFT_RESET),
25+
10000, 100000);
3326
}
3427

3528
void dwmac4_set_rx_tail_ptr(void __iomem *ioaddr, u32 tail_ptr, u32 chan)

0 commit comments

Comments
 (0)