Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753619AbbF3DUd (ORCPT ); Mon, 29 Jun 2015 23:20:33 -0400 Received: from mail-by2on0126.outbound.protection.outlook.com ([207.46.100.126]:30450 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752412AbbF3DU0 (ORCPT ); Mon, 29 Jun 2015 23:20:26 -0400 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=freescale.com; vger.kernel.org; dkim=none (message not signed) header.d=none; Date: Tue, 30 Jun 2015 10:11:46 +0800 From: Peter Chen To: Mike Looijmans CC: , , Subject: Re: [PATCH 2/2] usb: chipidea: Wait 50 ms before reading ID bit Message-ID: <20150630021145.GB7586@shlinux2> References: <1435326424-18748-1-git-send-email-mike.looijmans@topic.nl> <1435326424-18748-2-git-send-email-mike.looijmans@topic.nl> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1435326424-18748-2-git-send-email-mike.looijmans@topic.nl> User-Agent: Mutt/1.5.21 (2010-09-15) X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11FD047;1:1gi3U6Be0rPifXLYcMzuD5CvHLF2Xc/OyLcRgs+2Cuu6QcLwRNowm48H30aY9MfMcmQ0CDTd0Uk5DOkYy0c2WhhDxccnr958iTNrxIQnGaN5vZqXpuAInajJkAj1lpPfWmQ4X+dKzh2WRiS13+Jfx4b22RU4OkC9CSOp3KCtHaXz9E2X/Mt0+HDRmB6EtoimzgVLr+d8m19WTcGDNmZhR7vOf+K9J+dllmoSxdoDgMZVxje06bWKz0BDwFvb6pTSE5IMRma9b8fqR7/PQTKczvhtqckX3RqehZ5+pgh+JsKixBSyc3+qESxUkGEQ1cnyrPGDNEBqTF1kjG3ucOdlhZ8zhEtrVNwSHCY4fZzfbog= X-Forefront-Antispam-Report: CIP:192.88.168.50;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(1060300003)(2980300002)(339900001)(199003)(24454002)(189002)(4001350100001)(87936001)(23726002)(6806004)(4290100001)(19580405001)(19580395003)(62966003)(85426001)(77156002)(92566002)(50986999)(2950100001)(54356999)(76176999)(33656002)(110136002)(86362001)(5001960100002)(33716001)(50466002)(77096005)(47776003)(105606002)(110436001)(104016003)(46406003)(83506001)(46102003)(106466001);DIR:OUT;SFP:1102;SCL:1;SRVR:BY2PR03MB287;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;MLV:sfv;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BY2PR03MB287;2:S6Kv90AVynS+f10BsUrRXlrN01VF3AQDxy0XvcQe/mmdkcmdaOcR8o8bbaCkY6kC;3:7Sr/2UckxKsAhB+0Jvie7CUDO4RXY60UVuvBRbooQH8q8PXs8rlcyBmyNGvYkEVUSLzzk4JCd7OjQQDlnK5E33wh1/TqkGLMZq0Y0VE0ufSe+IB5LBP1Zk03afA3vh7h1G6TN4ssaY+O/Wh55OiKYa7wKr4rZrzfHMzFNqQHWvQt2qhsm8+y8kgmJ1f4MuMOp6r50NfjraVuGGK56ysvQMklcgGk7Z6ohcH9ExvrBwk=;25:rljHgml99aiL7+DK8SCv7u0E3Cg2TgQFnsVFYVbcQJFLWixzYm5W7SPDs5GmWQhw4l3Md6KK+P1NbOdvpYdx0XvldKASsy0FuAV1Ge8Kv8SlTOlfAZsOdeWPXVarHHSRYjfqtwj02jfE/6jqIerGg0H77hSFFLMfi86uBAd08AcoMRdHKzRlqbBersHblRztlDFTmoIn8OZrtmiIkceszOS6D4D8CYY4PWON1p03X3JoF4e50KU40U/7EIQC524N3QAsOldyxUpRgtda/vDe2A==;20:refAimGIbeYrjfMWKptr9IjiDAWBp/Uwq3mURiOzBXgBSDqzF9jM15LWuB0xXDvXqgGxfiTHc0xi7y3AJUo7u7Q5cNkvMymEcSNCZQlM0BF5iaxBmognc25QxLc5ptcq4sL59I522oGaVZZ4xAiHzuaKyTaByKTzwJxm9zeFSdnIFpSpuJGvANlXlUYoepgI0ObO+FYEAUL4xADEJA/lsOJ6dEXGPjQzreiihl8dE0aiZecUcLoNI4ANPBKYs3wpHvpjvHNAa4JNCQCzg/BAr1Oyn2YzsM95Q+R4uitupCrBB6mowPTFfJAcqkRWJBK3lt0EBheGIZJSIWoe9BGx/IDVzVeFMqGhZyN+0o7her0= X-Microsoft-Antispam: UriScan:;BCL:1;PCL:0;RULEID:;SRVR:BY2PR03MB287; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:1;PCL:0;RULEID:(601004)(5005006)(1201001)(3002001);SRVR:BY2PR03MB287;BCL:1;PCL:0;RULEID:;SRVR:BY2PR03MB287; X-Microsoft-Exchange-Diagnostics: 1;BY2PR03MB287;4:yhLDS85S7Sk7yWjS+0/DiQgCrh+dz81x6yGclPMBge+NGdY4VjRXlqx4hURysjpwOp0QxTZNnFWK6J+2MTxa4LgBJb9dARAkpbnKWG5JZcJ9d41qd/BBaeJj1Gfj3bsQTD/euGdRa1EbLzsTH4cp5brxnuGdhTaDCFNKmminMKWbVTX8/g2J0p+y9G5Lvj+NvnLsbhuPV14zvxzN3l7czkFLacrUxA/VL6WSG0YQUo7C1hUX0J2HWrCnAlqOWb5FX0qZ372/fSyoBJkrwJPmDDEYHnYW9DNVURmyjU3Eb+05CnbTcKBQUMO+dYs4pOX4 X-Forefront-PRVS: 06237E4555 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BY2PR03MB287;23:mM820s1VF5o56j6E4nMIxmBOzOs3TSEybuBWau3rZP?= =?us-ascii?Q?PwiRcMsqkr8oUsqW+YT0vyR4045t/06WJNWRe10FSPGztKkWDzh00ys/50F1?= =?us-ascii?Q?PVrUAvr8XMuyJ0edq435qG3Ma8CRAJaS6N+q1mwje/qWdn9NVNyZdo558K2+?= =?us-ascii?Q?ekx8Ad63NhhCsFRLhQsHfpqWwQS28E7ypPxIORDrIrnLkojcrPdCRgtTfLr1?= =?us-ascii?Q?jk6LNC03yNA4yWc++BV67aForhmpqMUWMxn5xy+7+pWdeduonKF+ona9V2tv?= =?us-ascii?Q?f4blkBq8GrL9wk3PIThOBeNbe40vO4XerICuTt+c1I/36Nr3UWFBQfZbQC+z?= =?us-ascii?Q?Hm8sIKVJmHQ3ouK+yx4z9Lhmgoz1twatiSiNJUkwIjzgiJ/ST177mCBTF9rT?= =?us-ascii?Q?RHwMI3XvWEwocFapLiMqWW8bOaQuuBarfAMBrYxMXpkzX8VQFoNWV8RBkik7?= =?us-ascii?Q?2MQ1Nh3/jGfE00FahoBJvEn3TvvIOzo+D3uPUqghWmHkiiOULIXi1LBekdf2?= =?us-ascii?Q?rlmmKsucaHsDkYpuoGMgyenJpQQ/g3Ob7dlGQMa1wbGUS7Z7fuzh4UOVh9HC?= =?us-ascii?Q?mrEh9OInzfutPhrFXzNQ/JlYYROfqsugmYiYCbScr1C7oz8jDOKmzVdDWoiW?= =?us-ascii?Q?AY/hDeEeBoUGA8PxkZ/lLYIBB5jCNh46dJ7AWJzPVIVS2+mD++9Ds7epNkVY?= =?us-ascii?Q?FSiP7UDThdvSusfURlFSLi3smovrEAI5QLdT29W6UJteyijCua/GThD8dwYW?= =?us-ascii?Q?jQhnoUd3Ocida+vWu79QaDCPmEmO95SgIFoBU+ChoYTWJMJHPJdSFQu9d7RC?= =?us-ascii?Q?HCQWKKAq9VWpBu8KVERAjf085FIVnh2pFlwiyIoSpFKnY9CxIvlHWcy/RE1D?= =?us-ascii?Q?UjfxeEOIzdDAvpGd/EHtN5co2/6X1Fs9TPLBfPqk4HvtU3ZOJZZARs9aiZIM?= =?us-ascii?Q?BF3raNvuRP8zZznh7cv7n56Pce/FZ8r4/t1pVRLEhjXTLEqFTNjrNc4JC1+T?= =?us-ascii?Q?M=3D?= X-Microsoft-Exchange-Diagnostics: 1;BY2PR03MB287;5:FNMDfleU+z/WbjQmhLGNj+4aVPFaDFS8REmKHa8wf9dL3Ph7SCGKqG62H2UVug6wRm2TG2ahhpwMeI0DfnxhMeXVdrlCad3hhO7892Cl2bf/UiSxDe38VlViLWhs+QTQMgFT9IU04eC/MbmuDnfNXQ==;24:Vf8+JJtL5jRC4GK/MnlhuVzXsCBDBZYGlF/epSuIM6poB7c3aGDJyz8rqGrLckdXJdscmCMx5IOL3XnLTJKNE3LEnqxTs/1wj4+6u27EhOc=;20:E9C64nxuDj2Y27rs3toAcXTpiSDRmMIyIZ38HqRoA0asmuO+FE1dSnH4w3vgAUzMZtfXWrHC/HIrXvEaabelWg== X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jun 2015 03:20:23.3142 (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.168.50];Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR03MB287 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2068 Lines: 54 On Fri, Jun 26, 2015 at 03:47:04PM +0200, Mike Looijmans wrote: > The datasheet for the USB343x PHY mentions a 50ms wait time before > reading back the ID bit after enabling the internal pull-up or a > reset: > "To monitor the status of the ID pin, the Link activates the IdPullup > bit in the OTG Control register, waits 50mS and then reads the status > of the IdGnd bit in the USB Interrupt Status register." > Implement this by adding a 50ms sleep at the only point in the code > where the ID status is being read without IRQ trigger. This 50mS delay is dedicated for this PHY, you may add it at the PHY driver. > > When starting the board with a USB cable connected to a PC, the > system would activate host mode, then in ~20ms get an ID IRQ and > attempt to switch to gadget mode. This then failed because the > VBUS will not drop to zero (because the host is supplying it). > > After this patch, the system starts up correctly and selects > gadget mode immediately, and the USB link works. It also fixes > the issue that the VBUS supply was being activated while already > being supplied from the host PC. > > Signed-off-by: Mike Looijmans > --- > drivers/usb/chipidea/core.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c > index c865abe..4c6cf48 100644 > --- a/drivers/usb/chipidea/core.c > +++ b/drivers/usb/chipidea/core.c > @@ -801,6 +801,7 @@ static int ci_hdrc_probe(struct platform_device *pdev) > > if (ci->roles[CI_ROLE_HOST] && ci->roles[CI_ROLE_GADGET]) { > if (ci->is_otg) { > + msleep(50); /* Datasheet: Wait 50ms to read ID */ > ci->role = ci_otg_role(ci); > /* Enable ID change irq */ > hw_write_otgsc(ci, OTGSC_IDIE, OTGSC_IDIE); > -- > 1.9.1 > -- Best Regards, Peter Chen -- 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/