Lines Matching +full:drv +full:- +full:id

1 // SPDX-License-Identifier: GPL-2.0
3 * ulpi.c - USB ULPI PHY bus
19 #include <linux/clk/clk-conf.h>
21 /* -------------------------------------------------------------------------- */
25 return ulpi->ops->read(ulpi->dev.parent, addr); in ulpi_read()
31 return ulpi->ops->write(ulpi->dev.parent, addr, val); in ulpi_write()
35 /* -------------------------------------------------------------------------- */
39 struct ulpi_driver *drv = to_ulpi_driver(driver); in ulpi_match() local
41 const struct ulpi_device_id *id; in ulpi_match() local
44 * Some ULPI devices don't have a vendor id in ulpi_match()
47 if (ulpi->id.vendor == 0 || !drv->id_table) in ulpi_match()
50 for (id = drv->id_table; id->vendor; id++) in ulpi_match()
51 if (id->vendor == ulpi->id.vendor && in ulpi_match()
52 id->product == ulpi->id.product) in ulpi_match()
64 if (ret != -ENODEV) in ulpi_uevent()
68 ulpi->id.vendor, ulpi->id.product)) in ulpi_uevent()
69 return -ENOMEM; in ulpi_uevent()
75 struct ulpi_driver *drv = to_ulpi_driver(dev->driver); in ulpi_probe() local
78 ret = of_clk_set_defaults(dev->of_node, false); in ulpi_probe()
82 return drv->probe(to_ulpi_dev(dev)); in ulpi_probe()
87 struct ulpi_driver *drv = to_ulpi_driver(dev->driver); in ulpi_remove() local
89 if (drv->remove) in ulpi_remove()
90 drv->remove(to_ulpi_dev(dev)); in ulpi_remove()
101 /* -------------------------------------------------------------------------- */
110 if (len != -ENODEV) in modalias_show()
114 ulpi->id.vendor, ulpi->id.product); in modalias_show()
134 of_node_put(dev->of_node); in ulpi_dev_release()
144 /* -------------------------------------------------------------------------- */
147 * __ulpi_register_driver - register a driver with the ULPI bus
148 * @drv: driver being registered
153 int __ulpi_register_driver(struct ulpi_driver *drv, struct module *module) in __ulpi_register_driver() argument
155 if (!drv->probe) in __ulpi_register_driver()
156 return -EINVAL; in __ulpi_register_driver()
158 drv->driver.owner = module; in __ulpi_register_driver()
159 drv->driver.bus = &ulpi_bus; in __ulpi_register_driver()
161 return driver_register(&drv->driver); in __ulpi_register_driver()
166 * ulpi_unregister_driver - unregister a driver with the ULPI bus
167 * @drv: driver to unregister
171 void ulpi_unregister_driver(struct ulpi_driver *drv) in ulpi_unregister_driver() argument
173 driver_unregister(&drv->driver); in ulpi_unregister_driver()
177 /* -------------------------------------------------------------------------- */
185 parent = ulpi->dev.parent; in ulpi_of_register()
186 if (parent->of_node) in ulpi_of_register()
187 np = of_get_child_by_name(parent->of_node, "ulpi"); in ulpi_of_register()
188 else if (parent->parent && parent->parent->of_node) in ulpi_of_register()
189 np = of_get_child_by_name(parent->parent->of_node, "ulpi"); in ulpi_of_register()
196 return -EINVAL; in ulpi_of_register()
198 ulpi->dev.of_node = child; in ulpi_of_register()
219 ulpi->id.vendor = ulpi_read(ulpi, ULPI_VENDOR_ID_LOW); in ulpi_read_id()
220 ulpi->id.vendor |= ulpi_read(ulpi, ULPI_VENDOR_ID_HIGH) << 8; in ulpi_read_id()
222 ulpi->id.product = ulpi_read(ulpi, ULPI_PRODUCT_ID_LOW); in ulpi_read_id()
223 ulpi->id.product |= ulpi_read(ulpi, ULPI_PRODUCT_ID_HIGH) << 8; in ulpi_read_id()
225 /* Some ULPI devices don't have a vendor id so rely on OF match */ in ulpi_read_id()
226 if (ulpi->id.vendor == 0) in ulpi_read_id()
229 request_module("ulpi:v%04xp%04x", ulpi->id.vendor, ulpi->id.product); in ulpi_read_id()
232 of_request_module(ulpi->dev.of_node); in ulpi_read_id()
238 struct ulpi *ulpi = seq->private; in ulpi_regs_show()
247 ulpi_print("Vendor ID Low ", ULPI_VENDOR_ID_LOW); in ulpi_regs_show()
248 ulpi_print("Vendor ID High ", ULPI_VENDOR_ID_HIGH); in ulpi_regs_show()
249 ulpi_print("Product ID Low ", ULPI_PRODUCT_ID_LOW); in ulpi_regs_show()
250 ulpi_print("Product ID High ", ULPI_PRODUCT_ID_HIGH); in ulpi_regs_show()
281 ulpi->dev.parent = dev; /* needed early for ops */ in ulpi_register()
282 ulpi->dev.bus = &ulpi_bus; in ulpi_register()
283 ulpi->dev.type = &ulpi_dev_type; in ulpi_register()
284 dev_set_name(&ulpi->dev, "%s.ulpi", dev_name(dev)); in ulpi_register()
286 ACPI_COMPANION_SET(&ulpi->dev, ACPI_COMPANION(dev)); in ulpi_register()
294 of_node_put(ulpi->dev.of_node); in ulpi_register()
298 ret = device_register(&ulpi->dev); in ulpi_register()
300 put_device(&ulpi->dev); in ulpi_register()
304 root = debugfs_create_dir(dev_name(&ulpi->dev), ulpi_root); in ulpi_register()
307 dev_dbg(&ulpi->dev, "registered ULPI PHY: vendor %04x, product %04x\n", in ulpi_register()
308 ulpi->id.vendor, ulpi->id.product); in ulpi_register()
314 * ulpi_register_interface - instantiate new ULPI device
329 return ERR_PTR(-ENOMEM); in ulpi_register_interface()
331 ulpi->ops = ops; in ulpi_register_interface()
344 * ulpi_unregister_interface - unregister ULPI interface
352 debugfs_lookup_and_remove(dev_name(&ulpi->dev), ulpi_root); in ulpi_unregister_interface()
353 device_unregister(&ulpi->dev); in ulpi_unregister_interface()
357 /* -------------------------------------------------------------------------- */