@@ -1176,6 +1176,23 @@ static int usba_udc_disable(struct usba_udc *udc)
return 0;
}
+static int usba_udc_pullup(struct usb_gadget *g, int is_on)
+{
+ struct usba_udc *udc = controller;
+ u32 ctrl;
+
+ ctrl = usba_readl(udc, CTRL);
+
+ if (is_on)
+ ctrl &= ~USBA_DETACH;
+ else
+ ctrl |= USBA_DETACH;
+
+ usba_writel(udc, CTRL, ctrl);
+
+ return 0;
+}
+
int dm_usb_gadget_handle_interrupts(struct udevice *dev)
{
struct usba_udc *udc = controller;
@@ -1233,6 +1250,7 @@ static const struct usb_gadget_ops usba_udc_ops = {
.get_frame = usba_udc_get_frame,
.wakeup = usba_udc_wakeup,
.set_selfpowered = usba_udc_set_selfpowered,
+ .pullup = usba_udc_pullup,
};
static struct usba_udc udc_controller = {
Add controller attach/detach support by using usb_gadget_ops.pullup() method. Signed-off-by: Zixun LI <zli@ogga.fr> --- drivers/usb/gadget/atmel_usba_udc.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)