Skip to content

Commit

Permalink
net: stmmac: Use readl_poll_timeout
Browse files Browse the repository at this point in the history
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: Corentin Labbe <clabbe.montjoie@gmail.com>
Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
LABBE Corentin authored and David S. Miller committed Feb 8, 2017
1 parent a5f48ad commit 8a70aec
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*******************************************************************************/

#include <linux/io.h>
#include <linux/iopoll.h>
#include "common.h"
#include "dwmac_dma.h"

Expand All @@ -25,19 +26,16 @@
int dwmac_dma_reset(void __iomem *ioaddr)
{
u32 value = readl(ioaddr + DMA_BUS_MODE);
int limit;
int err;

/* DMA SW reset */
value |= DMA_BUS_MODE_SFT_RESET;
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 0;
Expand Down

0 comments on commit 8a70aec

Please sign in to comment.