remarkable-linux/include/linux/ulpi/driver.h
Heikki Krogerus 289fcff4bc usb: add bus type for USB ULPI
UTMI+ Low Pin Interface (ULPI) is a commonly used PHY
interface for USB 2.0. The ULPI specification describes a
standard set of registers which the vendors can extend for
their specific needs. ULPI PHYs provide often functions
such as charger detection and ADP sensing and probing.

There are two major issues that the bus type is meant to
tackle:

Firstly, ULPI registers are accessed from the controller.
The bus provides convenient method for the controller
drivers to share that access with the actual PHY drivers.

Secondly, there are already platforms that assume ULPI PHYs
are runtime detected, such as many Intel Baytrail based
platforms. They do not provide any kind of hardware
description for the ULPI PHYs like separate ACPI device
object that could be used to enumerate a device from.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Acked-by: David Cohen <david.a.cohen@linux.intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-05-13 12:04:55 -05:00

61 lines
1.5 KiB
C

#ifndef __LINUX_ULPI_DRIVER_H
#define __LINUX_ULPI_DRIVER_H
#include <linux/mod_devicetable.h>
#include <linux/device.h>
struct ulpi_ops;
/**
* struct ulpi - describes ULPI PHY device
* @id: vendor and product ids for ULPI device
* @ops: I/O access
* @dev: device interface
*/
struct ulpi {
struct ulpi_device_id id;
struct ulpi_ops *ops;
struct device dev;
};
#define to_ulpi_dev(d) container_of(d, struct ulpi, dev)
static inline void ulpi_set_drvdata(struct ulpi *ulpi, void *data)
{
dev_set_drvdata(&ulpi->dev, data);
}
static inline void *ulpi_get_drvdata(struct ulpi *ulpi)
{
return dev_get_drvdata(&ulpi->dev);
}
/**
* struct ulpi_driver - describes a ULPI PHY driver
* @id_table: array of device identifiers supported by this driver
* @probe: binds this driver to ULPI device
* @remove: unbinds this driver from ULPI device
* @driver: the name and owner members must be initialized by the drivers
*/
struct ulpi_driver {
const struct ulpi_device_id *id_table;
int (*probe)(struct ulpi *ulpi);
void (*remove)(struct ulpi *ulpi);
struct device_driver driver;
};
#define to_ulpi_driver(d) container_of(d, struct ulpi_driver, driver)
int ulpi_register_driver(struct ulpi_driver *drv);
void ulpi_unregister_driver(struct ulpi_driver *drv);
#define module_ulpi_driver(__ulpi_driver) \
module_driver(__ulpi_driver, ulpi_register_driver, \
ulpi_unregister_driver)
int ulpi_read(struct ulpi *ulpi, u8 addr);
int ulpi_write(struct ulpi *ulpi, u8 addr, u8 val);
#endif /* __LINUX_ULPI_DRIVER_H */