Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030330AbbEERvI (ORCPT ); Tue, 5 May 2015 13:51:08 -0400 Received: from mail-bn1bon0133.outbound.protection.outlook.com ([157.56.111.133]:32122 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965748AbbEERri (ORCPT ); Tue, 5 May 2015 13:47:38 -0400 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=freescale.com; freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; From: Ramneek Mehresh To: CC: , , , , Ramneek Mehresh Subject: [PATCH 7/9] usb:fsl:otg: Add host-gadget drv sync delay Date: Tue, 5 May 2015 23:28:34 +0530 Message-ID: <1430848716-32157-7-git-send-email-ramneek.mehresh@freescale.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1430848716-32157-1-git-send-email-ramneek.mehresh@freescale.com> References: <1430848716-32157-1-git-send-email-ramneek.mehresh@freescale.com> X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.88.158.2;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(339900001)(199003)(189002)(48376002)(77156002)(62966003)(50466002)(77096005)(6806004)(92566002)(2950100001)(76176999)(104016003)(36756003)(5001920100001)(50226001)(110136002)(5001960100002)(107886002)(229853001)(2351001)(106466001)(76506005)(86362001)(50986999)(33646002)(85426001)(87936001)(47776003)(46102003)(19580405001)(19580395003)(105606002)(42866002)(4001430100001);DIR:OUT;SFP:1102;SCL:1;SRVR:CY1PR0301MB1577;H:az84smr01.freescale.net;FPR:;SPF:Fail;MLV:sfv;A:1;MX:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB1577;UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB0604; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(3002001);SRVR:CY1PR0301MB1577;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB1577; X-Forefront-PRVS: 0567A15835 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 May 2015 17:47:34.8102 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d;Ip=[192.88.158.2];Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0301MB1577 X-OriginatorOrg: freescale.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1534 Lines: 42 Resolve synchronization issue between host and gadget drivers upon role-reversal Signed-off-by: Ramneek Mehresh Reviewed-by: Li Yang-R58472 Reviewed-by: Fleming Andrew-AFLEMING Tested-by: Fleming Andrew-AFLEMING --- drivers/usb/phy/phy-fsl-usb.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c index ce40d5c..a3a578d 100644 --- a/drivers/usb/phy/phy-fsl-usb.c +++ b/drivers/usb/phy/phy-fsl-usb.c @@ -544,8 +544,17 @@ 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/