• Home
  • Raw
  • Download

Lines Matching +full:data +full:- +full:bus

37 static int moxart_mdio_read(struct mii_bus *bus, int mii_id, int regnum)  in moxart_mdio_read()  argument
39 struct moxart_mdio_data *data = bus->priv; in moxart_mdio_read() local
43 dev_dbg(&bus->dev, "%s\n", __func__); in moxart_mdio_read()
48 writel(ctrl, data->base + REG_PHY_CTRL); in moxart_mdio_read()
51 ctrl = readl(data->base + REG_PHY_CTRL); in moxart_mdio_read()
57 count--; in moxart_mdio_read()
60 dev_dbg(&bus->dev, "%s timed out\n", __func__); in moxart_mdio_read()
62 return -ETIMEDOUT; in moxart_mdio_read()
65 static int moxart_mdio_write(struct mii_bus *bus, int mii_id, in moxart_mdio_write() argument
68 struct moxart_mdio_data *data = bus->priv; in moxart_mdio_write() local
72 dev_dbg(&bus->dev, "%s\n", __func__); in moxart_mdio_write()
79 writel(value, data->base + REG_PHY_WRITE_DATA); in moxart_mdio_write()
80 writel(ctrl, data->base + REG_PHY_CTRL); in moxart_mdio_write()
83 ctrl = readl(data->base + REG_PHY_CTRL); in moxart_mdio_write()
89 count--; in moxart_mdio_write()
92 dev_dbg(&bus->dev, "%s timed out\n", __func__); in moxart_mdio_write()
94 return -ETIMEDOUT; in moxart_mdio_write()
97 static int moxart_mdio_reset(struct mii_bus *bus) in moxart_mdio_reset() argument
99 int data, i; in moxart_mdio_reset() local
102 data = moxart_mdio_read(bus, i, MII_BMCR); in moxart_mdio_reset()
103 if (data < 0) in moxart_mdio_reset()
106 data |= BMCR_RESET; in moxart_mdio_reset()
107 if (moxart_mdio_write(bus, i, MII_BMCR, data) < 0) in moxart_mdio_reset()
116 struct device_node *np = pdev->dev.of_node; in moxart_mdio_probe()
117 struct mii_bus *bus; in moxart_mdio_probe() local
118 struct moxart_mdio_data *data; in moxart_mdio_probe() local
122 bus = mdiobus_alloc_size(sizeof(*data)); in moxart_mdio_probe()
123 if (!bus) in moxart_mdio_probe()
124 return -ENOMEM; in moxart_mdio_probe()
126 bus->name = "MOXA ART Ethernet MII"; in moxart_mdio_probe()
127 bus->read = &moxart_mdio_read; in moxart_mdio_probe()
128 bus->write = &moxart_mdio_write; in moxart_mdio_probe()
129 bus->reset = &moxart_mdio_reset; in moxart_mdio_probe()
130 snprintf(bus->id, MII_BUS_ID_SIZE, "%s-%d-mii", pdev->name, pdev->id); in moxart_mdio_probe()
131 bus->parent = &pdev->dev; in moxart_mdio_probe()
141 bus->irq[i] = PHY_IGNORE_INTERRUPT; in moxart_mdio_probe()
143 data = bus->priv; in moxart_mdio_probe()
145 data->base = devm_ioremap_resource(&pdev->dev, res); in moxart_mdio_probe()
146 if (IS_ERR(data->base)) { in moxart_mdio_probe()
147 ret = PTR_ERR(data->base); in moxart_mdio_probe()
151 ret = of_mdiobus_register(bus, np); in moxart_mdio_probe()
155 platform_set_drvdata(pdev, bus); in moxart_mdio_probe()
160 mdiobus_free(bus); in moxart_mdio_probe()
166 struct mii_bus *bus = platform_get_drvdata(pdev); in moxart_mdio_remove() local
168 mdiobus_unregister(bus); in moxart_mdio_remove()
169 mdiobus_free(bus); in moxart_mdio_remove()
175 { .compatible = "moxa,moxart-mdio" },
184 .name = "moxart-mdio",