Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: gadget: udc-core: add utility for bus reset

The udc driver can notify the udc core that bus reset occurs by
calling this utility, the core will notify gadget driver this
information and update gadget state accordingly.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>

authored by

Peter Chen and committed by
Felipe Balbi
974a70bd 1f7c5166

+23
+17
drivers/usb/gadget/udc/udc-core.c
··· 124 124 /* ------------------------------------------------------------------------- */ 125 125 126 126 /** 127 + * usb_gadget_udc_reset - notifies the udc core that bus reset occurs 128 + * @gadget: The gadget which bus reset occurs 129 + * @driver: The gadget driver we want to notify 130 + * 131 + * If the udc driver has bus reset handler, it needs to call this when the bus 132 + * reset occurs, it notifies the gadget driver that the bus reset occurs as 133 + * well as updates gadget state. 134 + */ 135 + void usb_gadget_udc_reset(struct usb_gadget *gadget, 136 + struct usb_gadget_driver *driver) 137 + { 138 + driver->reset(gadget); 139 + usb_gadget_set_state(gadget, USB_STATE_DEFAULT); 140 + } 141 + EXPORT_SYMBOL_GPL(usb_gadget_udc_reset); 142 + 143 + /** 127 144 * usb_gadget_udc_start - tells usb device controller to start up 128 145 * @gadget: The gadget we want to get started 129 146 * @driver: The driver we want to bind to @gadget
+6
include/linux/usb/gadget.h
··· 1017 1017 1018 1018 /*-------------------------------------------------------------------------*/ 1019 1019 1020 + /* utility to tell udc core that the bus reset occurs */ 1021 + extern void usb_gadget_udc_reset(struct usb_gadget *gadget, 1022 + struct usb_gadget_driver *driver); 1023 + 1024 + /*-------------------------------------------------------------------------*/ 1025 + 1020 1026 /* utility wrapping a simple endpoint selection policy */ 1021 1027 1022 1028 extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *,