Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp166138rwi; Wed, 12 Oct 2022 17:58:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6RPG4fJBAbHPD29G5sh5pztg3X2CgPzNBkDinro3r7wvMjPqfH6o9aybiNd/d/LNO/7Lor X-Received: by 2002:a17:90a:a088:b0:20d:67b7:546d with SMTP id r8-20020a17090aa08800b0020d67b7546dmr8345882pjp.6.1665622705251; Wed, 12 Oct 2022 17:58:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665622705; cv=none; d=google.com; s=arc-20160816; b=HXGFItxfDxRWuW8L+JYAG557oPcYaadwhS4zLzJS7lZyn3zL9UofzhTeV0cZE1kIIL EcPSRy95UbY+WGOd4YxkzcZOHOGIadESRNwJDjkGJVdITDMYtbl4urTW/eXmTpoCR2pu ViMjexu1BR+SxNZErhj7qLpI+1PAd1DyoM7Xn9qXsXNbxObXJ5Z/KHGe5SlK8pFUcNZX 1LxvHfSdV3SjFAO7saDQssSvqAyE3uv4ZO9NQu9dIgkCq9m1jegwpR1xqjyvA20sHqMD HzeQCd9wEAjvoXcOR0TRIV2THaBRE2dA3cjavupHa15aHGdH3FtQWugY3i6zKEDnzawC V5qg== 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 :dkim-signature; bh=CqHdpWMjQ91tUVAwQJY5BQvFV+DcRaxXy5zglSdMq9c=; b=sPEIO+O1+LUE+SuZ3tZoSnu2HLjTwX+15OUqMlnOtBJ4TG2pM68PjhhmrfT9pcCZ84 1l8Iq4Bol0t0hvcKwXVOqz43TtPXFxAZ/YC+IoWNXVdCIfsf0UcFt9Rit49d6rXx5mJG g3xywP6RR2ymut19a/h97ZY5SGYHTY3RmFL7S2CFM/lxVSwHqOhaH8j46DC1e1O0gs9C ujF/4ApN2dla3oRSjpWVnrIEanPbDFCKbbAa+8TQO6Mxwlgj58H7LvE3AQ/9aG38chQV L6LFoFmDTKdE4lRTjhgszXc3p6t6JSbL5/ySu+AI4fHnopIw/k+7SPflYyjPHsbZ3Epp 6JTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=VfSJfGVe; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k190-20020a6384c7000000b00462566bfda8si11382381pgd.788.2022.10.12.17.58.13; Wed, 12 Oct 2022 17:58:25 -0700 (PDT) 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=@kernel.org header.s=k20201202 header.b=VfSJfGVe; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230169AbiJMAUQ (ORCPT + 99 others); Wed, 12 Oct 2022 20:20:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230100AbiJMATR (ORCPT ); Wed, 12 Oct 2022 20:19:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8469815E0D9; Wed, 12 Oct 2022 17:17:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 77D9DB81CBD; Thu, 13 Oct 2022 00:17:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B6C8C43470; Thu, 13 Oct 2022 00:17:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1665620246; bh=rTa3Ku8s8RfWGDNKrTIwY1D75QMDAhQeks95usefagY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VfSJfGVefLMwLGnyI98VoGaxeUlUSqLvmyvlhUEyvwnYVSMifN6lwPDzkKtFM9qPL s/4oJDrYcZ0nAOuuqdpBH3E0yqQ2lPeBC7yjlMhgBeo2e3b2bmUJ3iw+iFj77lzhXP KOa5JejJHE6Cl4ha1xDMscz5+QUTqAnjJ/ntylrLeEswJScT9H+6S2kXqUjZUkzrbc xoiZM4JyyqcJjsBd0gjadw+DHWIaqfThXCPp0vcn4MqSuslj6nP98KDEKRkKX8v3MU b6nzdab1i2Kjc2sup4MJ3SsJ2R1xyscNjyJsDWPvc//182PdndLrXT7sL6q6ytnZkp 2JWRsyygZxxJw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Alexander Stein , Li Jun , Greg Kroah-Hartman , Sasha Levin , Thinh.Nguyen@synopsys.com, linux-usb@vger.kernel.org Subject: [PATCH AUTOSEL 6.0 39/67] usb: dwc3: core: add gfladj_refclk_lpm_sel quirk Date: Wed, 12 Oct 2022 20:15:20 -0400 Message-Id: <20221013001554.1892206-39-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221013001554.1892206-1-sashal@kernel.org> References: <20221013001554.1892206-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexander Stein [ Upstream commit a6fc2f1b092787e9d7dbe472d720cede81680315 ] This selects the SOF/ITP counter be running on ref_clk. As documented U2_FREECLK_EXISTS has to be set to 0 as well. Reviewed-by: Li Jun Signed-off-by: Alexander Stein Link: https://lore.kernel.org/r/20220915062855.751881-3-alexander.stein@ew.tq-group.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/dwc3/core.c | 8 +++++++- drivers/usb/dwc3/core.h | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index d0237b30c9be..4123462cac9b 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -408,6 +408,10 @@ static void dwc3_ref_clk_period(struct dwc3 *dwc) reg |= FIELD_PREP(DWC3_GFLADJ_REFCLK_FLADJ_MASK, fladj) | FIELD_PREP(DWC3_GFLADJ_240MHZDECR, decr >> 1) | FIELD_PREP(DWC3_GFLADJ_240MHZDECR_PLS1, decr & 1); + + if (dwc->gfladj_refclk_lpm_sel) + reg |= DWC3_GFLADJ_REFCLK_LPM_SEL; + dwc3_writel(dwc->regs, DWC3_GFLADJ, reg); } @@ -789,7 +793,7 @@ static int dwc3_phy_setup(struct dwc3 *dwc) else reg |= DWC3_GUSB2PHYCFG_ENBLSLPM; - if (dwc->dis_u2_freeclk_exists_quirk) + if (dwc->dis_u2_freeclk_exists_quirk || dwc->gfladj_refclk_lpm_sel) reg &= ~DWC3_GUSB2PHYCFG_U2_FREECLK_EXISTS; dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg); @@ -1525,6 +1529,8 @@ static void dwc3_get_properties(struct dwc3 *dwc) "snps,dis-tx-ipgap-linecheck-quirk"); dwc->parkmode_disable_ss_quirk = device_property_read_bool(dev, "snps,parkmode-disable-ss-quirk"); + dwc->gfladj_refclk_lpm_sel = device_property_read_bool(dev, + "snps,gfladj-refclk-lpm-sel-quirk"); dwc->tx_de_emphasis_quirk = device_property_read_bool(dev, "snps,tx_de_emphasis_quirk"); diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 4fe4287dc934..11975a03316f 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -391,6 +391,7 @@ #define DWC3_GFLADJ_30MHZ_SDBND_SEL BIT(7) #define DWC3_GFLADJ_30MHZ_MASK 0x3f #define DWC3_GFLADJ_REFCLK_FLADJ_MASK GENMASK(21, 8) +#define DWC3_GFLADJ_REFCLK_LPM_SEL BIT(23) #define DWC3_GFLADJ_240MHZDECR GENMASK(30, 24) #define DWC3_GFLADJ_240MHZDECR_PLS1 BIT(31) @@ -1312,6 +1313,7 @@ struct dwc3 { unsigned dis_del_phy_power_chg_quirk:1; unsigned dis_tx_ipgap_linecheck_quirk:1; unsigned parkmode_disable_ss_quirk:1; + unsigned gfladj_refclk_lpm_sel:1; unsigned tx_de_emphasis_quirk:1; unsigned tx_de_emphasis:2; -- 2.35.1