From 1c9af65357a309b60d78a442bd61d27cad458d00 Mon Sep 17 00:00:00 2001 From: Michael Grzeschik Date: Thu, 13 Jun 2013 17:59:55 +0300 Subject: usb: add devicetree helpers for determining dr_mode and phy_type This adds two little devicetree helper functions for determining the dr_mode (host, peripheral, otg) and phy_type (utmi, ulpi,...) from the devicetree. Signed-off-by: Michael Grzeschik Signed-off-by: Marc Kleine-Budde Signed-off-by: Sascha Hauer Acked-by: Felipe Balbi Signed-off-by: Alexander Shishkin Signed-off-by: Greg Kroah-Hartman --- include/linux/usb/of.h | 28 ++++++++++++++++++++++++++++ include/linux/usb/otg.h | 7 +++++++ include/linux/usb/phy.h | 9 +++++++++ 3 files changed, 44 insertions(+) create mode 100644 include/linux/usb/of.h (limited to 'include') diff --git a/include/linux/usb/of.h b/include/linux/usb/of.h new file mode 100644 index 000000000000..e460a24115ca --- /dev/null +++ b/include/linux/usb/of.h @@ -0,0 +1,28 @@ +/* + * OF helpers for usb devices. + * + * This file is released under the GPLv2 + */ + +#ifndef __LINUX_USB_OF_H +#define __LINUX_USB_OF_H + +#include +#include + +#ifdef CONFIG_OF +enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np); +enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np); +#else +static inline enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np) +{ + return USBPHY_INTERFACE_MODE_UNKNOWN; +} + +static inline enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np) +{ + return USB_DR_MODE_UNKNOWN; +} +#endif + +#endif /* __LINUX_USB_OF_H */ diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h index 291e01ba32e5..154332b7c8c0 100644 --- a/include/linux/usb/otg.h +++ b/include/linux/usb/otg.h @@ -92,4 +92,11 @@ otg_start_srp(struct usb_otg *otg) /* for OTG controller drivers (and maybe other stuff) */ extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num); +enum usb_dr_mode { + USB_DR_MODE_UNKNOWN, + USB_DR_MODE_HOST, + USB_DR_MODE_PERIPHERAL, + USB_DR_MODE_OTG, +}; + #endif /* __LINUX_USB_OTG_H */ diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h index 6b5978f57633..44036808bf0f 100644 --- a/include/linux/usb/phy.h +++ b/include/linux/usb/phy.h @@ -12,6 +12,15 @@ #include #include +enum usb_phy_interface { + USBPHY_INTERFACE_MODE_UNKNOWN, + USBPHY_INTERFACE_MODE_UTMI, + USBPHY_INTERFACE_MODE_UTMIW, + USBPHY_INTERFACE_MODE_ULPI, + USBPHY_INTERFACE_MODE_SERIAL, + USBPHY_INTERFACE_MODE_HSIC, +}; + enum usb_phy_events { USB_EVENT_NONE, /* no events or cable disconnected */ USB_EVENT_VBUS, /* vbus valid event */ -- cgit v1.2.3