From patchwork Mon Sep 4 07:14:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Rostanski X-Patchwork-Id: 720364 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F4B3C83F2C for ; Mon, 4 Sep 2023 07:14:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352316AbjIDHPB (ORCPT ); Mon, 4 Sep 2023 03:15:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231152AbjIDHPA (ORCPT ); Mon, 4 Sep 2023 03:15:00 -0400 Received: from mail-yb1-xb2f.google.com (mail-yb1-xb2f.google.com [IPv6:2607:f8b0:4864:20::b2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6613399; Mon, 4 Sep 2023 00:14:57 -0700 (PDT) Received: by mail-yb1-xb2f.google.com with SMTP id 3f1490d57ef6-d71dd633f33so951546276.2; Mon, 04 Sep 2023 00:14:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693811696; x=1694416496; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=8iBmqK88tNHvKxoyD/68KKJGPMcQoSmzChGypgNtlxI=; b=V1pfnAAQZ1hbaAfFWGAqWF13gi72E8HRMaFqG7brVCgzfjl/UTsfj5oK/ksl11JxMt bqL7L8lPDVbEKvalOqwmLN04c/pnOwvtsGBcihtckGHw/bXB/L5Yr5E+HELAKgHV3PXx h3IRM8wETr/n4XcXgiAN2Z6Vfg3I+MhTxGDgjhlx2jGQwH7WU6YkNFU5Imq+E0k6+efy Y0YnPGY5sxhdUBO3cUYt+g/nM+O/EEtZaHgusmXIkA3+zZ3vAifoFehUC4HaS4GpxGj9 vusa5s/QRkmvyOfSAAb6LkxOWOi8nyUbQ9jkavuyNqEvZ4v9jwPovwNWtc1d/AOdNTpB dAyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693811696; x=1694416496; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=8iBmqK88tNHvKxoyD/68KKJGPMcQoSmzChGypgNtlxI=; b=g3QAcX5C+Zbx4vh+AtclbVxFRWJwlieQzDXcZy2wKocXI/y+K3g/RukGc1BYUxdhSV H85gdyxLQK3QG0V9VMD+bbR2zZXra9NjMoXThSedJcF3EOAo6DgGsOd4v9bFYDJpsF7X gopc4mbh+tJXiCwNXLwStQpWpUZDiEL/2fsfjMFVDVdEOQ3VU0kkN3maLjMVNCQQzg78 b6uCadC988KIW9j1/ZeVURzNRFQrlGa3G3z9Yq6v95UBmGfgL47zmizsiyqhDJUNLef2 9RHU6MuY6ZGZvb7/ZHdOLR6amkJPDzyfEnXGo1ti5ygqd7HUSz2ekLa6cfzqtP+noamW xTZw== X-Gm-Message-State: AOJu0YyoUzDvH4iadZQSR7bUyAuwHavlG1XGV0397W4bUyxFexbsi/ct hW5CSReEUe4kgfJLuqIHDGy8hRcM41V8oA== X-Google-Smtp-Source: AGHT+IF5Bh45ZgxD2YqR02X1d6V6cMGzgk4tl+8ldECKWKtSpddCNFT7fX/8l5G9un3fuJfT1d/TvA== X-Received: by 2002:a25:cad0:0:b0:d77:c0b9:b182 with SMTP id a199-20020a25cad0000000b00d77c0b9b182mr9360458ybg.46.1693811696532; Mon, 04 Sep 2023 00:14:56 -0700 (PDT) Received: from PLK-D0032.dom2.local ([157.25.98.166]) by smtp.gmail.com with ESMTPSA id 82-20020a251955000000b00d74b144004bsm2207565ybz.12.2023.09.04.00.14.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Sep 2023 00:14:56 -0700 (PDT) From: Tomasz Rostanski X-Google-Original-From: Tomasz Rostanski Cc: stable@vger.kernel.org, Balaji Prakash J , Felipe Balbi , Baruch Siach , Rob Herring , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/5] usb: dwc3: reference clock period configuration Date: Mon, 4 Sep 2023 09:14:22 +0200 Message-ID: <20230904071432.32309-1-tomasz.rostanski@thalesgroup.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Balaji Prakash J Set reference clock period when it differs from dwc3 default hardware set. We could calculate clock period based on reference clock frequency. But this information is not always available. This is the case of PCI bus attached USB host. For that reason we use a custom property. Tested (USB2 only) on IPQ6010 SoC based board with 24 MHz reference clock while hardware default is 19.2 MHz. [ baruch: rewrite commit message; drop GFLADJ code; remove 'quirk-' from property name; mention tested hardware ] Acked-by: Felipe Balbi Signed-off-by: Balaji Prakash J Signed-off-by: Baruch Siach Nacked-by: Rob Herring Link: https://lore.kernel.org/r/9f399bdf1ff752e31ab7497e3d5ce19bbb3ff247.1630389452.git.baruch@tkos.co.il Signed-off-by: Greg Kroah-Hartman --- drivers/usb/dwc3/core.c | 29 +++++++++++++++++++++++++++++ drivers/usb/dwc3/core.h | 6 ++++++ 2 files changed, 35 insertions(+) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 6377b9cf81a5..7908c151b95d 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -343,6 +344,29 @@ static void dwc3_frame_length_adjustment(struct dwc3 *dwc) } } +/** + * dwc3_ref_clk_period - Reference clock period configuration + * Default reference clock period depends on hardware + * configuration. For systems with reference clock that differs + * from the default, this will set clock period in DWC3_GUCTL + * register. + * @dwc: Pointer to our controller context structure + * @ref_clk_per: reference clock period in ns + */ +static void dwc3_ref_clk_period(struct dwc3 *dwc) +{ + u32 reg; + + if (dwc->ref_clk_per == 0) + return; + + reg = dwc3_readl(dwc->regs, DWC3_GUCTL); + reg &= ~DWC3_GUCTL_REFCLKPER_MASK; + reg |= FIELD_PREP(DWC3_GUCTL_REFCLKPER_MASK, dwc->ref_clk_per); + dwc3_writel(dwc->regs, DWC3_GUCTL, reg); +} + + /** * dwc3_free_one_event_buffer - Frees one event buffer * @dwc: Pointer to our controller context structure @@ -1021,6 +1045,9 @@ static int dwc3_core_init(struct dwc3 *dwc) /* Adjust Frame Length */ dwc3_frame_length_adjustment(dwc); + /* Adjust Reference Clock Period */ + dwc3_ref_clk_period(dwc); + dwc3_set_incr_burst_type(dwc); usb_phy_set_suspend(dwc->usb2_phy, 0); @@ -1404,6 +1431,8 @@ static void dwc3_get_properties(struct dwc3 *dwc) &dwc->hsphy_interface); device_property_read_u32(dev, "snps,quirk-frame-length-adjustment", &dwc->fladj); + device_property_read_u32(dev, "snps,ref-clock-period-ns", + &dwc->ref_clk_per); dwc->dis_metastability_quirk = device_property_read_bool(dev, "snps,dis_metastability_quirk"); diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 3dcb5b744f7c..968608bd98e3 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -385,6 +385,10 @@ #define DWC3_GFLADJ_30MHZ_SDBND_SEL BIT(7) #define DWC3_GFLADJ_30MHZ_MASK 0x3f +/* Global User Control Register*/ +#define DWC3_GUCTL_REFCLKPER_MASK 0xffc00000 +#define DWC3_GUCTL_REFCLKPER_SEL 22 + /* Global User Control Register 2 */ #define DWC3_GUCTL2_RST_ACTBITLATER BIT(14) @@ -969,6 +973,7 @@ struct dwc3_scratchpad_array { * @regs: base address for our registers * @regs_size: address space size * @fladj: frame length adjustment + * @ref_clk_per: reference clock period configuration * @irq_gadget: peripheral controller's IRQ number * @otg_irq: IRQ number for OTG IRQs * @current_otg_role: current role of operation while using the OTG block @@ -1153,6 +1158,7 @@ struct dwc3 { struct power_supply *usb_psy; u32 fladj; + u32 ref_clk_per; u32 irq_gadget; u32 otg_irq; u32 current_otg_role; From patchwork Mon Sep 4 07:14:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Rostanski X-Patchwork-Id: 720099 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4469C83F2C for ; Mon, 4 Sep 2023 07:15:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352394AbjIDHPL (ORCPT ); Mon, 4 Sep 2023 03:15:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352387AbjIDHPE (ORCPT ); Mon, 4 Sep 2023 03:15:04 -0400 Received: from mail-yb1-xb36.google.com (mail-yb1-xb36.google.com [IPv6:2607:f8b0:4864:20::b36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93A6312E; Mon, 4 Sep 2023 00:14:59 -0700 (PDT) Received: by mail-yb1-xb36.google.com with SMTP id 3f1490d57ef6-d7eed15ad69so953299276.1; Mon, 04 Sep 2023 00:14:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693811698; x=1694416498; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=asIRh9YewMccFyepghcfx0oKFSEdE7jjQF3+1szicrk=; b=XJL9GAJdw0GeEh+M5mdA3J2Z9y6j3fnDsdM69Uvc6N23fcYUDMRNwVlPcCaVWfe6aU HvRq3GnUcU89qV/Sn4P2bg5BIJ1ttUSKMe12fxziHPYx4nh2HUdJCUzKBVOdXlH1xu/4 BFmZcnIhdU4doOw8jG0lbqSEmHDtrEGc9XjB+9sXer8/2fnuTFkBPpUXn08tso4po9xt S6qhM30FjYCnI6JFgZNRPjkJ5TIFquXJpKeMVdSO7x2uiPtcNh3QEg1VX6Kgowdkeg2T pEe8rt1hWEvhpsfEMoVNuhHZ/ufOW5eJB6h1btqG3cwdw6tl9ApfbFTgL9XUiIWUphDE M7KQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693811698; x=1694416498; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=asIRh9YewMccFyepghcfx0oKFSEdE7jjQF3+1szicrk=; b=NtZKfSvDl5CgEdmN8Y1j394HKMpohyX5tq2aQHQMUngEWJmRS3bTntQuRHGcLdIUDo MjVRwpb3vlbgz0Nzb/ET0mnLQSirEBV3KfjVp4tHbNMVjg1TFVtb06zgwZQAJEPsnNz1 pNp2rQW5S4/G8Ubuc5P1rFm7QJQQ81swAAI394OhPDCCpnVg3Yy89a21XhRszaQOUND7 O3PXurZBpeDSaq0hqPCFnrs4avbvjYDzz9FM+bWdNIhW5CU4KfYNWSp5uLNA6yp49nvi zBOceaxtL3ItVbNeJcsyGLex95XwBILRHyyXNP5QxHk4WclCm+gMyE1GMO1LuwbmFmdL gsOQ== X-Gm-Message-State: AOJu0YyrFc5YYNRAT9NGGbQ6FmpyZKfcQtEll44aWE3dF8WwnWqjob+P s1rZkJi9AjbYHCoHhxAoLUcSnN90sWZpXw== X-Google-Smtp-Source: AGHT+IEHXRYa+aKRNqfEoyrjE5xNeCre35og6i/DAu09DwlkGOEbJYhYwr+bPi6bXOYddUN4g4+NdA== X-Received: by 2002:a25:d481:0:b0:d1a:65c9:d98f with SMTP id m123-20020a25d481000000b00d1a65c9d98fmr10888578ybf.56.1693811698529; Mon, 04 Sep 2023 00:14:58 -0700 (PDT) Received: from PLK-D0032.dom2.local ([157.25.98.166]) by smtp.gmail.com with ESMTPSA id 82-20020a251955000000b00d74b144004bsm2207565ybz.12.2023.09.04.00.14.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Sep 2023 00:14:58 -0700 (PDT) From: Tomasz Rostanski X-Google-Original-From: Tomasz Rostanski Cc: stable@vger.kernel.org, Sean Anderson , Robert Hancock , Greg Kroah-Hartman , Felipe Balbi , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/5] usb: dwc3: Get clocks individually Date: Mon, 4 Sep 2023 09:14:23 +0200 Message-ID: <20230904071432.32309-2-tomasz.rostanski@thalesgroup.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230904071432.32309-1-tomasz.rostanski@thalesgroup.com> References: <20230904071432.32309-1-tomasz.rostanski@thalesgroup.com> MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Sean Anderson Instead of grabbing all clocks in bulk, grab them individually. This will allow us to get the frequency or otherwise deal with discrete clocks. This may break some platforms if they use a clock which doesn't use one of the documented names. Reviewed-by: Robert Hancock Signed-off-by: Sean Anderson Link: https://lore.kernel.org/r/20220127200636.1456175-3-sean.anderson@seco.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/dwc3/core.c | 64 ++++++++++++++++++++++++++++++++--------- drivers/usb/dwc3/core.h | 10 ++++--- 2 files changed, 57 insertions(+), 17 deletions(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 7908c151b95d..9635c915e2f7 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -753,6 +753,38 @@ static int dwc3_phy_setup(struct dwc3 *dwc) return 0; } +static int dwc3_clk_enable(struct dwc3 *dwc) +{ + int ret; + + ret = clk_prepare_enable(dwc->bus_clk); + if (ret) + return ret; + + ret = clk_prepare_enable(dwc->ref_clk); + if (ret) + goto disable_bus_clk; + + ret = clk_prepare_enable(dwc->susp_clk); + if (ret) + goto disable_ref_clk; + + return 0; + +disable_ref_clk: + clk_disable_unprepare(dwc->ref_clk); +disable_bus_clk: + clk_disable_unprepare(dwc->bus_clk); + return ret; +} + +static void dwc3_clk_disable(struct dwc3 *dwc) +{ + clk_disable_unprepare(dwc->susp_clk); + clk_disable_unprepare(dwc->ref_clk); + clk_disable_unprepare(dwc->bus_clk); +} + static void dwc3_core_exit(struct dwc3 *dwc) { dwc3_event_buffers_cleanup(dwc); @@ -767,7 +799,7 @@ static void dwc3_core_exit(struct dwc3 *dwc) phy_exit(dwc->usb2_generic_phy); phy_exit(dwc->usb3_generic_phy); - clk_bulk_disable_unprepare(dwc->num_clks, dwc->clks); + dwc3_clk_disable(dwc); reset_control_assert(dwc->reset); } @@ -1614,25 +1646,31 @@ static int dwc3_probe(struct platform_device *pdev) return PTR_ERR(dwc->reset); if (dev->of_node) { - ret = devm_clk_bulk_get_all(dev, &dwc->clks); - if (ret == -EPROBE_DEFER) - return ret; /* * Clocks are optional, but new DT platforms should support all * clocks as required by the DT-binding. */ - if (ret < 0) - dwc->num_clks = 0; - else - dwc->num_clks = ret; - + dwc->bus_clk = devm_clk_get_optional(dev, "bus_early"); + if (IS_ERR(dwc->bus_clk)) + return dev_err_probe(dev, PTR_ERR(dwc->bus_clk), + "could not get bus clock\n"); + + dwc->ref_clk = devm_clk_get_optional(dev, "ref"); + if (IS_ERR(dwc->ref_clk)) + return dev_err_probe(dev, PTR_ERR(dwc->ref_clk), + "could not get ref clock\n"); + + dwc->susp_clk = devm_clk_get_optional(dev, "suspend"); + if (IS_ERR(dwc->susp_clk)) + return dev_err_probe(dev, PTR_ERR(dwc->susp_clk), + "could not get suspend clock\n"); } ret = reset_control_deassert(dwc->reset); if (ret) return ret; - ret = clk_bulk_prepare_enable(dwc->num_clks, dwc->clks); + ret = dwc3_clk_enable(dwc); if (ret) goto assert_reset; @@ -1723,7 +1761,7 @@ static int dwc3_probe(struct platform_device *pdev) pm_runtime_set_suspended(dev); pm_runtime_put_noidle(dev); disable_clks: - clk_bulk_disable_unprepare(dwc->num_clks, dwc->clks); + dwc3_clk_disable(dwc->num_clks, dwc->clks); assert_reset: reset_control_assert(dwc->reset); @@ -1773,7 +1811,7 @@ static int dwc3_core_init_for_resume(struct dwc3 *dwc) if (ret) return ret; - ret = clk_bulk_prepare_enable(dwc->num_clks, dwc->clks); + ret = dwc3_clk_enable(dwc); if (ret) goto assert_reset; @@ -1784,7 +1822,7 @@ static int dwc3_core_init_for_resume(struct dwc3 *dwc) return 0; disable_clks: - clk_bulk_disable_unprepare(dwc->num_clks, dwc->clks); + dwc3_clk_disable(dwc); assert_reset: reset_control_assert(dwc->reset); diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 968608bd98e3..1e5ef1c512fb 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -967,8 +967,9 @@ struct dwc3_scratchpad_array { * @eps: endpoint array * @gadget: device side representation of the peripheral controller * @gadget_driver: pointer to the gadget driver - * @clks: array of clocks - * @num_clks: number of clocks + * @bus_clk: clock for accessing the registers + * @ref_clk: reference clock + * @susp_clk: clock used when the SS phy is in low power (S3) state * @reset: reset control * @regs: base address for our registers * @regs_size: address space size @@ -1127,8 +1128,9 @@ struct dwc3 { struct usb_gadget *gadget; struct usb_gadget_driver *gadget_driver; - struct clk_bulk_data *clks; - int num_clks; + struct clk *bus_clk; + struct clk *ref_clk; + struct clk *susp_clk; struct reset_control *reset; From patchwork Mon Sep 4 07:14:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Rostanski X-Patchwork-Id: 720363 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CCF7CC71153 for ; Mon, 4 Sep 2023 07:15:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237270AbjIDHPQ (ORCPT ); Mon, 4 Sep 2023 03:15:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352388AbjIDHPE (ORCPT ); Mon, 4 Sep 2023 03:15:04 -0400 Received: from mail-yw1-x1129.google.com (mail-yw1-x1129.google.com [IPv6:2607:f8b0:4864:20::1129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7ACD312A; Mon, 4 Sep 2023 00:15:01 -0700 (PDT) Received: by mail-yw1-x1129.google.com with SMTP id 00721157ae682-590685a3be5so10834837b3.0; Mon, 04 Sep 2023 00:15:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693811700; x=1694416500; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jiAwVwkckA9CkhcVmAh5lppaL9NHm/93zM8EaKeKerA=; b=oIkX9lvpcsnmSkgqnry+BAb7wAvvqJe5dL5iIsvFL4w8jn/xCl3+pZsJXwJnJU0mCT mMNbsOWGoUgR+guTGGKzKMNc0mxVqDNaCYmOrdO4b8n0KJwwGyeoZHslmb07SDq+7JZy 1O/mQslWwJB3RaB6u/22iOK0mPfVeGfOV3hSKGfJdLrDDJriOFuOfQ8PxQzXaEKVUpfg 9mluufyLQgIJBJwfkJxY6bH8gF4Iu9K7LlM9iMR8Drwblar7RnJilfDRGUW5pZUio2ZI NQHjwPg/UMLxn2EFAJwxYLqzRWx/ALJXUyOyWZFXdAd/NvMcW9u+w0uG7wuVVwkwudOq oxqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693811700; x=1694416500; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jiAwVwkckA9CkhcVmAh5lppaL9NHm/93zM8EaKeKerA=; b=hqyeDCGTxdSBq9Ig4itXQICsv7x+DnUzY9UQ2+998qlnz7xk/7inNpjb/Awxtpv6xf GWe3x4vGIgH14hqL9b0nMJha1vFtBd9Sioa7dEBsupnNfHjbsrVqfuD50iSfg5ZZE4Xu ngQVBcikUEMjAr0sQVaqd1hSQc9kOYJ2fzuZ1nsYAQwtl/D/MFuEn13pqHdcks6arlbu I9qixnclKQ3s6wpNEXr8ZiQmi/cefbaCPraiZkccUsojxD+3SRchnHsqFqkMWA6TaVWO /sCon9XIroF9/FP0rtZMpqzZVFWOZhZtcSGZoQhFjeZxFAkjLi2adERrAyONqaKjq5cQ /Kmw== X-Gm-Message-State: AOJu0Yyic70W5h++HH55/voi3AyIqZSAIKihbRE9z4vO4PzeaxRt6J2S 6Ii2KRX/YAMQEwRc2htNUXeqngp6KBJcCQ== X-Google-Smtp-Source: AGHT+IHE3fox3/egkV9aUlWYwF9NTGZpn9AFHAPk6xZIq8ZyUJ+B0xdbDgWulC2UymqhgTT5wCB/nQ== X-Received: by 2002:a25:cf4b:0:b0:d7e:6d10:9792 with SMTP id f72-20020a25cf4b000000b00d7e6d109792mr9323140ybg.5.1693811700606; Mon, 04 Sep 2023 00:15:00 -0700 (PDT) Received: from PLK-D0032.dom2.local ([157.25.98.166]) by smtp.gmail.com with ESMTPSA id 82-20020a251955000000b00d74b144004bsm2207565ybz.12.2023.09.04.00.14.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Sep 2023 00:15:00 -0700 (PDT) From: Tomasz Rostanski X-Google-Original-From: Tomasz Rostanski Cc: stable@vger.kernel.org, Sean Anderson , Robert Hancock , Thinh Nguyen , Greg Kroah-Hartman , Felipe Balbi , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/5] usb: dwc3: Calculate REFCLKPER based on reference clock Date: Mon, 4 Sep 2023 09:14:24 +0200 Message-ID: <20230904071432.32309-3-tomasz.rostanski@thalesgroup.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230904071432.32309-1-tomasz.rostanski@thalesgroup.com> References: <20230904071432.32309-1-tomasz.rostanski@thalesgroup.com> MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Sean Anderson Instead of using a special property to determine the reference clock period, use the rate of the reference clock. When we have a legacy snps,ref-clock-period-ns property and no reference clock, use it instead. Fractional clocks are not currently supported, and will be dealt with in the next commit. Tested-by: Robert Hancock Reviewed-by: Robert Hancock Reviewed-by: Thinh Nguyen Signed-off-by: Sean Anderson Link: https://lore.kernel.org/r/20220127200636.1456175-4-sean.anderson@seco.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/dwc3/core.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 9635c915e2f7..6ee75a72c4d8 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -355,14 +355,24 @@ static void dwc3_frame_length_adjustment(struct dwc3 *dwc) */ static void dwc3_ref_clk_period(struct dwc3 *dwc) { + unsigned long period; + unsigned long rate; u32 reg; - if (dwc->ref_clk_per == 0) + if (dwc->ref_clk) { + rate = clk_get_rate(dwc->ref_clk); + if (!rate) + return; + period = NSEC_PER_SEC / rate; + } else if (dwc->ref_clk_per) { + period = dwc->ref_clk_per; + } else { return; + } reg = dwc3_readl(dwc->regs, DWC3_GUCTL); reg &= ~DWC3_GUCTL_REFCLKPER_MASK; - reg |= FIELD_PREP(DWC3_GUCTL_REFCLKPER_MASK, dwc->ref_clk_per); + reg |= FIELD_PREP(DWC3_GUCTL_REFCLKPER_MASK, period); dwc3_writel(dwc->regs, DWC3_GUCTL, reg); } From patchwork Mon Sep 4 07:14:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Rostanski X-Patchwork-Id: 720098 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89422CA0FE3 for ; Mon, 4 Sep 2023 07:15:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351935AbjIDHPR (ORCPT ); Mon, 4 Sep 2023 03:15:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352392AbjIDHPH (ORCPT ); Mon, 4 Sep 2023 03:15:07 -0400 Received: from mail-yb1-xb36.google.com (mail-yb1-xb36.google.com [IPv6:2607:f8b0:4864:20::b36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A38A1A7; Mon, 4 Sep 2023 00:15:03 -0700 (PDT) Received: by mail-yb1-xb36.google.com with SMTP id 3f1490d57ef6-d7260fae148so951259276.1; Mon, 04 Sep 2023 00:15:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693811703; x=1694416503; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YKIRtA0yq/5fynHAAMm8DiqA6Q5iMhgVgj9GQi1BiRw=; b=YXM3sCvDGBdTmdvTgYK/zh+yROLb0RuLrtDJqBYpz9zeLI3tnGXzJpNPlCPhYTC6J9 t8Ex6TA0dXuz+iWlum6d+7ySSI78pWTQ4pJLnjUk8liuH/94zaaHx3TeEmuigSG8bfs1 2RqnrxZV3UVnFH3XRZ5lgQNpGqdDWrBf1+KpRoJNIaxEFO0pNa3iArsP0lMsT2+1k4F4 23WxvH51+yFQ2m8r/vfJ0OXHBLP73s4c385jXsFNu/486tRz01nqVMpEliiMK12KS6Vh l3wq01qagXGiiJzxTZUyO8fRrGRyJjO+yFXObvEWuk9osqXyHwmV4gMiOro+yMwHVpF4 Zd+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693811703; x=1694416503; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YKIRtA0yq/5fynHAAMm8DiqA6Q5iMhgVgj9GQi1BiRw=; b=Vk7gXKnpzn1xLfCoowKywq01qzWjrJI8JxJh49NtR+DwQ+0GMuglqB1U/Cdvnu+JNW qMrom2jKnCaB1wX4svZ++ucP0OmqZn9poEfYN/hHcsuaoMX1UXRTurJKiwWl5Qe5MN4o ef+2A+x4kj2HEzCVe68P0MfF6rXrwoiQGHfgJJ1D2yjeS7/L9y7pr2tomvgDxgLmYNP9 P99jZHmClera513N6FxVfGi5XPAawRGKiEfFEcj+CtDkcOX481MPYf2y3sV1TwbvMbE1 YepTJWQIGoQFSOuF2r6JkExMDL8N6UMXXvJ3xFyPuspmI5+/nb2CQOOqwqimBpw+Nqjb e1ew== X-Gm-Message-State: AOJu0YykD+UTigQGKnwlXNuakOgYFeiQQ55L51/TJEOGDNHliqrDjigS hSvsvVWj7qocNKIoTWhr+ckvy7hWsae4gg== X-Google-Smtp-Source: AGHT+IGq/uAJfBDQUhKSqxwYxw9HN08zaEmSJF0/2Ib1RNi0uNm0MzGu4QCxO2A3aaTTlLawDb8gMQ== X-Received: by 2002:a25:44c:0:b0:d05:bf5b:918f with SMTP id 73-20020a25044c000000b00d05bf5b918fmr8224878ybe.28.1693811702692; Mon, 04 Sep 2023 00:15:02 -0700 (PDT) Received: from PLK-D0032.dom2.local ([157.25.98.166]) by smtp.gmail.com with ESMTPSA id 82-20020a251955000000b00d74b144004bsm2207565ybz.12.2023.09.04.00.15.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Sep 2023 00:15:02 -0700 (PDT) From: Tomasz Rostanski X-Google-Original-From: Tomasz Rostanski Cc: stable@vger.kernel.org, Sean Anderson , Robert Hancock , Thinh Nguyen , Greg Kroah-Hartman , Felipe Balbi , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/5] usb: dwc3: Program GFLADJ Date: Mon, 4 Sep 2023 09:14:25 +0200 Message-ID: <20230904071432.32309-4-tomasz.rostanski@thalesgroup.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230904071432.32309-1-tomasz.rostanski@thalesgroup.com> References: <20230904071432.32309-1-tomasz.rostanski@thalesgroup.com> MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Sean Anderson GUCTL.REFCLKPER can only account for clock frequencies with integer periods. To address this, program REFCLK_FLADJ with the relative error caused by period truncation. The formula given in the register reference has been rearranged to allow calculation based on rate (instead of period), and to allow for fixed-point arithmetic. Additionally, calculate a value for 240MHZDECR. This configures a simulated 240Mhz clock using a counter with one fractional bit (PLS1). This register is programmed only for versions >= 2.50a, since this is the check also used by commit db2be4e9e30c ("usb: dwc3: Add frame length adjustment quirk"). Tested-by: Robert Hancock Reviewed-by: Robert Hancock Reviewed-by: Thinh Nguyen Signed-off-by: Sean Anderson Link: https://lore.kernel.org/r/20220127200636.1456175-5-sean.anderson@seco.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/dwc3/core.c | 39 ++++++++++++++++++++++++++++++++++++++- drivers/usb/dwc3/core.h | 3 +++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 6ee75a72c4d8..2eb27c60542a 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -356,6 +356,8 @@ static void dwc3_frame_length_adjustment(struct dwc3 *dwc) static void dwc3_ref_clk_period(struct dwc3 *dwc) { unsigned long period; + unsigned long fladj; + unsigned long decr; unsigned long rate; u32 reg; @@ -366,6 +368,7 @@ static void dwc3_ref_clk_period(struct dwc3 *dwc) period = NSEC_PER_SEC / rate; } else if (dwc->ref_clk_per) { period = dwc->ref_clk_per; + rate = NSEC_PER_SEC / period; } else { return; } @@ -374,8 +377,42 @@ static void dwc3_ref_clk_period(struct dwc3 *dwc) reg &= ~DWC3_GUCTL_REFCLKPER_MASK; reg |= FIELD_PREP(DWC3_GUCTL_REFCLKPER_MASK, period); dwc3_writel(dwc->regs, DWC3_GUCTL, reg); -} + if (DWC3_VER_IS_PRIOR(DWC3, 250A)) + return; + + /* + * The calculation below is + * + * 125000 * (NSEC_PER_SEC / (rate * period) - 1) + * + * but rearranged for fixed-point arithmetic. The division must be + * 64-bit because 125000 * NSEC_PER_SEC doesn't fit in 32 bits (and + * neither does rate * period). + * + * Note that rate * period ~= NSEC_PER_SECOND, minus the number of + * nanoseconds of error caused by the truncation which happened during + * the division when calculating rate or period (whichever one was + * derived from the other). We first calculate the relative error, then + * scale it to units of 8 ppm. + */ + fladj = div64_u64(125000ULL * NSEC_PER_SEC, (u64)rate * period); + fladj -= 125000; + + /* + * The documented 240MHz constant is scaled by 2 to get PLS1 as well. + */ + decr = 480000000 / rate; + + reg = dwc3_readl(dwc->regs, DWC3_GFLADJ); + reg &= ~DWC3_GFLADJ_REFCLK_FLADJ_MASK + & ~DWC3_GFLADJ_240MHZDECR + & ~DWC3_GFLADJ_240MHZDECR_PLS1; + reg |= FIELD_PREP(DWC3_GFLADJ_REFCLK_FLADJ_MASK, fladj) + | FIELD_PREP(DWC3_GFLADJ_240MHZDECR, decr >> 1) + | FIELD_PREP(DWC3_GFLADJ_240MHZDECR_PLS1, decr & 1); + dwc3_writel(dwc->regs, DWC3_GFLADJ, reg); +} /** * dwc3_free_one_event_buffer - Frees one event buffer diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 1e5ef1c512fb..9c421de4d01d 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -384,6 +384,9 @@ /* Global Frame Length Adjustment Register */ #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_240MHZDECR GENMASK(30, 24) +#define DWC3_GFLADJ_240MHZDECR_PLS1 BIT(31) /* Global User Control Register*/ #define DWC3_GUCTL_REFCLKPER_MASK 0xffc00000 From patchwork Mon Sep 4 07:14:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Rostanski X-Patchwork-Id: 720362 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0400CA0FF3 for ; Mon, 4 Sep 2023 07:15:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232359AbjIDHPR (ORCPT ); Mon, 4 Sep 2023 03:15:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239220AbjIDHPP (ORCPT ); Mon, 4 Sep 2023 03:15:15 -0400 Received: from mail-yb1-xb29.google.com (mail-yb1-xb29.google.com [IPv6:2607:f8b0:4864:20::b29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8913A184; Mon, 4 Sep 2023 00:15:05 -0700 (PDT) Received: by mail-yb1-xb29.google.com with SMTP id 3f1490d57ef6-d7260fae148so951288276.1; Mon, 04 Sep 2023 00:15:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693811705; x=1694416505; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=a2yK8aKcSPuezmSKFjfJ2lLtNKKiKqgsopGdmukPsnM=; b=UoEx8oztV24zvGOspordC+g5r5fGvQz/9tBxiH+9aHRUoDdgTBMjOyaRC7yBTwxLxi bhJIzJRzaFlUZUsSPJahYZOcc1EWaseb8DkvGtaIcOnMkcfjh9c88yGY17PEpinfCq+f o1Hsqlc93/bctIv6E9rbdxY/InfMS2BoHguE0Fb8kWAnWD4WzMCSGF9Yx1+I6qZhr87S p05pTqWOG/yxIeg/trwXvn11YdPjWM4XSv3DYkykms5uNKr4EBDvQNwUQGommGnLu4eR 21v/XV0M3AsGAPJhIc9rcRFvsE8IcDiC7GqL+IvcUuyo+7HCtRs7iaeAGjzWATcQNE2D T8ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693811705; x=1694416505; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=a2yK8aKcSPuezmSKFjfJ2lLtNKKiKqgsopGdmukPsnM=; b=aBzI0eRRXcTwv4dz+sBjbl7K0w2Gs5ndadOf2wCi/22F4UNWM8qVj6ZCYDN6nJ0e+e +VrcA4wQDqW0KfAaOI86ZDqH/+1PsHnbwSRua+yTePKJJHja1J2k6n5BDO2j8UKSCY9G 79uasGlc7p5sNUsLd6U05Dv3GntKix+mJGn+kZL9YryK3soScf8yACxhk2uswNP/tFRx bcGIsx17rKJKtcLx82YOXjVdG7wUT5VqQUVjJIAVLAoViGIoyq5995jjPMFNnSSoTwiZ f7vguQq/RsuAcFK3DDNGD4NGUPKYDj3CHAN2GR+afH2r2Ymz4PLDjeH+5oXPXbiI17x2 mpFA== X-Gm-Message-State: AOJu0YziX4/bKIU168eZ1ktxohmIGbMp0SDq+LWgIA3G0krwlRe3HHSS K3xt2KdedySq7bOF5jaSCCG9xvmRwjFdGQ== X-Google-Smtp-Source: AGHT+IE1csCUdUlF4QuakGrwXb6Ni6oFHfIWmga4YqhhvWO3y8XR5ozcKXvJOUtHcSHJjQVjCGZndg== X-Received: by 2002:a25:d0a:0:b0:d78:f32:5849 with SMTP id 10-20020a250d0a000000b00d780f325849mr8997460ybn.24.1693811704753; Mon, 04 Sep 2023 00:15:04 -0700 (PDT) Received: from PLK-D0032.dom2.local ([157.25.98.166]) by smtp.gmail.com with ESMTPSA id 82-20020a251955000000b00d74b144004bsm2207565ybz.12.2023.09.04.00.15.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Sep 2023 00:15:04 -0700 (PDT) From: Tomasz Rostanski X-Google-Original-From: Tomasz Rostanski Cc: stable@vger.kernel.org, Alexander Stein , Li Jun , Greg Kroah-Hartman , Felipe Balbi , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/5] usb: dwc3: core: add gfladj_refclk_lpm_sel quirk Date: Mon, 4 Sep 2023 09:14:26 +0200 Message-ID: <20230904071432.32309-5-tomasz.rostanski@thalesgroup.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230904071432.32309-1-tomasz.rostanski@thalesgroup.com> References: <20230904071432.32309-1-tomasz.rostanski@thalesgroup.com> MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Alexander Stein 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 --- 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 2eb27c60542a..c065d165bedd 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -411,6 +411,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); } @@ -792,7 +796,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); @@ -1501,6 +1505,8 @@ static void dwc3_get_properties(struct dwc3 *dwc) "snps,resume-hs-terminations"); 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 9c421de4d01d..d4004bab4cc5 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -385,6 +385,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) @@ -1299,6 +1300,7 @@ struct dwc3 { unsigned dis_tx_ipgap_linecheck_quirk:1; unsigned resume_hs_terminations:1; unsigned parkmode_disable_ss_quirk:1; + unsigned gfladj_refclk_lpm_sel:1; unsigned tx_de_emphasis_quirk:1; unsigned tx_de_emphasis:2;