Lines Matching +full:semi +full:- +full:static

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2006-2007 PA Semi, Inc
5 * Author: Olof Johansson, PA Semi
9 * Based on drivers/net/fs_enet/mii-bitbang.c.
27 static void __iomem *gpio_regs;
34 #define MDC_PIN(bus) (((struct gpio_priv *)bus->priv)->mdc_pin)
35 #define MDIO_PIN(bus) (((struct gpio_priv *)bus->priv)->mdio_pin)
37 static inline void mdio_lo(struct mii_bus *bus) in mdio_lo()
42 static inline void mdio_hi(struct mii_bus *bus) in mdio_hi()
47 static inline void mdc_lo(struct mii_bus *bus) in mdc_lo()
52 static inline void mdc_hi(struct mii_bus *bus) in mdc_hi()
57 static inline void mdio_active(struct mii_bus *bus) in mdio_active()
62 static inline void mdio_tristate(struct mii_bus *bus) in mdio_tristate()
67 static inline int mdio_read(struct mii_bus *bus) in mdio_read()
72 static void clock_out(struct mii_bus *bus, int bit) in clock_out()
85 static void bitbang_pre(struct mii_bus *bus, int read, u8 addr, u8 reg) in bitbang_pre()
115 static int gpio_mdio_read(struct mii_bus *bus, int phy_id, int location) in gpio_mdio_read()
124 /* tri-state our MDIO I/O pin so we can read */ in gpio_mdio_read()
154 static int gpio_mdio_write(struct mii_bus *bus, int phy_id, int location, u16 val) in gpio_mdio_write()
190 * Tri-state the MDIO line. in gpio_mdio_write()
200 static int gpio_mdio_reset(struct mii_bus *bus) in gpio_mdio_reset()
202 /*nothing here - dunno how to reset it*/ in gpio_mdio_reset()
207 static int gpio_mdio_probe(struct platform_device *ofdev) in gpio_mdio_probe()
209 struct device *dev = &ofdev->dev; in gpio_mdio_probe()
210 struct device_node *np = ofdev->dev.of_node; in gpio_mdio_probe()
216 err = -ENOMEM; in gpio_mdio_probe()
226 new_bus->name = "pasemi gpio mdio bus"; in gpio_mdio_probe()
227 new_bus->read = &gpio_mdio_read; in gpio_mdio_probe()
228 new_bus->write = &gpio_mdio_write; in gpio_mdio_probe()
229 new_bus->reset = &gpio_mdio_reset; in gpio_mdio_probe()
232 snprintf(new_bus->id, MII_BUS_ID_SIZE, "%x", *prop); in gpio_mdio_probe()
233 new_bus->priv = priv; in gpio_mdio_probe()
235 prop = of_get_property(np, "mdc-pin", NULL); in gpio_mdio_probe()
236 priv->mdc_pin = *prop; in gpio_mdio_probe()
238 prop = of_get_property(np, "mdio-pin", NULL); in gpio_mdio_probe()
239 priv->mdio_pin = *prop; in gpio_mdio_probe()
241 new_bus->parent = dev; in gpio_mdio_probe()
248 new_bus->name, err); in gpio_mdio_probe()
263 static void gpio_mdio_remove(struct platform_device *dev) in gpio_mdio_remove()
265 struct mii_bus *bus = dev_get_drvdata(&dev->dev); in gpio_mdio_remove()
269 dev_set_drvdata(&dev->dev, NULL); in gpio_mdio_remove()
271 kfree(bus->priv); in gpio_mdio_remove()
272 bus->priv = NULL; in gpio_mdio_remove()
276 static const struct of_device_id gpio_mdio_match[] =
279 .compatible = "gpio-mdio",
285 static struct platform_driver gpio_mdio_driver =
290 .name = "gpio-mdio-bitbang",
295 static int __init gpio_mdio_init(void) in gpio_mdio_init()
299 np = of_find_compatible_node(NULL, NULL, "1682m-gpio"); in gpio_mdio_init()
302 "pasemi,pwrficient-gpio"); in gpio_mdio_init()
304 return -ENODEV; in gpio_mdio_init()
309 return -ENODEV; in gpio_mdio_init()
315 static void __exit gpio_mdio_exit(void) in gpio_mdio_exit()
325 MODULE_DESCRIPTION("Driver for MDIO over GPIO on PA Semi PWRficient-based boards");