These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / include / linux / ulpi / driver.h
1 #ifndef __LINUX_ULPI_DRIVER_H
2 #define __LINUX_ULPI_DRIVER_H
3
4 #include <linux/mod_devicetable.h>
5
6 #include <linux/device.h>
7
8 struct ulpi_ops;
9
10 /**
11  * struct ulpi - describes ULPI PHY device
12  * @id: vendor and product ids for ULPI device
13  * @ops: I/O access
14  * @dev: device interface
15  */
16 struct ulpi {
17         struct ulpi_device_id id;
18         struct ulpi_ops *ops;
19         struct device dev;
20 };
21
22 #define to_ulpi_dev(d) container_of(d, struct ulpi, dev)
23
24 static inline void ulpi_set_drvdata(struct ulpi *ulpi, void *data)
25 {
26         dev_set_drvdata(&ulpi->dev, data);
27 }
28
29 static inline void *ulpi_get_drvdata(struct ulpi *ulpi)
30 {
31         return dev_get_drvdata(&ulpi->dev);
32 }
33
34 /**
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
40  */
41 struct ulpi_driver {
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;
46 };
47
48 #define to_ulpi_driver(d) container_of(d, struct ulpi_driver, driver)
49
50 int ulpi_register_driver(struct ulpi_driver *drv);
51 void ulpi_unregister_driver(struct ulpi_driver *drv);
52
53 #define module_ulpi_driver(__ulpi_driver) \
54         module_driver(__ulpi_driver, ulpi_register_driver, \
55                       ulpi_unregister_driver)
56
57 int ulpi_read(struct ulpi *ulpi, u8 addr);
58 int ulpi_write(struct ulpi *ulpi, u8 addr, u8 val);
59
60 #endif /* __LINUX_ULPI_DRIVER_H */