Lines Matching +full:probe +full:- +full:reset
1 // SPDX-License-Identifier: GPL-2.0+
20 #include <linux/reset.h>
28 put_device(&mdiodev->dev); in mdio_device_free()
34 fwnode_handle_put(dev->fwnode); in mdio_device_release()
43 if (mdiodrv->mdiodrv.flags & MDIO_DEVICE_IS_PHY) in mdio_device_bus_match()
46 return strcmp(mdiodev->modalias, drv->name) == 0; in mdio_device_bus_match()
56 return ERR_PTR(-ENOMEM); in mdio_device_create()
58 mdiodev->dev.release = mdio_device_release; in mdio_device_create()
59 mdiodev->dev.parent = &bus->dev; in mdio_device_create()
60 mdiodev->dev.bus = &mdio_bus_type; in mdio_device_create()
61 mdiodev->device_free = mdio_device_free; in mdio_device_create()
62 mdiodev->device_remove = mdio_device_remove; in mdio_device_create()
63 mdiodev->bus = bus; in mdio_device_create()
64 mdiodev->addr = addr; in mdio_device_create()
65 mdiodev->reset_state = -1; in mdio_device_create()
67 dev_set_name(&mdiodev->dev, PHY_ID_FMT, bus->id, addr); in mdio_device_create()
69 device_initialize(&mdiodev->dev); in mdio_device_create()
76 * mdio_device_register - Register the mdio device on the MDIO bus
83 dev_dbg(&mdiodev->dev, "%s\n", __func__); in mdio_device_register()
89 err = device_add(&mdiodev->dev); in mdio_device_register()
91 pr_err("MDIO %d failed to add\n", mdiodev->addr); in mdio_device_register()
104 * mdio_device_remove - Remove a previously registered mdio device from the
114 device_del(&mdiodev->dev); in mdio_device_remove()
123 if (!mdiodev->reset_gpio && !mdiodev->reset_ctrl) in mdio_device_reset()
126 if (mdiodev->reset_state == value) in mdio_device_reset()
129 if (mdiodev->reset_gpio) in mdio_device_reset()
130 gpiod_set_value_cansleep(mdiodev->reset_gpio, value); in mdio_device_reset()
132 if (mdiodev->reset_ctrl) { in mdio_device_reset()
134 reset_control_assert(mdiodev->reset_ctrl); in mdio_device_reset()
136 reset_control_deassert(mdiodev->reset_ctrl); in mdio_device_reset()
139 d = value ? mdiodev->reset_assert_delay : mdiodev->reset_deassert_delay; in mdio_device_reset()
143 mdiodev->reset_state = value; in mdio_device_reset()
148 * mdio_probe - probe an MDIO device
149 * @dev: device to probe
152 * and calling the driver to probe the device.
157 struct device_driver *drv = mdiodev->dev.driver; in mdio_probe()
161 /* Deassert the reset signal */ in mdio_probe()
164 if (mdiodrv->probe) { in mdio_probe()
165 err = mdiodrv->probe(mdiodev); in mdio_probe()
167 /* Assert the reset signal */ in mdio_probe()
178 struct device_driver *drv = mdiodev->dev.driver; in mdio_remove()
181 if (mdiodrv->remove) in mdio_remove()
182 mdiodrv->remove(mdiodev); in mdio_remove()
184 /* Assert the reset signal */ in mdio_remove()
193 struct device_driver *drv = mdiodev->dev.driver; in mdio_shutdown()
196 if (mdiodrv->shutdown) in mdio_shutdown()
197 mdiodrv->shutdown(mdiodev); in mdio_shutdown()
201 * mdio_driver_register - register an mdio_driver with the MDIO layer
206 struct mdio_driver_common *mdiodrv = &drv->mdiodrv; in mdio_driver_register()
209 pr_debug("%s: %s\n", __func__, mdiodrv->driver.name); in mdio_driver_register()
211 mdiodrv->driver.bus = &mdio_bus_type; in mdio_driver_register()
212 mdiodrv->driver.probe = mdio_probe; in mdio_driver_register()
213 mdiodrv->driver.remove = mdio_remove; in mdio_driver_register()
214 mdiodrv->driver.shutdown = mdio_shutdown; in mdio_driver_register()
216 retval = driver_register(&mdiodrv->driver); in mdio_driver_register()
219 mdiodrv->driver.name, retval); in mdio_driver_register()
230 struct mdio_driver_common *mdiodrv = &drv->mdiodrv; in mdio_driver_unregister()
232 driver_unregister(&mdiodrv->driver); in mdio_driver_unregister()