lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 15 Jul 2015 17:32:52 +0530
From:	Ramneek Mehresh <ramneek.mehresh@...escale.com>
To:	<linux-kernel@...r.kernel.org>
CC:	<balbi@...com>, <stern@...land.harvard.edu>,
	<gregkh@...uxfoundation.org>, <linux-usb@...r.kernel.org>,
	Ramneek Mehresh <ramneek.mehresh@...escale.com>
Subject: [PATCH 8/8][v2]usb:fsl:otg: Add host-gadget drv sync delay

Resolve synchronization issue between host
and gadget drivers upon role-reversal.

Signed-off-by: Ramneek Mehresh <ramneek.mehresh@...escale.com>
Reviewed-by: Li Yang-R58472 <LeoLi@...escale.com>
Reviewed-by: Fleming Andrew-AFLEMING <AFLEMING@...escale.com>
Tested-by: Fleming Andrew-AFLEMING <AFLEMING@...escale.com>
---
 drivers/usb/phy/phy-fsl-usb.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c
index 689516d..5d678ea 100644
--- a/drivers/usb/phy/phy-fsl-usb.c
+++ b/drivers/usb/phy/phy-fsl-usb.c
@@ -544,8 +544,18 @@ int fsl_otg_start_gadget(struct otg_fsm *fsm, int on)
 	dev = otg->gadget->dev.parent;
 
 	if (on) {
-		if (dev->driver->resume)
+		/*
+		 * Delay gadget resume to synchronize between host and gadget
+		 * drivers. Upon role-reversal host drv is shutdown by kernel
+		 * worker thread. By the time host drv shuts down, controller
+		 * gets programmed for gadget role. Shutting host drv after
+		 * this results in controller getting reset, and it stops
+		 * responding to otg events
+		 */
+		if (dev->driver->resume) {
+			msleep(1000);
 			dev->driver->resume(dev);
+		}
 	} else {
 		if (dev->driver->suspend)
 			dev->driver->suspend(dev, otg_suspend_state);
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ