Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp693724pxm; Fri, 25 Feb 2022 17:27:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJz9hMOCbc0frk/lFfdpqp2vsaYycNRf79spzvuDHlam30BO/H9M2fppANu+F65I6b78Pz9E X-Received: by 2002:a05:6a00:148b:b0:4e0:1001:1063 with SMTP id v11-20020a056a00148b00b004e010011063mr10446491pfu.15.1645838860711; Fri, 25 Feb 2022 17:27:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645838860; cv=none; d=google.com; s=arc-20160816; b=y5xS4KopXbb8b3UtQH7qXZnzZb5u//JFJ+lX9wmzFVvLFDsaaTZOQxHKS+FzkPlhBO eJWY6hq8Br3A2O6wAzBJRzZ4Y1TwdF/cviMQuHaiSRS+6dzQM1KDuteDRskXtQ1LndUG pGdO8Iqa+8SIt5Jif6XBLlerKAMh6xhYdiuVcaB0KJdHUoj74lyewfNW9Gue0Bvio1Z5 VYo3ZhorqQ6fq36NCCkQ93B9QJoBbFh2iFvz/F0yR+hAZjpuc7JTjQ/YGrvav0F3+3xC NQGy+S1yM6xssfr81nq1mg0k5KI+y4eo8vXF/tPCZWTF3wraFvP++0A4zNdeHhFvM9i9 3+nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=d82XZA2/evL6z4Q1q/SvLwPu9W9fK10IO/w6ZJFsHio=; b=MWTYsIF9gTHJhJ82jKsy319TyqpHiw7J/vYNJ2Au4JBSDsiBfK0XsaHk8ATCZOaj+A 6lbh9s5M2HS3yIu82Kx91O0xpZ0n6sAXYoxhwSI7lyf5LgvfqKYShyPLPltane/+ctTe Ezxu8rSt76jBAROoiFZafYsH81FY7Qf2pSDavaQGg7+eqQdJzz+rIdyKloYIYbK4eW8b Egib5dlark2n2B195qTKBCMBuwROnWNL9yec2DEfOtbQwpKXorD6aOCV3Pg3TVzD4Luq pna3i+idg7aKLL9lTN47883GrkEmvPNTdr6JX8YlOtmbKYqrJ24o7TbiMt37C7F5RQJ2 JQ/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=q5QqyfiC; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id u8-20020a170902a60800b0014f992a21dbsi3126785plq.111.2022.02.25.17.27.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Feb 2022 17:27:40 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=q5QqyfiC; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 599F223932A; Fri, 25 Feb 2022 17:26:04 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242501AbiBYRQi (ORCPT + 99 others); Fri, 25 Feb 2022 12:16:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232659AbiBYRQg (ORCPT ); Fri, 25 Feb 2022 12:16:36 -0500 Received: from alexa-out.qualcomm.com (alexa-out.qualcomm.com [129.46.98.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 245EE1BB707; Fri, 25 Feb 2022 09:16:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1645809364; x=1677345364; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=d82XZA2/evL6z4Q1q/SvLwPu9W9fK10IO/w6ZJFsHio=; b=q5QqyfiCcUGxSqgdQhp9juiHNWZBZpYn3t4pV6P5NgewX3iH5Pw9c8GU Fup2YTjU40hfJGS7PzIDx03SA0M0SuMivXf5Pc82YjuK7KDMJ1ttDie2U qDMXJILjrQSo0SZUQpM//xWWwxDYfL4iySjVwVPqq1pKVoDOM76DHsHc3 o=; Received: from ironmsg07-lv.qualcomm.com ([10.47.202.151]) by alexa-out.qualcomm.com with ESMTP; 25 Feb 2022 09:16:03 -0800 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg07-lv.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Feb 2022 09:16:03 -0800 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.15; Fri, 25 Feb 2022 09:16:03 -0800 Received: from jackp-linux.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.15; Fri, 25 Feb 2022 09:16:02 -0800 Date: Fri, 25 Feb 2022 09:16:01 -0800 From: Jack Pham To: Peter Geis CC: Felipe Balbi , Greg Kroah-Hartman , Bin Yang , "Heiko Stuebner" , , , Thinh Nguyen Subject: Re: [PATCH v1 4/8] usb: dwc3: core: do not use 3.0 clock when operating in 2.0 mode Message-ID: <20220225171601.GF13801@jackp-linux.qualcomm.com> References: <20220225145432.422130-1-pgwipeout@gmail.com> <20220225145432.422130-5-pgwipeout@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20220225145432.422130-5-pgwipeout@gmail.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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 +Thinh Hi Peter, On Fri, Feb 25, 2022 at 09:54:27AM -0500, Peter Geis wrote: > From: Bin Yang > > In the 3.0 device core, if the core is programmed to operate in > 2.0 only, then setting the GUCTL1.DEV_FORCE_20_CLK_FOR_30_CLK makes > the internal 2.0(utmi/ulpi) clock to be routed as the 3.0 (pipe) > clock. Enabling this feature allows the pipe3 clock to be not-running > when forcibly operating in 2.0 device mode. > > Signed-off-by: Bin Yang > Signed-off-by: Peter Geis > --- > drivers/usb/dwc3/core.c | 4 ++++ > drivers/usb/dwc3/core.h | 1 + > 2 files changed, 5 insertions(+) > > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c > index 18adddfba3da..032d40794fae 100644 > --- a/drivers/usb/dwc3/core.c > +++ b/drivers/usb/dwc3/core.c > @@ -1167,6 +1167,10 @@ static int dwc3_core_init(struct dwc3 *dwc) > if (dwc->parkmode_disable_ss_quirk) > reg |= DWC3_GUCTL1_PARKMODE_DISABLE_SS; > > + if (dwc->maximum_speed == USB_SPEED_HIGH || > + dwc->maximum_speed == USB_SPEED_FULL) > + reg |= DWC3_GUCTL1_DEV_FORCE_20_CLK_FOR_30_CLK; > + I doubt this is applicable to all revisions of the DWC_usb3x IP cores? For instance in the programming guide for DWC_usb31 1.90a bit 26 of GUCTL1 is 'Reserved'. While I do see it in the DWC_usb3 databook, table 4-8 entry "Remove pipe_clk mux for 2.0 mode?" mentions this feature was only added in v2.90a. So this setting at least needs a revision check to make sure we're not causing unexpected behavior. Something like DWC3_VER_IS_WITHIN(DWC3, 290A, ANY) Jack > dwc3_writel(dwc->regs, DWC3_GUCTL1, reg); > } > > diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h > index eb9c1efced05..ea3ca04406bb 100644 > --- a/drivers/usb/dwc3/core.h > +++ b/drivers/usb/dwc3/core.h > @@ -259,6 +259,7 @@ > /* Global User Control 1 Register */ > #define DWC3_GUCTL1_DEV_DECOUPLE_L1L2_EVT BIT(31) > #define DWC3_GUCTL1_TX_IPGAP_LINECHECK_DIS BIT(28) > +#define DWC3_GUCTL1_DEV_FORCE_20_CLK_FOR_30_CLK BIT(26) > #define DWC3_GUCTL1_DEV_L1_EXIT_BY_HW BIT(24) > #define DWC3_GUCTL1_PARKMODE_DISABLE_SS BIT(17) > > -- > 2.25.1 >