@@ -37,7 +37,7 @@
#define MII_MDIO_RETRY_MSEC (10)
struct ipq8064_mdio {
- struct regmap *base; /* NSS_GMAC0_BASE */
+ void __iomem *base; /* NSS_GMAC0_BASE */
};
static int
@@ -45,9 +45,9 @@ ipq8064_mdio_wait_busy(struct ipq8064_mdio *priv)
{
u32 busy;
- return regmap_read_poll_timeout(priv->base, MII_ADDR_REG_ADDR, busy,
- !(busy & MII_BUSY), MII_MDIO_DELAY_USEC,
- MII_MDIO_RETRY_MSEC * USEC_PER_MSEC);
+ return readl_poll_timeout(priv->base + MII_ADDR_REG_ADDR, busy,
+ !(busy & MII_BUSY), MII_MDIO_DELAY_USEC,
+ MII_MDIO_RETRY_MSEC * USEC_PER_MSEC);
}
static int
@@ -55,7 +55,6 @@ ipq8064_mdio_read(struct mii_bus *bus, int phy_addr, int reg_offset)
{
u32 miiaddr = MII_BUSY | MII_CLKRANGE_250_300M;
struct ipq8064_mdio *priv = bus->priv;
- u32 ret_val;
int err;
/* Reject clause 45 */
@@ -65,15 +64,14 @@ ipq8064_mdio_read(struct mii_bus *bus, int phy_addr, int reg_offset)
miiaddr |= ((phy_addr << MII_ADDR_SHIFT) & MII_ADDR_MASK) |
((reg_offset << MII_REG_SHIFT) & MII_REG_MASK);
- regmap_write(priv->base, MII_ADDR_REG_ADDR, miiaddr);
+ writel(miiaddr, priv->base + MII_ADDR_REG_ADDR);
usleep_range(8, 10);
err = ipq8064_mdio_wait_busy(priv);
if (err)
return err;
- regmap_read(priv->base, MII_DATA_REG_ADDR, &ret_val);
- return (int)ret_val;
+ return (int)readl(priv->base + MII_DATA_REG_ADDR);
}
static int
@@ -86,12 +84,12 @@ ipq8064_mdio_write(struct mii_bus *bus, int phy_addr, int reg_offset, u16 data)
if (reg_offset & MII_ADDR_C45)
return -EOPNOTSUPP;
- regmap_write(priv->base, MII_DATA_REG_ADDR, data);
+ writel(data, priv->base + MII_DATA_REG_ADDR);
miiaddr |= ((phy_addr << MII_ADDR_SHIFT) & MII_ADDR_MASK) |
((reg_offset << MII_REG_SHIFT) & MII_REG_MASK);
- regmap_write(priv->base, MII_ADDR_REG_ADDR, miiaddr);
+ writel(miiaddr, priv->base + MII_ADDR_REG_ADDR);
usleep_range(8, 10);
return ipq8064_mdio_wait_busy(priv);
@@ -116,15 +114,9 @@ ipq8064_mdio_probe(struct platform_device *pdev)
bus->parent = &pdev->dev;
priv = bus->priv;
- priv->base = device_node_to_regmap(np);
- if (IS_ERR(priv->base)) {
- if (priv->base == ERR_PTR(-EPROBE_DEFER))
- return -EPROBE_DEFER;
-
- dev_err(&pdev->dev, "error getting device regmap, error=%pe\n",
- priv->base);
+ priv->base = devm_platform_ioremap_resource(pdev, 0);
+ if (IS_ERR(priv->base))
return PTR_ERR(priv->base);
- }
ret = of_mdiobus_register(bus, np);
if (ret)
Use readl/writel function instead of regmap function to make sure no value is cached and align to other similar mdio driver. Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com> --- drivers/net/mdio/mdio-ipq8064.c | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-)