Skip to content

Commit

Permalink
net: qcom/emac: Reduce timeout for mdio read/write
Browse files Browse the repository at this point in the history
Currently mdio read/write takes around ~115us as the timeout
between status check is set to 100us.
By reducing the timeout to 1us mdio read/write takes ~15us to
complete. This improves the link up event response.

Signed-off-by: Hemanth Puranik <[email protected]>
Acked-by: Timur Tabi <[email protected]>
Reviewed-by: Andrew Lunn <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Hemanth Puranik authored and davem330 committed Dec 15, 2017
1 parent b59e697 commit 043ee1d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/net/ethernet/qualcomm/emac/emac-phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#define MDIO_CLK_25_28 7

#define MDIO_WAIT_TIMES 1000
#define MDIO_STATUS_DELAY_TIME 1

static int emac_mdio_read(struct mii_bus *bus, int addr, int regnum)
{
Expand All @@ -65,7 +66,7 @@ static int emac_mdio_read(struct mii_bus *bus, int addr, int regnum)

if (readl_poll_timeout(adpt->base + EMAC_MDIO_CTRL, reg,
!(reg & (MDIO_START | MDIO_BUSY)),
100, MDIO_WAIT_TIMES * 100))
MDIO_STATUS_DELAY_TIME, MDIO_WAIT_TIMES * 100))
return -EIO;

return (reg >> MDIO_DATA_SHFT) & MDIO_DATA_BMSK;
Expand All @@ -88,8 +89,8 @@ static int emac_mdio_write(struct mii_bus *bus, int addr, int regnum, u16 val)
writel(reg, adpt->base + EMAC_MDIO_CTRL);

if (readl_poll_timeout(adpt->base + EMAC_MDIO_CTRL, reg,
!(reg & (MDIO_START | MDIO_BUSY)), 100,
MDIO_WAIT_TIMES * 100))
!(reg & (MDIO_START | MDIO_BUSY)),
MDIO_STATUS_DELAY_TIME, MDIO_WAIT_TIMES * 100))
return -EIO;

return 0;
Expand Down

0 comments on commit 043ee1d

Please sign in to comment.