1 #ifndef __LINUX_ULPI_DRIVER_H
2 #define __LINUX_ULPI_DRIVER_H
4 #include <linux/mod_devicetable.h>
6 #include <linux/device.h>
11 * struct ulpi - describes ULPI PHY device
12 * @id: vendor and product ids for ULPI device
14 * @dev: device interface
17 struct ulpi_device_id id;
18 const struct ulpi_ops *ops;
22 #define to_ulpi_dev(d) container_of(d, struct ulpi, dev)
24 static inline void ulpi_set_drvdata(struct ulpi *ulpi, void *data)
26 dev_set_drvdata(&ulpi->dev, data);
29 static inline void *ulpi_get_drvdata(struct ulpi *ulpi)
31 return dev_get_drvdata(&ulpi->dev);
35 * struct ulpi_driver - describes a ULPI PHY driver
36 * @id_table: array of device identifiers supported by this driver
37 * @probe: binds this driver to ULPI device
38 * @remove: unbinds this driver from ULPI device
39 * @driver: the name and owner members must be initialized by the drivers
42 const struct ulpi_device_id *id_table;
43 int (*probe)(struct ulpi *ulpi);
44 void (*remove)(struct ulpi *ulpi);
45 struct device_driver driver;
48 #define to_ulpi_driver(d) container_of(d, struct ulpi_driver, driver)
51 * use a macro to avoid include chaining to get THIS_MODULE
53 #define ulpi_register_driver(drv) __ulpi_register_driver(drv, THIS_MODULE)
54 int __ulpi_register_driver(struct ulpi_driver *drv, struct module *module);
55 void ulpi_unregister_driver(struct ulpi_driver *drv);
57 #define module_ulpi_driver(__ulpi_driver) \
58 module_driver(__ulpi_driver, ulpi_register_driver, \
59 ulpi_unregister_driver)
61 int ulpi_read(struct ulpi *ulpi, u8 addr);
62 int ulpi_write(struct ulpi *ulpi, u8 addr, u8 val);
64 #endif /* __LINUX_ULPI_DRIVER_H */