From patchwork Sat Oct 22 07:29:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7717 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1109633wrr; Sat, 22 Oct 2022 01:49:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5FbmslujirsqcNr13i1ZnjPxxenpBYdDJhoiov6gywGhut0UsthOHOvwkA0WBJlJrNPAXf X-Received: by 2002:a17:907:843:b0:73a:5b0e:8352 with SMTP id ww3-20020a170907084300b0073a5b0e8352mr19438224ejb.438.1666428558552; Sat, 22 Oct 2022 01:49:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666428558; cv=none; d=google.com; s=arc-20160816; b=xv7qYwVC5uiyNWYAC0YqvCq3Gqd8piWlK70AjfskQr2Dzbv6U1/CMGLc3LjAK45uop fdgA/zxMHiW0AO7ru8N9TQrxuM0YCUN5DxQU/EHS4UML9W6QFCuVAElhOHoTaaWCjxMA I7xyXzw86XySzfzVUZ27/GwWLpcYRYXvnxAdw40mIR1Xi1PQXf/OpLbjnufFXoVcpEK4 ugiGUSSPXoc7/mw1TWtUGI6nktdlp69GwTZ7dLYNPa069ok1jfUi+PYdY2M4Drn73T9d 0qDBzFKzTJbPdX5U2Bl+i8I+3Ljd96BPFOVex8wivHohXwkx7D2NIj5tUcIJh3l+uLaa E8Dg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6uAvL9wo6C04pVHhRvq1k07p+lJ6SdCYq0HXfZzlwao=; b=o7LYnANEZsHuP/BCuZno0sEs2QrEJwnDEXAPZvC0ZkTny4s/3nVfdBNGCVxa9sUBGQ uL4dTJ7r5pCSooYxxa1WkH+olkrh4tvlkprlPq8PB15tRYfYWtFUegLmWbHyge3Uc5XQ 3GlxTP/fYU7Sj7zzochCyyLyKh4Fz/8vvMMHnbW+GoQS0E4lddS4ksPyG/4asi1DbiTa tK1ZctlMOInaY6TBu4ohJMRkdOypsY5nT5QkvfnPahZob7+T5I5FpO83w2YrwU86xXz5 nNEpECJ6xe6+RSrziAcqkLOt+CqxbTra9STk+qMY4rVtizlLpFFgYWZW42iiQ+ziare4 z+Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1NTbpj3l; 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=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q6-20020a056402518600b0045981993486si23497477edd.227.2022.10.22.01.48.54; Sat, 22 Oct 2022 01:49:18 -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=@linuxfoundation.org header.s=korg header.b=1NTbpj3l; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234711AbiJVIsY (ORCPT + 99 others); Sat, 22 Oct 2022 04:48:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235347AbiJVIpX (ORCPT ); Sat, 22 Oct 2022 04:45:23 -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 4AFCA248D0; Sat, 22 Oct 2022 01:09:24 -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 BDDEBB82E3C; Sat, 22 Oct 2022 08:06:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E8D2C433D6; Sat, 22 Oct 2022 08:06:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425976; bh=zzeTxq+NJr4+UGNGle8Ow5HqL2y9QFZGSXLWwWD6MgE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1NTbpj3l8IzWaC4e3jeqBW/MNbMZpcSKTrplk6kpRFaL80pHGreMFK3w43HiFfwlW 4xWpAcZUV1hfJEuY5GtHqrnrakCkvZBgAFtHI4uSkToOk4fMsVssI13OfUFtPugHgM 7BZcWW4GSyjfU/xl7kEEQL98Ng4jTZkyHrvwmEmg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Li Jun , Alexander Stein , Sasha Levin Subject: [PATCH 5.19 677/717] usb: dwc3: core: add gfladj_refclk_lpm_sel quirk Date: Sat, 22 Oct 2022 09:29:16 +0200 Message-Id: <20221022072528.396117530@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747376992224308393?= X-GMAIL-MSGID: =?utf-8?q?1747376992224308393?= 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 2419ef828f9b..02733b6a9061 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -407,6 +407,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); } @@ -788,7 +792,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); @@ -1490,6 +1494,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 81c486b3941c..725fb17e4a9e 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -390,6 +390,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) @@ -1309,6 +1310,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;