Commit 043ee1de authored by Hemanth Puranik's avatar Hemanth Puranik Committed by David S. Miller

net: qcom/emac: Reduce timeout for mdio read/write

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: default avatarHemanth Puranik <hpuranik@codeaurora.org>
Acked-by: default avatarTimur Tabi <timur@codeaurora.org>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b59e6979
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#define MDIO_CLK_25_28 7 #define MDIO_CLK_25_28 7
#define MDIO_WAIT_TIMES 1000 #define MDIO_WAIT_TIMES 1000
#define MDIO_STATUS_DELAY_TIME 1
static int emac_mdio_read(struct mii_bus *bus, int addr, int regnum) static int emac_mdio_read(struct mii_bus *bus, int addr, int regnum)
{ {
...@@ -65,7 +66,7 @@ static int emac_mdio_read(struct mii_bus *bus, int addr, int regnum) ...@@ -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, if (readl_poll_timeout(adpt->base + EMAC_MDIO_CTRL, reg,
!(reg & (MDIO_START | MDIO_BUSY)), !(reg & (MDIO_START | MDIO_BUSY)),
100, MDIO_WAIT_TIMES * 100)) MDIO_STATUS_DELAY_TIME, MDIO_WAIT_TIMES * 100))
return -EIO; return -EIO;
return (reg >> MDIO_DATA_SHFT) & MDIO_DATA_BMSK; return (reg >> MDIO_DATA_SHFT) & MDIO_DATA_BMSK;
...@@ -88,8 +89,8 @@ static int emac_mdio_write(struct mii_bus *bus, int addr, int regnum, u16 val) ...@@ -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); writel(reg, adpt->base + EMAC_MDIO_CTRL);
if (readl_poll_timeout(adpt->base + EMAC_MDIO_CTRL, reg, if (readl_poll_timeout(adpt->base + EMAC_MDIO_CTRL, reg,
!(reg & (MDIO_START | MDIO_BUSY)), 100, !(reg & (MDIO_START | MDIO_BUSY)),
MDIO_WAIT_TIMES * 100)) MDIO_STATUS_DELAY_TIME, MDIO_WAIT_TIMES * 100))
return -EIO; return -EIO;
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