[PATCH 3/6 v2] usb: r8a66597-udc: fix cannot connect after rmmod gadget driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
---
 about v2:
  - add a comment on the log and clean up the code.

 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 e1dedb9..a7cc833 100644
--- a/drivers/usb/gadget/r8a66597-udc.c
+++ b/drivers/usb/gadget/r8a66597-udc.c
@@ -1465,6 +1465,7 @@ static int r8a66597_start(struct usb_gadget_driver *driver,
 		goto error;
 	}

+	init_controller(r8a66597);
 	r8a66597_bset(r8a66597, VBSE, INTENB0);
 	if (r8a66597_read(r8a66597, INTSTS0) & VBSTS) {
 		r8a66597_start_xclock(r8a66597);
@@ -1495,15 +1496,12 @@ static int r8a66597_stop(struct usb_gadget_driver *driver)
 	spin_lock_irqsave(&r8a66597->lock, flags);
 	if (r8a66597->gadget.speed != USB_SPEED_UNKNOWN)
 		r8a66597_usb_disconnect(r8a66597);
-	spin_unlock_irqrestore(&r8a66597->lock, flags);
-
 	r8a66597_bclr(r8a66597, VBSE, INTENB0);
+	disable_controller(r8a66597);
+	spin_unlock_irqrestore(&r8a66597->lock, flags);

 	driver->unbind(&r8a66597->gadget);

-	init_controller(r8a66597);
-	disable_controller(r8a66597);
-
 	device_del(&r8a66597->gadget.dev);
 	r8a66597->driver = NULL;
 	return 0;
@@ -1667,8 +1665,6 @@ static int __init r8a66597_probe(struct platform_device *pdev)
 		goto clean_up3;
 	r8a66597->ep0_req->complete = nop_completion;

-	init_controller(r8a66597);
-
 	ret = usb_add_gadget_udc(&pdev->dev, &r8a66597->gadget);
 	if (ret)
 		goto err_add_udc;
-- 
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux