From 92f418332c16491d233a6dfe381a441ccccae0b1 Mon Sep 17 00:00:00 2001 From: Hemant Kumar Date: Wed, 26 Aug 2015 17:18:36 -0700 Subject: usb: dwc3: Add support for POR upon composition switch Composition switch to GSI transport based composition from another GSI transport based composition requires power on reset of USB controller to synchronize operation with USB wrapper for GSI. Specifically GSI_EN bit cannot be cleared without performing usb controller reset. Hence introduce gadget restart operation to simulate vbus off and vbus on and perform this operation from gsi bind config. Change-Id: Ie4695807c73c2d14c0d9e17c486f34a90fd93ddb Signed-off-by: Hemant Kumar --- include/linux/usb/gadget.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'include/linux/usb') diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 7c18c70df503..3f572d5dc16d 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -649,6 +649,7 @@ struct usb_gadget_ops { int (*vbus_session) (struct usb_gadget *, int is_active); int (*vbus_draw) (struct usb_gadget *, unsigned mA); int (*pullup) (struct usb_gadget *, int is_on); + int (*restart)(struct usb_gadget *); int (*ioctl)(struct usb_gadget *, unsigned code, unsigned long param); void (*get_config_params)(struct usb_dcd_config_params *); @@ -1048,6 +1049,20 @@ static inline int usb_gadget_disconnect(struct usb_gadget *gadget) return ret; } +/** + * usb_gadget_restart - software-controlled reset of USB peripheral connection + * @gadget:the peripheral being reset + * + * Informs controller driver for Vbus LOW followed by Vbus HIGH notification. + * This performs full hardware reset and re-initialization. + */ +static inline int usb_gadget_restart(struct usb_gadget *gadget) +{ + if (!gadget->ops->restart) + return -EOPNOTSUPP; + return gadget->ops->restart(gadget); +} + /** * usb_gadget_deactivate - deactivate function which is not ready to work * @gadget: the peripheral being deactivated -- cgit v1.2.3