Lines Matching +full:iproc +full:- +full:mdio

1 // SPDX-License-Identifier: GPL-2.0
52 } while (timeout--); in iproc_mdio_wait_for_idle()
54 return -ETIMEDOUT; in iproc_mdio_wait_for_idle()
68 struct iproc_mdio_priv *priv = bus->priv; in iproc_mdio_read()
72 rc = iproc_mdio_wait_for_idle(priv->base); in iproc_mdio_read()
83 writel(cmd, priv->base + MII_DATA_OFFSET); in iproc_mdio_read()
85 rc = iproc_mdio_wait_for_idle(priv->base); in iproc_mdio_read()
89 cmd = readl(priv->base + MII_DATA_OFFSET) & MII_DATA_MASK; in iproc_mdio_read()
97 struct iproc_mdio_priv *priv = bus->priv; in iproc_mdio_write()
101 rc = iproc_mdio_wait_for_idle(priv->base); in iproc_mdio_write()
113 writel(cmd, priv->base + MII_DATA_OFFSET); in iproc_mdio_write()
115 rc = iproc_mdio_wait_for_idle(priv->base); in iproc_mdio_write()
128 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); in iproc_mdio_probe()
130 return -ENOMEM; in iproc_mdio_probe()
132 priv->base = devm_platform_ioremap_resource(pdev, 0); in iproc_mdio_probe()
133 if (IS_ERR(priv->base)) { in iproc_mdio_probe()
134 dev_err(&pdev->dev, "failed to ioremap register\n"); in iproc_mdio_probe()
135 return PTR_ERR(priv->base); in iproc_mdio_probe()
138 priv->mii_bus = mdiobus_alloc(); in iproc_mdio_probe()
139 if (!priv->mii_bus) { in iproc_mdio_probe()
140 dev_err(&pdev->dev, "MDIO bus alloc failed\n"); in iproc_mdio_probe()
141 return -ENOMEM; in iproc_mdio_probe()
144 bus = priv->mii_bus; in iproc_mdio_probe()
145 bus->priv = priv; in iproc_mdio_probe()
146 bus->name = "iProc MDIO bus"; in iproc_mdio_probe()
147 snprintf(bus->id, MII_BUS_ID_SIZE, "%s-%d", pdev->name, pdev->id); in iproc_mdio_probe()
148 bus->parent = &pdev->dev; in iproc_mdio_probe()
149 bus->read = iproc_mdio_read; in iproc_mdio_probe()
150 bus->write = iproc_mdio_write; in iproc_mdio_probe()
152 iproc_mdio_config_clk(priv->base); in iproc_mdio_probe()
154 rc = of_mdiobus_register(bus, pdev->dev.of_node); in iproc_mdio_probe()
156 dev_err(&pdev->dev, "MDIO bus registration failed\n"); in iproc_mdio_probe()
162 dev_info(&pdev->dev, "Broadcom iProc MDIO bus registered\n"); in iproc_mdio_probe()
175 mdiobus_unregister(priv->mii_bus); in iproc_mdio_remove()
176 mdiobus_free(priv->mii_bus); in iproc_mdio_remove()
186 iproc_mdio_config_clk(priv->base); in iproc_mdio_resume()
197 { .compatible = "brcm,iproc-mdio", },
204 .name = "iproc-mdio",
217 MODULE_DESCRIPTION("Broadcom iProc MDIO bus controller");
219 MODULE_ALIAS("platform:iproc-mdio");