From patchwork Mon Feb 1 11:12:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caesar Wang X-Patchwork-Id: 8178031 Return-Path: X-Original-To: patchwork-linux-rockchip@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C8FD4BEEE5 for ; Mon, 1 Feb 2016 11:12:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BC14B20426 for ; Mon, 1 Feb 2016 11:12:32 +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 AC25920414 for ; Mon, 1 Feb 2016 11:12:31 +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 1aQCPF-0006dT-HT; Mon, 01 Feb 2016 11:12:29 +0000 Received: from mail-pa0-x232.google.com ([2607:f8b0:400e:c03::232]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aQCPC-0006Zs-Mg for linux-rockchip@lists.infradead.org; Mon, 01 Feb 2016 11:12:27 +0000 Received: by mail-pa0-x232.google.com with SMTP id cy9so80625598pac.0 for ; Mon, 01 Feb 2016 03:12:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-type:content-transfer-encoding; bh=/dXWONOqYZj8d6um0DHDSZ8VFt+rWHYULWFK/wPW5rQ=; b=KEt+SbcCohBzF0W9qwWxcqx5p/4P1a3maJR8idR9C+dYc5VWBBBkjmHlR9w02WXp0u UeIqLRTNeiMY6Z8rArUyXaXpEbOFIFa2pXJe7sQ7gakIJ0D5lp4RWrP6C9qBgmcyQ+xI OvT/48kHrgluM5nzUxjuH5r9RMnpmPaWFBpuuj9Q+7PQ3sGU5u0LglHSoE+ZPI7DdCHJ 08htlbcvU2SoU9LsaI39nHzUuRrMQcJNfm60lq0SLLKfegNBEr8GZ/g92CllC1LAml7Q T/V9+62Y1PaCJl/HNKZrGLLIbyKKVH/oF8Ium7uNbQBGtPLdxnicRZPRiDpkMIBBk9qP wjMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-type :content-transfer-encoding; bh=/dXWONOqYZj8d6um0DHDSZ8VFt+rWHYULWFK/wPW5rQ=; b=LwaR52STTJp0ekFpm59nE331um/LVGecg43YcQT/IyXwLkvyySE5qvPQ2kyQpfvZJV JbhngyDWb7UzKIB/Pcn6B+4cPOd823xeSqMN0Iyon7rXOBVQlfcZcovGdJRVW1wmH4eE DFlOKUgF00Yp5yw1b5WojdAj9HpwSgtanWB8UGRvz+kLM4UuZZqIA/mliGVYsjO3+5sB 6kbos8h9gBb5Z+CbX/7idqX7aanvxMUr7+MQXFZ8bm3a3cDc+2A4R7eGCAuq8Bs/fvns ppqhTBbKUXlU4IbQkzFgoc7klLd1Lx2gelM6gHaLmw3lHE6onzbChwe3dXRzQHC1Xd0l v+0Q== X-Gm-Message-State: AG10YOQm1TF2oqImOjtBiJGbifXsri63L3JimgOys6uAusvB3P4kULoSwBcRrHVRVEbC8w== X-Received: by 10.66.253.137 with SMTP id aa9mr36974039pad.139.1454325125668; Mon, 01 Feb 2016 03:12:05 -0800 (PST) Received: from [192.168.1.100] ([103.29.142.67]) by smtp.gmail.com with ESMTPSA id q14sm42374728pfq.81.2016.02.01.03.12.02 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 01 Feb 2016 03:12:04 -0800 (PST) Subject: Re: [Bug] usb: dwc2: Add functions to set and clear force mode To: Doug Anderson References: <56A7603C.1000409@rock-chips.com> <56A8277F.9@gmail.com> From: Caesar Wang Message-ID: <56AF3D80.90807@gmail.com> Date: Mon, 1 Feb 2016 19:12:00 +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: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160201_031226_804557_07C45E9D X-CRM114-Status: GOOD ( 19.57 ) X-Spam-Score: -2.7 (--) 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: Caesar Wang , "Huang, Tao" , Heiko Stuebner , John Youn , Felipe Balbi , "open list:ARM/Rockchip SoC..." , =?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_ADSP_CUSTOM_MED, 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 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. 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. } > > Author: John Youn > AuthorDate: Mon Jan 11 16:32:28 2016 -0800 > > usb: dwc2: Fix probe problem on bcm2835 > > Fixes an issue found on Raspberry PI platform that prevents probe. Don't > skip setting the force mode if it's already set. > > Fixes: 09c96980dc72 ("usb: dwc2: Add functions to set and clear force mode") > Signed-off-by: John Youn > Reported-by: Stefan Wahren > Reported-by: Remi Pommarel > Tested-by: Stefan Wahren > Tested-by: Remi Pommarel > > > Maybe try again just in case there was some problem updating your > kernel when you tested before? If you're sure you can reproduce the > problem even with John's two patches, perhaps you can give more > details about what part of his patch broke things for you. > > -Doug > > _______________________________________________ > 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;