net: mdio: ipq8064: add regmap config to disable REGCACHE
[ Upstream commit b097bea10215315e8ee17f88b4c1bbb521b1878c ] 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: Ansuel Smith <ansuelsmth@gmail.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
c0dd36bcb6
commit
b5713dac19
@@ -10,7 +10,7 @@
|
|||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/regmap.h>
|
#include <linux/regmap.h>
|
||||||
#include <linux/of_mdio.h>
|
#include <linux/of_mdio.h>
|
||||||
#include <linux/phy.h>
|
#include <linux/of_address.h>
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
#include <linux/mfd/syscon.h>
|
#include <linux/mfd/syscon.h>
|
||||||
|
|
||||||
@@ -96,14 +96,34 @@ ipq8064_mdio_write(struct mii_bus *bus, int phy_addr, int reg_offset, u16 data)
|
|||||||
return ipq8064_mdio_wait_busy(priv);
|
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
|
static int
|
||||||
ipq8064_mdio_probe(struct platform_device *pdev)
|
ipq8064_mdio_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct device_node *np = pdev->dev.of_node;
|
struct device_node *np = pdev->dev.of_node;
|
||||||
struct ipq8064_mdio *priv;
|
struct ipq8064_mdio *priv;
|
||||||
|
struct resource res;
|
||||||
struct mii_bus *bus;
|
struct mii_bus *bus;
|
||||||
|
void __iomem *base;
|
||||||
int ret;
|
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));
|
bus = devm_mdiobus_alloc_size(&pdev->dev, sizeof(*priv));
|
||||||
if (!bus)
|
if (!bus)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@@ -115,15 +135,10 @@ ipq8064_mdio_probe(struct platform_device *pdev)
|
|||||||
bus->parent = &pdev->dev;
|
bus->parent = &pdev->dev;
|
||||||
|
|
||||||
priv = bus->priv;
|
priv = bus->priv;
|
||||||
priv->base = device_node_to_regmap(np);
|
priv->base = devm_regmap_init_mmio(&pdev->dev, base,
|
||||||
if (IS_ERR(priv->base)) {
|
&ipq8064_mdio_regmap_config);
|
||||||
if (priv->base == ERR_PTR(-EPROBE_DEFER))
|
if (IS_ERR(priv->base))
|
||||||
return -EPROBE_DEFER;
|
|
||||||
|
|
||||||
dev_err(&pdev->dev, "error getting device regmap, error=%pe\n",
|
|
||||||
priv->base);
|
|
||||||
return PTR_ERR(priv->base);
|
return PTR_ERR(priv->base);
|
||||||
}
|
|
||||||
|
|
||||||
ret = of_mdiobus_register(bus, np);
|
ret = of_mdiobus_register(bus, np);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
Reference in New Issue
Block a user