Skip to content

Commit

Permalink
net: stmmac: use readl_poll_timeout() function in init_systime()
Browse files Browse the repository at this point in the history
The init_systime() function use an open coded of readl_poll_timeout().
Replace the open coded handling with the proper function.

Signed-off-by: Dejin Zheng <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Dejin Zheng authored and davem330 committed Mar 16, 2020
1 parent a1dd387 commit ff8ed73
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*******************************************************************************/

#include <linux/io.h>
#include <linux/iopoll.h>
#include <linux/delay.h>
#include "common.h"
#include "stmmac_ptp.h"
Expand Down Expand Up @@ -53,7 +54,6 @@ static void config_sub_second_increment(void __iomem *ioaddr,

static int init_systime(void __iomem *ioaddr, u32 sec, u32 nsec)
{
int limit;
u32 value;

writel(sec, ioaddr + PTP_STSUR);
Expand All @@ -64,16 +64,9 @@ static int init_systime(void __iomem *ioaddr, u32 sec, u32 nsec)
writel(value, ioaddr + PTP_TCR);

/* wait for present system time initialize to complete */
limit = 10;
while (limit--) {
if (!(readl(ioaddr + PTP_TCR) & PTP_TCR_TSINIT))
break;
mdelay(10);
}
if (limit < 0)
return -EBUSY;

return 0;
return readl_poll_timeout(ioaddr + PTP_TCR, value,
!(value & PTP_TCR_TSINIT),
10000, 100000);
}

static int config_addend(void __iomem *ioaddr, u32 addend)
Expand Down

0 comments on commit ff8ed73

Please sign in to comment.