Commit 8a70aeca authored by LABBE Corentin's avatar LABBE Corentin Committed by David S. Miller

net: stmmac: Use readl_poll_timeout

The dwmac_dma_reset function use an open coded of readl_poll_timeout().
Replace the open coded handling with the proper function.
Signed-off-by: default avatarCorentin Labbe <clabbe.montjoie@gmail.com>
Acked-by: default avatarGiuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a5f48adc
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
*******************************************************************************/ *******************************************************************************/
#include <linux/io.h> #include <linux/io.h>
#include <linux/iopoll.h>
#include "common.h" #include "common.h"
#include "dwmac_dma.h" #include "dwmac_dma.h"
...@@ -25,19 +26,16 @@ ...@@ -25,19 +26,16 @@
int dwmac_dma_reset(void __iomem *ioaddr) int dwmac_dma_reset(void __iomem *ioaddr)
{ {
u32 value = readl(ioaddr + DMA_BUS_MODE); u32 value = readl(ioaddr + DMA_BUS_MODE);
int limit; int err;
/* DMA SW reset */ /* DMA SW reset */
value |= DMA_BUS_MODE_SFT_RESET; value |= DMA_BUS_MODE_SFT_RESET;
writel(value, ioaddr + DMA_BUS_MODE); writel(value, ioaddr + DMA_BUS_MODE);
limit = 10;
while (limit--) {
if (!(readl(ioaddr + DMA_BUS_MODE) & DMA_BUS_MODE_SFT_RESET))
break;
mdelay(10);
}
if (limit < 0) err = readl_poll_timeout(ioaddr + DMA_BUS_MODE, value,
!(value & DMA_BUS_MODE_SFT_RESET),
100000, 10000);
if (err)
return -EBUSY; return -EBUSY;
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment