Commit b097bea1 authored by Ansuel Smith's avatar Ansuel Smith Committed by David S. Miller

net: mdio: ipq8064: add regmap config to disable REGCACHE

mdio drivers should not use REGCHACHE. Also disable locking since it's
handled by the mdio users and regmap is always accessed atomically.
Signed-off-by: default avatarAnsuel Smith <ansuelsmth@gmail.com>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 94864069
......@@ -7,10 +7,9 @@
#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/mfd/syscon.h>
#include <linux/module.h>
#include <linux/of_mdio.h>
#include <linux/phy.h>
#include <linux/of_address.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
......@@ -97,14 +96,34 @@ ipq8064_mdio_write(struct mii_bus *bus, int phy_addr, int reg_offset, u16 data)
return ipq8064_mdio_wait_busy(priv);
}
static const struct regmap_config ipq8064_mdio_regmap_config = {
.reg_bits = 32,
.reg_stride = 4,
.val_bits = 32,
.can_multi_write = false,
/* the mdio lock is used by any user of this mdio driver */
.disable_locking = true,
.cache_type = REGCACHE_NONE,
};
static int
ipq8064_mdio_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
struct ipq8064_mdio *priv;
struct resource res;
struct mii_bus *bus;
void __iomem *base;
int ret;
if (of_address_to_resource(np, 0, &res))
return -ENOMEM;
base = ioremap(res.start, resource_size(&res));
if (!base)
return -ENOMEM;
bus = devm_mdiobus_alloc_size(&pdev->dev, sizeof(*priv));
if (!bus)
return -ENOMEM;
......@@ -116,15 +135,10 @@ 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_regmap_init_mmio(&pdev->dev, base,
&ipq8064_mdio_regmap_config);
if (IS_ERR(priv->base))
return PTR_ERR(priv->base);
}
ret = of_mdiobus_register(bus, np);
if (ret)
......
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