From patchwork Tue Feb 2 02:42:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caesar Wang X-Patchwork-Id: 8186041 Return-Path: X-Original-To: patchwork-linux-rockchip@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id F3DC09F3CD for ; Tue, 2 Feb 2016 02:44:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F27B320259 for ; Tue, 2 Feb 2016 02:44:03 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7FE3E20254 for ; Tue, 2 Feb 2016 02:44:02 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aQQwh-0002Tp-EG; Tue, 02 Feb 2016 02:43:59 +0000 Received: from m50-134.163.com ([123.125.50.134]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aQQwe-0002Iu-5k for linux-rockchip@lists.infradead.org; Tue, 02 Feb 2016 02:43:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=Subject:From:Message-ID:Date:MIME-Version; bh=vGuW8 lc4EW5ieOJvlFq36Mvtg7NvsZAYSWLR6FOzmvc=; b=L4I1dRhckivjoL4mSo33P Yc2VNro3sEio57Ef4U4mO0p/OnIPw8tKU9vkj47Mf86qc2seusyb3T7vqi9Sltyp C+GTP3PyQdrJuYeXip1BctaUUF9SgDRw/lggueO9r3DL8mI6ifFrrRtPswxRpb1g YwwWR4DPxS/9cfNMUnvCpA= Received: from [192.168.1.100] (unknown [103.29.142.67]) by smtp4 (Coremail) with SMTP id DtGowAB3FseEF7BWfpRsAQ--.5521S2; Tue, 02 Feb 2016 10:42:16 +0800 (CST) Subject: Re: [Bug] usb: dwc2: Add functions to set and clear force mode To: John Youn , Caesar Wang , Doug Anderson References: <56A7603C.1000409@rock-chips.com> <56A8277F.9@gmail.com> <56AF3D80.90807@gmail.com> <56AF3DCB.20808@gmail.com> <2B3535C5ECE8B5419E3ECBE30077290901DC42FD26@US01WEMBX2.internal.synopsys.com> From: Caesar Wang Message-ID: <56B01785.3030803@163.com> Date: Tue, 2 Feb 2016 10:42:13 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <2B3535C5ECE8B5419E3ECBE30077290901DC42FD26@US01WEMBX2.internal.synopsys.com> X-CM-TRANSID: DtGowAB3FseEF7BWfpRsAQ--.5521S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxArW5tw1ktr4ftF45tw18Krg_yoWrtryrpr y5CFW8Cr4DGryay3ZFyw17Zr1Fy3y7trWUWry5Gw1Uuryqqwn7tr1fKr15Cr98ur15GF12 yr1UK34xur17A3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07bSUUUUUUUU= X-Originating-IP: [103.29.142.67] X-CM-SenderInfo: 5vdv3yhhz03qqrwthudrp/xtbBEQoDlVaDlrhk0AAAsC X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160201_184356_434979_FE3F3F95 X-CRM114-Status: GOOD ( 21.96 ) X-Spam-Score: -2.5 (--) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Huang, Tao" , "open list:ARM/Rockchip SoC..." , Heiko Stuebner , Felipe Balbi , =?UTF-8?B?5ZC06Imv5bOw?= Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi John, ? 2016?02?02? 07:31, John Youn ??: > On 2/1/2016 3:13 AM, Caesar Wang wrote: >> >> ? 2016?02?01? 19:12, Caesar Wang ??: >>> Doug >>> >>> ? 2016?01?30? 03:11, Doug Anderson ??: >>>> Caesar, >>>> >>>> On Tue, Jan 26, 2016 at 6:12 PM, Caesar Wang >>>> wrote: >>>>> Thanks Doug's reply. >>>>> >>>>> Cc: Wulf >>>>> ? 2016?01?27? 00:05, Doug Anderson ??: >>>>>> Hi, >>>>>> >>>>>> On Tue, Jan 26, 2016 at 4:02 AM, Caesar Wang >>>>>> wrote: >>>>>>> Hi John, Felipe >>>>>>> >>>>>>> >>>>>>> I'm no familiar with usb stuff. >>>>>>> then I found this patch will break usb working for rk3036 SoCs, maybe >>>>>>> more >>>>>>> SoCs. >>>>>>> Says, U disk can't work on usb host. >>>>>>> >>>>>>> The failure log: >>>>>>> >>>>>>> 32.645481] usb usb2-port1: connect-debounce failed >>>>>>> >>>>>>> >>>>>>> Tested by following branch: >>>>>>> https://github.com/Caesar-github/rockchip/tree/kylin/next (kernel: >>>>>>> 4.5-rc1) >>>>>>> >>>>>>> Revert "usb: dwc2: Add functions to set and clear force mode" will >>>>>>> work >>>>>>> for >>>>>>> it. >>>>>>> >>>>>>> >>>>>>> Maybe, someone have some suggestions or ideas? >>>>>> Can you check if this series helps you? >>>>>> >>>>>> http://marc.info/?l=linux-usb&m=145255851516121&w=2 >>>>> Unluckily, this series patches can't fix it on rk3036 SoCs. >>>>> I revert this CL ("usb: dwc2: Add functions to set and clear force >>>>> mode") to >>>>> work firstly. >>>> You're 100% positive? In particular you made sure you had this patch >>>> (one of the two in John's series I pointed at), which explicitly >>>> mentions fixing a problem with the patch you mention? >>> I'm 100% positive the John's patches can fix this issue >> Sorry, John's patches can't fix this issue. >> >> >>> As the following verified on >>> https://github.com/Caesar-github/rockchip/commits/for-usb-tests >>> >>> Anyway, Meanwhile if we add the folllowing patch can work for me. I >>> will track it on tomorrow if you have other suggestions. >>> >>> diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c >>> >>> index e991d55..90f4abf 100644 >>> >>> --- a/drivers/usb/dwc2/core.c >>> >>> +++ b/drivers/usb/dwc2/core.c >>> >>> @@ -637,6 +637,13 @@ int dwc2_core_reset_and_force_dr_mode(struct >>> dwc2_hsotg *hsotg) >>> >>> return retval; >>> >>> >>> >>> dwc2_force_dr_mode(hsotg); >>> >>> + >>> >>> + /* >>> >>> + * NOTE: This long sleep is_very_ important, otherwise the core >>> will >>> >>> + * not stay in host mode after a connector ID change! >>> >>> + */ >>> >>> + usleep_range(150000, 160000); >>> >>> + >>> >>> return 0; >>> >>> } >>> > Hi Cesar, > > On your platform, is the dwc2 controller OTG? If so, what mode is the > driver running in (dr_mode=HOST, PERIPHERAL, or OTG)? It's the Host mode. ( USB_DR_MODE_HOST) > > The force mode only requires 25ms delay but maybe the sleep needs to > be longer on your system for some other reason. Which is unfortunate > because 150ms is very long. > > Under what condition do you see the problem. Is it on connector ID > change? If so we might put the long delay in a more appropriate > location so as not to affect delay in probe. > > Also, could you try *only* reverting the following: > > commit 97e463886b873f62bea2293e7edf81fdb884b84f ("usb: dwc2: Reduce > delay when forcing mode in reset") I'm sure can't work if we revert it. log ...: "[ 5.705971] usb usb2-port1: connect-debounce failed" d4b3ff1 Revert "usb: dwc2: Reduce delay when forcing mode in reset" c69654f usb: dwc2: Fix probe problem on bcm283 b9da0ff Revert "usb: dwc2: Move reset into dwc2_get_hwparams() --- Then, add the following patch can work. } > The original patch you referred to preserves the long delay at the > point it is used for OTG but then this later patch (97e46388) > decreased the value. So maybe we can just revert this later patch. > > Regards, > John > _______________________________________________ > Linux-rockchip mailing list > Linux-rockchip@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-rockchip diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c index e991d55..90f4abf 100644 --- a/drivers/usb/dwc2/core.c +++ b/drivers/usb/dwc2/core.c @@ -637,6 +637,13 @@ int dwc2_core_reset_and_force_dr_mode(struct dwc2_hsotg *hsotg) return retval; dwc2_force_dr_mode(hsotg); + + /* + * NOTE: This long sleep is _very_ important, otherwise the core will + * not stay in host mode after a connector ID change! + */ + usleep_range(150000, 160000); + return 0;