diff options
author | Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> | 2011-07-08 01:51:21 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2011-07-08 05:47:37 -0400 |
commit | deafeb24e8a846da8555e68f4bcf651daa8a4ed1 (patch) | |
tree | ba19bb658a0af42b2eab10d96f0a76b47df144b2 /drivers/usb | |
parent | 5db05c09ac107ef957b7a052d7bba8190c93b460 (diff) |
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: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/gadget/r8a66597-udc.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c index 7ee69152ec9e..4f3f1ce0424b 100644 --- a/drivers/usb/gadget/r8a66597-udc.c +++ b/drivers/usb/gadget/r8a66597-udc.c | |||
@@ -1444,6 +1444,7 @@ static int r8a66597_start(struct usb_gadget_driver *driver, | |||
1444 | goto error; | 1444 | goto error; |
1445 | } | 1445 | } |
1446 | 1446 | ||
1447 | init_controller(r8a66597); | ||
1447 | r8a66597_bset(r8a66597, VBSE, INTENB0); | 1448 | r8a66597_bset(r8a66597, VBSE, INTENB0); |
1448 | if (r8a66597_read(r8a66597, INTSTS0) & VBSTS) { | 1449 | if (r8a66597_read(r8a66597, INTSTS0) & VBSTS) { |
1449 | r8a66597_start_xclock(r8a66597); | 1450 | r8a66597_start_xclock(r8a66597); |
@@ -1474,15 +1475,12 @@ static int r8a66597_stop(struct usb_gadget_driver *driver) | |||
1474 | spin_lock_irqsave(&r8a66597->lock, flags); | 1475 | spin_lock_irqsave(&r8a66597->lock, flags); |
1475 | if (r8a66597->gadget.speed != USB_SPEED_UNKNOWN) | 1476 | if (r8a66597->gadget.speed != USB_SPEED_UNKNOWN) |
1476 | r8a66597_usb_disconnect(r8a66597); | 1477 | r8a66597_usb_disconnect(r8a66597); |
1477 | spin_unlock_irqrestore(&r8a66597->lock, flags); | ||
1478 | |||
1479 | r8a66597_bclr(r8a66597, VBSE, INTENB0); | 1478 | r8a66597_bclr(r8a66597, VBSE, INTENB0); |
1479 | disable_controller(r8a66597); | ||
1480 | spin_unlock_irqrestore(&r8a66597->lock, flags); | ||
1480 | 1481 | ||
1481 | driver->unbind(&r8a66597->gadget); | 1482 | driver->unbind(&r8a66597->gadget); |
1482 | 1483 | ||
1483 | init_controller(r8a66597); | ||
1484 | disable_controller(r8a66597); | ||
1485 | |||
1486 | device_del(&r8a66597->gadget.dev); | 1484 | device_del(&r8a66597->gadget.dev); |
1487 | r8a66597->driver = NULL; | 1485 | r8a66597->driver = NULL; |
1488 | return 0; | 1486 | return 0; |
@@ -1646,8 +1644,6 @@ static int __init r8a66597_probe(struct platform_device *pdev) | |||
1646 | goto clean_up3; | 1644 | goto clean_up3; |
1647 | r8a66597->ep0_req->complete = nop_completion; | 1645 | r8a66597->ep0_req->complete = nop_completion; |
1648 | 1646 | ||
1649 | init_controller(r8a66597); | ||
1650 | |||
1651 | ret = usb_add_gadget_udc(&pdev->dev, &r8a66597->gadget); | 1647 | ret = usb_add_gadget_udc(&pdev->dev, &r8a66597->gadget); |
1652 | if (ret) | 1648 | if (ret) |
1653 | goto err_add_udc; | 1649 | goto err_add_udc; |