Message ID | 20221206-dwc2-gadget-dual-role-v2-2-0de821615dd3@theobroma-systems.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp1067411wrn; Fri, 16 Dec 2022 08:32:45 -0800 (PST) X-Google-Smtp-Source: AA0mqf6ug/Sd15NbDLQz1WYYnF5V7tFjnmfKRpvOYOkApvWj9H4RJbWt3AODb3+GvLQzywt90ugq X-Received: by 2002:a05:6402:2986:b0:463:c2f9:8a0a with SMTP id eq6-20020a056402298600b00463c2f98a0amr26745648edb.33.1671208365496; Fri, 16 Dec 2022 08:32:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671208365; cv=none; d=google.com; s=arc-20160816; b=y06/6k1viHMGGcXnqeS3UnVmAos7WLRoFHnB4UzsblgZoYbGm9fZ2q+g1XWpyUPPD7 OEdKZ66hIHJf7e4L83Vo4FMyGviKfbjHXNWPMhSpkUJfjNhPCwVgsyjlqvP8+OB2T8/b 7D5oAFXgZ+W6wDh8F+5KvuO/WCTGu6MvVQX06z7J3lKMDY6F6I7iVojrwarXqRuza//E f21ibGvDP+O/KZJonJuj0sq4osx3iYtzLH/006PAwxcynq6s1MzB0R9+zCY8Mo8zYL/+ 668epVAgrKi6hxpN4rTKXF/vB9Vl8zagIjBnLZX1cEljdh7sVcSy7ihYWE7WjDRePjmT V2NQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=EBbwkD8/nUFDEWvx78XOI7oWW0Zriht+7FlaT1wcx2Y=; b=qMbzhykFTqGrOsFSM8jX17ueTgye0evmnCsFCmqrDu9fSLEPE+rH1CvilWcftrZyd5 MGX76o2E3NwWkMmdrM08/14AUtWhfU7BZ0DZGflHVri8Bgg+CI8+/OZTvpEU0YXxvmDh ObABl/XlSGXEGrA05ceiqIsJjKS29+JhP1Wds3fYrlVhix7FVayQttInycoHUnxKr4CP Et8xPCIQvS6FvuVZGmL2ESt9da6GjAlPLVD0bvqz15s7cocOd9R+r6mQ+0QoobMcwyV3 kmntXJ4GelPbTwI83PkuA5l2P1dRTP1Hq8UmfrBgPPMoCFSDlfrFAMl4KbgJgNB3Jwym 8FaA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s15-20020a05640217cf00b0046abb9e43a8si2650677edy.321.2022.12.16.08.32.22; Fri, 16 Dec 2022 08:32:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231378AbiLPQa1 (ORCPT <rfc822;jeantsuru.cumc.mandola@gmail.com> + 99 others); Fri, 16 Dec 2022 11:30:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231347AbiLPQaN (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 16 Dec 2022 11:30:13 -0500 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 788694D5FA; Fri, 16 Dec 2022 08:30:12 -0800 (PST) Received: (Authenticated sender: foss@0leil.net) by mail.gandi.net (Postfix) with ESMTPSA id 3328BE000A; Fri, 16 Dec 2022 16:30:08 +0000 (UTC) From: Quentin Schulz <foss+kernel@0leil.net> To: Minas Harutyunyan <hminas@synopsys.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Quentin Schulz <foss+kernel@0leil.net>, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Bin Yang <yangbin@rock-chips.com>, Quentin Schulz <quentin.schulz@theobroma-systems.com> Subject: [PATCH v2 2/2] usb: dwc2: prevent core PHY initialization on Rockchip Date: Fri, 16 Dec 2022 17:29:29 +0100 Message-Id: <20221206-dwc2-gadget-dual-role-v2-2-0de821615dd3@theobroma-systems.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221206-dwc2-gadget-dual-role-v2-0-0de821615dd3@theobroma-systems.com> References: <20221206-dwc2-gadget-dual-role-v2-0-0de821615dd3@theobroma-systems.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" X-Mailer: b4 0.11.0-dev-141d4 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752388983128270755?= X-GMAIL-MSGID: =?utf-8?q?1752388983128270755?= |
Series |
usb: dwc2: fix USB peripheral role in dual-role mode on PX30
|
|
Commit Message
Quentin Schulz
Dec. 16, 2022, 4:29 p.m. UTC
From: Quentin Schulz <quentin.schulz@theobroma-systems.com> In Rockchip vendor kernel, the core PHY initialization is disabled with the following justification: The usb phys need to be controlled dynamically on some Rockchip SoCs. So set the new HCD flag which prevents USB core from trying to manage our phys. This is required to get USB gadget working in dual-role mode on Ringneck PX30 SoM on a Haikou Devkit. Cc: Bin Yang <yangbin@rock-chips.com> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com> --- drivers/usb/dwc2/params.c | 1 + 1 file changed, 1 insertion(+)
Comments
Hi Quentin, On 12/16/2022 8:29 PM, Quentin Schulz <foss+kernel@0leil.net> wrote: >From: Quentin Schulz <foss+kernel@0leil.net> >Sent: Friday, December 16, 2022 8:29 PM >To: Minas Harutyunyan <hminas@synopsys.com>; Greg Kroah-Hartman ><gregkh@linuxfoundation.org> >Cc: Quentin Schulz <foss+kernel@0leil.net>; linux-usb@vger.kernel.org; >linux-kernel@vger.kernel.org; Bin Yang <yangbin@rock-chips.com>; Quentin >Schulz <quentin.schulz@theobroma-systems.com> >Subject: [PATCH v2 2/2] usb: dwc2: prevent core PHY initialization on >Rockchip > >From: Quentin Schulz <quentin.schulz@theobroma-systems.com> > >In Rockchip vendor kernel, the core PHY initialization is disabled with the >following justification: > > The usb phys need to be controlled dynamically on some Rockchip SoCs. > So set the new HCD flag which prevents USB core from trying to manage our >phys. > >This is required to get USB gadget working in dual-role mode on Ringneck >PX30 SoM on a Haikou Devkit. > >Cc: Bin Yang <yangbin@rock-chips.com> >Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com> >--- > drivers/usb/dwc2/params.c | 1 + > 1 file changed, 1 insertion(+) > >diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c index >9ed9fd956940..9095437b3236 100644 >--- a/drivers/usb/dwc2/params.c >+++ b/drivers/usb/dwc2/params.c >@@ -117,6 +117,7 @@ static void dwc2_set_rk_params(struct dwc2_hsotg *hsotg) > p->lpm_clock_gating = false; > p->besl = false; > p->hird_threshold_en = false; >+ p->hcd_skip_phy_initialization = 1; I'm not familiar with all "rk" platforms, but are you sure that p->hcd_skip_phy_initialization = 1 required for all of them? > } > > static void dwc2_set_ltq_params(struct dwc2_hsotg *hsotg) > >-- >2.38.1 To avoid any misinterpretation please add to dwc2_set_default_params() function setting hcd_skip_phy_initialization to 0. Thanks, Minas
Hi Minas, On 12/20/22 07:02, Minas Harutyunyan wrote: > Hi Quentin, > > On 12/16/2022 8:29 PM, Quentin Schulz <foss+kernel@0leil.net> wrote: >> From: Quentin Schulz <foss+kernel@0leil.net> >> Sent: Friday, December 16, 2022 8:29 PM >> To: Minas Harutyunyan <hminas@synopsys.com>; Greg Kroah-Hartman >> <gregkh@linuxfoundation.org> >> Cc: Quentin Schulz <foss+kernel@0leil.net>; linux-usb@vger.kernel.org; >> linux-kernel@vger.kernel.org; Bin Yang <yangbin@rock-chips.com>; Quentin >> Schulz <quentin.schulz@theobroma-systems.com> >> Subject: [PATCH v2 2/2] usb: dwc2: prevent core PHY initialization on >> Rockchip >> >> From: Quentin Schulz <quentin.schulz@theobroma-systems.com> >> >> In Rockchip vendor kernel, the core PHY initialization is disabled with the >> following justification: >> >> The usb phys need to be controlled dynamically on some Rockchip SoCs. >> So set the new HCD flag which prevents USB core from trying to manage our >> phys. >> >> This is required to get USB gadget working in dual-role mode on Ringneck >> PX30 SoM on a Haikou Devkit. >> >> Cc: Bin Yang <yangbin@rock-chips.com> >> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com> >> --- >> drivers/usb/dwc2/params.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c index >> 9ed9fd956940..9095437b3236 100644 >> --- a/drivers/usb/dwc2/params.c >> +++ b/drivers/usb/dwc2/params.c >> @@ -117,6 +117,7 @@ static void dwc2_set_rk_params(struct dwc2_hsotg *hsotg) >> p->lpm_clock_gating = false; >> p->besl = false; >> p->hird_threshold_en = false; >> + p->hcd_skip_phy_initialization = 1; > > I'm not familiar with all "rk" platforms, but are you sure that > p->hcd_skip_phy_initialization = 1 required for all of them? > No I am not. This is however applied to all devices (even non-Rockchip ones) in Rockchip vendor kernel. I could check on an RK3368 since we have a module available for that, but I don't have access to any other Rockchip platform. From a quick grep, the following seems to be susceptible to this change: rk3128 rv1108 rk3288 rk3036 rk3228-evb rk3229 rk3066a rk3188 rk3328 px30 rk3308 rk3368 Cheers, Quentin
diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c index 9ed9fd956940..9095437b3236 100644 --- a/drivers/usb/dwc2/params.c +++ b/drivers/usb/dwc2/params.c @@ -117,6 +117,7 @@ static void dwc2_set_rk_params(struct dwc2_hsotg *hsotg) p->lpm_clock_gating = false; p->besl = false; p->hird_threshold_en = false; + p->hcd_skip_phy_initialization = 1; } static void dwc2_set_ltq_params(struct dwc2_hsotg *hsotg)