Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2552031rwb; Fri, 9 Dec 2022 03:41:35 -0800 (PST) X-Google-Smtp-Source: AA0mqf4By4RUOlwbJ33nSH2b3apsQa3MHRnV/Olxjg6PzfQW0Yd8CnTWDgoP8QxGD+SZsF3nGobI X-Received: by 2002:a17:90b:190:b0:219:1a07:a5e5 with SMTP id t16-20020a17090b019000b002191a07a5e5mr5457757pjs.11.1670586095394; Fri, 09 Dec 2022 03:41:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1670586095; cv=pass; d=google.com; s=arc-20160816; b=KsxUwmT0ePEa2Ou6UHVuOy40rCzDc6dfjIsfr65Ku8I++puu1EWQn5U7M/CosZbl6X KmvC3exJ+CJ2fnlsAf/o/MWZolnK3TF+ieDis4sE0jLXe1GYu2rXIWTq1woBYJ6YsZOf dZ1/8vSL/l+kfAQ1Tt4bFY7ZMRDWB6Mlys3/XxlHjSaDH7q2tv67o7u6UtzjVQux9AoW itRNklMBCzu7aNLPmnLk+1VdRczN+myUoaeHLWmB2rAKHU4H4FC7uDt67qIP3PPE01YY 58sfb4Zp8q+VB+1VfA1jyjOmWH6x7oRjUSNuuxHyyPfIE0Ha4jMl86cKEpKhdYN4Fn6G bAkw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=z49EBeTkSbE4WunP1JWWe3GQ8uPUVc+w/njDPq2S+Bw=; b=W/dbkRweYkJ7NaXONP64Ya2HNW44TlhvINPMBzchF8lfNRtfK4LyV6b/24bG22oI8e Olqbz+JFslURGdx82ddKKzNMsmXnOohtdlWU+AuCAfevvh/T8Rclje6JwVUR3XhmFv4S mjzWKlNBmn6Lqa4FwizvKGSTnfWH2cGEplgxEO1VaFIYMzqes6kWsYaGQdzVubJXs6Wf 5sAI9pbpJWL33XUknGP5/Nv28Xs6Tr3OwrFKtQwecemb7KUOaHhcTYE2jonTlHiZizO9 BdW6q4PtsInz01u2nkSNqkIXczlMT8v65pBc1drk5nTHAwzpHsx9qLWHyM6uti/afV4x vbrQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@theobroma-systems.com header.s=selector1 header.b=R1eOZ9B6; arc=pass (i=1 spf=pass spfdomain=theobroma-systems.com dkim=pass dkdomain=theobroma-systems.com dmarc=pass fromdomain=theobroma-systems.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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=theobroma-systems.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k4-20020a654644000000b00476f87434ebsi1288915pgr.467.2022.12.09.03.41.25; Fri, 09 Dec 2022 03:41:35 -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; dkim=pass header.i=@theobroma-systems.com header.s=selector1 header.b=R1eOZ9B6; arc=pass (i=1 spf=pass spfdomain=theobroma-systems.com dkim=pass dkdomain=theobroma-systems.com dmarc=pass fromdomain=theobroma-systems.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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=theobroma-systems.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230048AbiLILQK (ORCPT + 74 others); Fri, 9 Dec 2022 06:16:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229995AbiLILPn (ORCPT ); Fri, 9 Dec 2022 06:15:43 -0500 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2062d.outbound.protection.outlook.com [IPv6:2a01:111:f400:7d00::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A7F770BAB; Fri, 9 Dec 2022 03:15:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hpt+Y7Si5BP26DrSMuoiH5kjnq4qXdnqpImaGlqUv0N6+310PiJg9DtReWrGSL1gDfr4ylBSr/Jjt9HzTKMOkLLprOTyX1E0e2puXD3DQsBskAZipGgc70we8eAH6PSQCxL57Q1QG5qeYeBHEVM8ybZnF6d5vM3CvTHPxMAPy4v8FMVz+6BRfUUKpG95DPATuIYFcYAMVKLp3omCxmfTJK9HuGTSByU+mXn+XYBYBK2CGivafo+A7O12/tMQiWlMjqPxBHq4y4xsRqrLD4u/hTIp/6aGOk+ee3l+oYC+vknMQ64Q0xVWoNyDFQYisfs7/urzXjJlVFsBOLOM6GRfmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=z49EBeTkSbE4WunP1JWWe3GQ8uPUVc+w/njDPq2S+Bw=; b=iv7arOaJXKTgrDZVTSAKHqFXLJNTGqo6wFbKBdDp7TWpQlSjF63VDVHeNKQiTLwm0hxSqfYYY2j8GrSHTKo23kGemmDedeZLyghk3ZF4hAppDCHCyc2HDhjV2a2rc71agn9my6joQl14sFhVYyqd01CQWkXAQTRonRi9smqVGgQa6RDcDi/0d/ZxbIjvIp5NN0JkEDEfca4IuuDlpK9dG+paKzWI2gDWLsFNzMJ+tbQfbELt55FdUVoVKOnJQIsws7Li5KWwWV7zoe+FJ2pPo2SrfDKcWnGr6ED+rS+D52nME+pAXcABUZbuxzIP6fenvwoWwEQfkOMEBrHbo6DK3w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=theobroma-systems.com; dmarc=pass action=none header.from=theobroma-systems.com; dkim=pass header.d=theobroma-systems.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=theobroma-systems.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=z49EBeTkSbE4WunP1JWWe3GQ8uPUVc+w/njDPq2S+Bw=; b=R1eOZ9B6f5Dqpnx5hYNo+OijlG4Y/KZU8xwcc/8KyTmzZR6WRwQMa7nxd9AqvQhfRRs9ouPMYPScgDpKhwii7Oju2v6F+NphwOZ2TffmNT2/O3uASUTB9FG1VGTVl8Z0ArKP7Cl7FIkXjIZbRoQcOjBn4Db0JAR5HOdgjMWfyZE0pS4qakktfL1Mt7z74pAaSqSoHUhF4gZ2NeATE8o79pKx+hM1Gr9zJylLpGnyVap3h5j/li7+B3LpHVlhr1jUuSfRL+vNjz2OciLy7a69Ny45Mz9xCaAcM8dyjel6PFFMOD2XAzr7iATHZm2xlh0a4x6w+saKTRVltG3jKhNkCw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=theobroma-systems.com; Received: from DU2PR04MB8536.eurprd04.prod.outlook.com (2603:10a6:10:2d7::10) by DBBPR04MB7690.eurprd04.prod.outlook.com (2603:10a6:10:200::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.11; Fri, 9 Dec 2022 11:15:36 +0000 Received: from DU2PR04MB8536.eurprd04.prod.outlook.com ([fe80::9ebd:cd48:9396:76f6]) by DU2PR04MB8536.eurprd04.prod.outlook.com ([fe80::9ebd:cd48:9396:76f6%6]) with mapi id 15.20.5880.016; Fri, 9 Dec 2022 11:15:36 +0000 Message-ID: <69c0f9c0-5c89-e99e-c807-9963ca377093@theobroma-systems.com> Date: Fri, 9 Dec 2022 12:15:34 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [PATCH 3/3] usb: dwc2: prevent core phy initialisation Content-Language: en-US To: Greg Kroah-Hartman , Quentin Schulz Cc: Minas Harutyunyan , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, William Wu , Bin Yang , Frank Wang References: <20221206-dwc2-gadget-dual-role-v1-0-36515e1092cd@theobroma-systems.com> <20221206-dwc2-gadget-dual-role-v1-3-36515e1092cd@theobroma-systems.com> From: Quentin Schulz In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: FR2P281CA0062.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:93::20) To DU2PR04MB8536.eurprd04.prod.outlook.com (2603:10a6:10:2d7::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8536:EE_|DBBPR04MB7690:EE_ X-MS-Office365-Filtering-Correlation-Id: 5776eff5-1e29-404c-9e20-08dad9d6b27d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rHdTDsPWYAol1BL7i4HKctVaJlQdZSU8u5ejE3gwmexBweATHWncb1TImYoPrzaJ7alaFT87qnSMw/jqjnP7v0dGd8Y13E49OGkTYVDAX2MMvcwMfNu5HDRyK3G1khE2r8PNlXQibGiSLjktCT14Umd/nowPGYZWJIjNXTpzzxjy2zfsMLPUXW1L6LAsdhzlI1GBl85uehVafG6EsaIsB65ZnaItNniB+Sv6NK1wUC/51qm+5YfmY6WwzCoG2HrfhxLHeK3CVs69GWpp9K01TAK8V+sNq+lP96OUcw+hw59XaW8EI+3vuLnQHQpuwmyhJAnxPRRRI6BnYpOKc5bUT1Xx+uyJU1PWANMx2tqpILnK07W5qgnuDAZKKnEMohYHEEZ5QUcai4AjGcBr56qfohwcUgnGweaZ0Kgeue8J9aV1wC/8UHJOm3gB/od0QNPs00N4NFjRy/A8ppwlCjHLpQq5wIITUVVpTN2S7siBL05PCVTwICSsXeMGvIPp2XsJUFcxksSWofmxTCPPD1xfBuJQPfZ0/p3AvMnUG05f0cKIDbnjVOWGx5VeL4aA4ftcjkcy+kBk/Q85fL9XQpLpYEfyUWsw2QyFVax6R+uUvwuh1THQP766HKjSv2vypAJtOXX5JauukaKH/DQ+lOZQktK/2FmuQMMjkIZExnnToMCz8YLMawndoj7GcsERfWXhhblLYWMFKsBFuFKxwhgG0DicyLb7/bWMNmKNUeeprgY= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU2PR04MB8536.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(136003)(376002)(396003)(346002)(39850400004)(451199015)(31686004)(36756003)(5660300002)(8936002)(44832011)(31696002)(38100700002)(86362001)(41300700001)(6486002)(54906003)(83380400001)(478600001)(110136005)(186003)(53546011)(6506007)(4326008)(8676002)(66556008)(66476007)(66946007)(316002)(2616005)(26005)(2906002)(6512007)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?d3NKZy83dHVKdXQrSTRraTFlVlBUN1d3L25pMkNjWmUyWWxSNXhXMTFRakJp?= =?utf-8?B?dWtmcnhkWDdsYy9lUVdCTmxLY0c1eEk4Rnp4TzZLZkFTdndNU3NONDVwUGJ6?= =?utf-8?B?WS9XbmdMRkthMzM0dVhqa0lqWDNIUG9ZdnBuam5SdmZTalFxQkZEVjBRSHdi?= =?utf-8?B?RFluUWZxNEQwZDhPS09KbTZSV0ozRGdHdWpDOEJBLzZOQzlWQjBKNjE3QWNv?= =?utf-8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1QxTjNlemdWMW9DbGdudldvRGo4ZGdn?= =?utf-8?B?dVVpMEtxS0hXRmQzd1RocC9WV0dYTjN2LzNMOG1qUXljcUV5QU1DZ25vL2ZK?= =?utf-8?B?ZHRlUWVFcGEyZkRMSG9RNjBFbUdRTlBMRmtRanFXaGJaMmd4enJSTVFURlRj?= =?utf-8?Q?k+bp3TTKkiBDrKf9DgyJ80s=3D?= X-OriginatorOrg: theobroma-systems.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5776eff5-1e29-404c-9e20-08dad9d6b27d X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8536.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2022 11:15:36.8401 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 5e0e1b52-21b5-4e7b-83bb-514ec460677e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: /C26THG4y9XNRMIE0beNu2hjmsVAu0livatoX9VrD/zZnAsUyCRKncavU8HRHb74fBWlbAMd3yj4vYqg0vMeEoYUzO+IH2M1ytz719H0NfsGjMEyI7J38ud4Q1ZVWRha X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7690 X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,T_SPF_PERMERROR autolearn=no 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: X-Mailing-List: linux-kernel@vger.kernel.org Hi Greg, On 12/8/22 16:53, Greg Kroah-Hartman wrote: > On Wed, Dec 07, 2022 at 02:19:18PM +0100, Quentin Schulz wrote: >> From: Bin Yang >> >> 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. >> >> Signed-off-by: Bin Yang >> Signed-off-by: Frank Wang >> Signed-off-by: Quentin Schulz >> --- >> drivers/usb/dwc2/hcd.c | 7 +++++++ >> 1 file changed, 7 insertions(+) >> >> diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c >> index 657f1f659ffaf..757a66fa32fa8 100644 >> --- a/drivers/usb/dwc2/hcd.c >> +++ b/drivers/usb/dwc2/hcd.c >> @@ -5315,6 +5315,13 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg) >> if (!IS_ERR_OR_NULL(hsotg->uphy)) >> otg_set_host(hsotg->uphy->otg, &hcd->self); >> >> + /* >> + * do not manage the PHY state in the HCD core, instead let the driver >> + * handle this (for example if the PHY can only be turned on after a >> + * specific event) >> + */ >> + hcd->skip_phy_initialization = 1; > > Wait, doesn't this mess with the phy logic for all other chips that use > this IP block? Have you tested this on other systems? > I have not. I asked this in the cover-letter but I guess I should have made the patch series an RFC for this reason? > I'd like some verification first before taking this change as it seems > very specific-platform. > There's already some platform-specific callbacks for the driver (see dwc2_set_rk_params in drivers/usb/dwc2/params.c) but this gets called too early, before hcd structure is actually allocated. So we either need to use some "proxy"/shadow variable in dwc2_core_params and then update it right after hcd gets allocated or have another platform-specific callback only for hcd (post-)initialization. Nothing too fancy so shouldn't take too long to implement. Any preference? Something else? Also on a side note, after further testing, USB peripheral mode in dual-role mode does not seem to be entirely fixed with this patch series, I still have occasional locks. But considering that it absolutely didn't work before, it is some kind of progress. There are also some issues related to USB host mode in dual-role mode but I saw those happening before the patch series too. I'll see what I can do, really frustrating to work with IPs for which there's no documentation :/ Cheers, Quentin