Lines Matching +full:ast2600 +full:- +full:mdio

1 // SPDX-License-Identifier: GPL-2.0-or-later
8 #include <linux/mdio.h>
15 #define DRV_NAME "mdio-aspeed"
51 struct aspeed_mdio *ctx = bus->priv; in aspeed_mdio_op()
54 dev_dbg(&bus->dev, "%s: st: %u op: %u, phyad: %u, regad: %u, data: %u\n", in aspeed_mdio_op()
64 iowrite32(ctrl, ctx->base + ASPEED_MDIO_CTRL); in aspeed_mdio_op()
66 return readl_poll_timeout(ctx->base + ASPEED_MDIO_CTRL, ctrl, in aspeed_mdio_op()
74 struct aspeed_mdio *ctx = bus->priv; in aspeed_mdio_get_data()
78 rc = readl_poll_timeout(ctx->base + ASPEED_MDIO_DATA, data, in aspeed_mdio_get_data()
144 dev_dbg(&bus->dev, "%s: addr: %d, regnum: %d\n", __func__, addr, in aspeed_mdio_read()
155 dev_dbg(&bus->dev, "%s: addr: %d, regnum: %d, val: 0x%x\n", in aspeed_mdio_write()
170 bus = devm_mdiobus_alloc_size(&pdev->dev, sizeof(*ctx)); in aspeed_mdio_probe()
172 return -ENOMEM; in aspeed_mdio_probe()
174 ctx = bus->priv; in aspeed_mdio_probe()
175 ctx->base = devm_platform_ioremap_resource(pdev, 0); in aspeed_mdio_probe()
176 if (IS_ERR(ctx->base)) in aspeed_mdio_probe()
177 return PTR_ERR(ctx->base); in aspeed_mdio_probe()
179 ctx->reset = devm_reset_control_get_optional_shared(&pdev->dev, NULL); in aspeed_mdio_probe()
180 if (IS_ERR(ctx->reset)) in aspeed_mdio_probe()
181 return PTR_ERR(ctx->reset); in aspeed_mdio_probe()
183 reset_control_deassert(ctx->reset); in aspeed_mdio_probe()
185 bus->name = DRV_NAME; in aspeed_mdio_probe()
186 snprintf(bus->id, MII_BUS_ID_SIZE, "%s%d", pdev->name, pdev->id); in aspeed_mdio_probe()
187 bus->parent = &pdev->dev; in aspeed_mdio_probe()
188 bus->read = aspeed_mdio_read; in aspeed_mdio_probe()
189 bus->write = aspeed_mdio_write; in aspeed_mdio_probe()
190 bus->probe_capabilities = MDIOBUS_C22_C45; in aspeed_mdio_probe()
192 rc = of_mdiobus_register(bus, pdev->dev.of_node); in aspeed_mdio_probe()
194 dev_err(&pdev->dev, "Cannot register MDIO bus!\n"); in aspeed_mdio_probe()
195 reset_control_assert(ctx->reset); in aspeed_mdio_probe()
207 struct aspeed_mdio *ctx = bus->priv; in aspeed_mdio_remove()
209 reset_control_assert(ctx->reset); in aspeed_mdio_remove()
216 { .compatible = "aspeed,ast2600-mdio", },