Commit deafeb24 authored by Yoshihiro Shimoda's avatar Yoshihiro Shimoda Committed by Felipe Balbi

usb: gadget: r8a66597-udc: fix cannot connect after rmmod gadget driver

When we run rmmod a gadget driver, the driver will call
disable_controller(). Then, because the bit of USBE in SYSCFG0 was
cleared in on_chip=1 mode, we could not connect the usb when we run
insmod a gadget driver next time.
This patch also cleans up probe() and ->stop() about unnecessary
init_controller().
Signed-off-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 5db05c09
...@@ -1444,6 +1444,7 @@ static int r8a66597_start(struct usb_gadget_driver *driver, ...@@ -1444,6 +1444,7 @@ static int r8a66597_start(struct usb_gadget_driver *driver,
goto error; goto error;
} }
init_controller(r8a66597);
r8a66597_bset(r8a66597, VBSE, INTENB0); r8a66597_bset(r8a66597, VBSE, INTENB0);
if (r8a66597_read(r8a66597, INTSTS0) & VBSTS) { if (r8a66597_read(r8a66597, INTSTS0) & VBSTS) {
r8a66597_start_xclock(r8a66597); r8a66597_start_xclock(r8a66597);
...@@ -1474,15 +1475,12 @@ static int r8a66597_stop(struct usb_gadget_driver *driver) ...@@ -1474,15 +1475,12 @@ static int r8a66597_stop(struct usb_gadget_driver *driver)
spin_lock_irqsave(&r8a66597->lock, flags); spin_lock_irqsave(&r8a66597->lock, flags);
if (r8a66597->gadget.speed != USB_SPEED_UNKNOWN) if (r8a66597->gadget.speed != USB_SPEED_UNKNOWN)
r8a66597_usb_disconnect(r8a66597); r8a66597_usb_disconnect(r8a66597);
spin_unlock_irqrestore(&r8a66597->lock, flags);
r8a66597_bclr(r8a66597, VBSE, INTENB0); r8a66597_bclr(r8a66597, VBSE, INTENB0);
disable_controller(r8a66597);
spin_unlock_irqrestore(&r8a66597->lock, flags);
driver->unbind(&r8a66597->gadget); driver->unbind(&r8a66597->gadget);
init_controller(r8a66597);
disable_controller(r8a66597);
device_del(&r8a66597->gadget.dev); device_del(&r8a66597->gadget.dev);
r8a66597->driver = NULL; r8a66597->driver = NULL;
return 0; return 0;
...@@ -1646,8 +1644,6 @@ static int __init r8a66597_probe(struct platform_device *pdev) ...@@ -1646,8 +1644,6 @@ static int __init r8a66597_probe(struct platform_device *pdev)
goto clean_up3; goto clean_up3;
r8a66597->ep0_req->complete = nop_completion; r8a66597->ep0_req->complete = nop_completion;
init_controller(r8a66597);
ret = usb_add_gadget_udc(&pdev->dev, &r8a66597->gadget); ret = usb_add_gadget_udc(&pdev->dev, &r8a66597->gadget);
if (ret) if (ret)
goto err_add_udc; goto err_add_udc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment