Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp2074818rdf; Mon, 6 Nov 2023 04:14:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IEXA1zszKpXGuJMBXvqxF3htRPXx/WhIP5/y+PZnMDrnkjfoa7A6/Wchr71JuvcdWX+/d08 X-Received: by 2002:a05:6a00:2e28:b0:68e:41e9:10be with SMTP id fc40-20020a056a002e2800b0068e41e910bemr27691863pfb.20.1699272844988; Mon, 06 Nov 2023 04:14:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699272844; cv=none; d=google.com; s=arc-20160816; b=z1yuzHdNrV79e6nWeS9XsR4jAHcqneXwjBoeDWahgIT0gvxGYAdQYjduF//eYUSM0K sW7AZFFnS/SvOSDPQRZg2aLykAj+FD2NbUsgxmz48kPqRaueNCkQfiCtZXamDzw4JRUV IlhvWC2QFZbuyTkGrTXPnoG5KxRCE88qRBT5YtFJLXmdYLo0I1QYAvF5teQPg+NHNWFc 91eOCuY1+HLdjEls0BVg0Z60J1VOteJ04hz9QplGI2l7wS0Sx8JJYnvM5cQF32I1el2G GtUW/v8d4vZXIwBg+MmquTkGk5TvaPYJXmWFwVrPoDie13VIIiQKGg6BnDKfU1ZEs6n6 MVbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=F3Zbr/7wNikMm8fVZo9O7MEbsokzhS7zeLCZ4OYDYRk=; fh=wegDJNLuni9v+SEPB1CXmyiiSgdZ4KZ5bG2jgs+A4MU=; b=mGDeNE7qDKvkGle8W4wZ3xL4FU1zGUNAwLHQbpOvYLxd5RJHWjXN4vWr/lTObdopko DDbuzlaRPUYLkr9CNvhrhqd+euSsduyVg2DTyTIsqzcuN8xa+rWxlAPnr+J9z6Nuc8q2 lgQc+il0a0LAAH/Q3JPsnn7MLNcH1G3bfDPYztdk4iVceEpn4YwZLjxU0HYcQiUEUjCk y2GrMllzlvopSAa5ydoBJ9aHu72Fps3d6BDQgXJd7cb08jJmZ1BjWmyagvwvE3JVvTiK wWBhl5DB7wTWlPk4HZFfURVBhpKtgiIrMI84Km34pixMgY5W0BPqSlNPFci8eyB5tnYO U3Dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sXuIBiWd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id eg12-20020a056a00800c00b006b771ad822dsi8450579pfb.286.2023.11.06.04.14.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 04:14:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sXuIBiWd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id DFB26802A6DB; Mon, 6 Nov 2023 04:14:02 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231671AbjKFMOB (ORCPT + 99 others); Mon, 6 Nov 2023 07:14:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231666AbjKFMN7 (ORCPT ); Mon, 6 Nov 2023 07:13:59 -0500 Received: from mail-yw1-x1131.google.com (mail-yw1-x1131.google.com [IPv6:2607:f8b0:4864:20::1131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35104B7 for ; Mon, 6 Nov 2023 04:13:56 -0800 (PST) Received: by mail-yw1-x1131.google.com with SMTP id 00721157ae682-5a81ab75f21so52419937b3.2 for ; Mon, 06 Nov 2023 04:13:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699272835; x=1699877635; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=F3Zbr/7wNikMm8fVZo9O7MEbsokzhS7zeLCZ4OYDYRk=; b=sXuIBiWdu7zRVYBlXAqLybne0wmgPMOlKZ/Suw4zefMLMeCW7Brt3OkfLqXnCYUe1v IMOVcy9T8Wy7gwryLiDLI9P6hciT3i+RpJTHHpIyEPQFfKdJ8X/kCV58WlcgTFBQtktc 8vz0VtnRlQSM29nlyCm7rOVD4+2j5QTwumSXSM0tvKsvQQGUz6FpdJ6yj6PxC+bNoVR2 npPkmU/gDXbCvnvh7FUaPpRgiS91m5SBdEsUzU11cYrLHJeTwVoKuhD4Orksxn4moddq ksXej7euDWikgrLIva6iVaz1kHvpupaIVj+0TOY88Lv0eU5pBgxfBvAGCIuSYa9FPJFn 4Geg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699272835; x=1699877635; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=F3Zbr/7wNikMm8fVZo9O7MEbsokzhS7zeLCZ4OYDYRk=; b=dcTIBKGpseD7Hc40r9/S92fd2S/fbGFL0VRB1bh6P2BRk34+NBnt5tOIrYiTjPGh2b eZjtJK3ffeSqEoXDK+J036m4MK/j0ttSLfBBIlbngnngkV3cLExqE2scTPkSNMA+xT8L Gqv6gh7+PU+cXwp0fv0T+wCTGwj9XRHWGG9zoXjylanc+OY5F5WRa5TRYeIIEhnjqDxN cBvOyHUiP57Wk+/COfD/k9267w6yzNTPg5Tv+C++nKyWtwNSy+Ko/SZMDqL81lfoIrlB EUqug3QGnDzo/Wgw7jmwVDSKhJsagEPNbiQevKhoi4pBv1g9oWUcbLvg9xniYuBXaR/B IL0Q== X-Gm-Message-State: AOJu0YwQvkiuXCOBlzSnqi0jLzfMPtlT8AFklea1nrvJJ/ry0SvRwp73 6sKC5X8myQX/i6++Blzcx688sfsldTCDCmUYelQSAw== X-Received: by 2002:a05:690c:6:b0:5a1:d352:9fe1 with SMTP id bc6-20020a05690c000600b005a1d3529fe1mr12063192ywb.42.1699272835361; Mon, 06 Nov 2023 04:13:55 -0800 (PST) MIME-Version: 1.0 References: <20231106-refclk_always_on-v1-0-17a7fd8b532b@quicinc.com> <20231106-refclk_always_on-v1-2-17a7fd8b532b@quicinc.com> In-Reply-To: <20231106-refclk_always_on-v1-2-17a7fd8b532b@quicinc.com> From: Dmitry Baryshkov Date: Mon, 6 Nov 2023 14:13:43 +0200 Message-ID: Subject: Re: [PATCH 2/2] phy: qcom-qmp-pcie: Add support for keeping refclk always on To: Krishna chaitanya chundru Cc: Andy Gross , Bjorn Andersson , Konrad Dybcio , Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, quic_vbadigan@quicinc.com, quic_ramkri@quicinc.com, quic_nitegupt@quicinc.com, quic_skananth@quicinc.com, quic_vpernami@quicinc.com, quic_parass@quicinc.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 06 Nov 2023 04:14:03 -0800 (PST) On Mon, 6 Nov 2023 at 13:53, Krishna chaitanya chundru wrote: > > In PCIe low power states like L1.1 or L1.2 the phy will stop > supplying refclk to endpoint. If endpoint asserts clkreq to bring > back link L0, then RC needs to provide refclk to endpoint. > > If there is some issues in platform with clkreq signal propagation > to host and due to that host will not send refclk which results PCIe link > down. For those platforms phy needs to provide refclk even in low power > states. > > Add a flag which indicates refclk is always supplied to endpoint. > > Signed-off-by: Krishna chaitanya chundru > --- > drivers/phy/qualcomm/phy-qcom-qmp-pcie.c | 21 +++++++++++++++++---- > 1 file changed, 17 insertions(+), 4 deletions(-) > > diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c > index a63ca7424974..d7e377a7d96e 100644 > --- a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c > +++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c > @@ -43,6 +43,8 @@ > /* QPHY_PCS_STATUS bit */ > #define PHYSTATUS BIT(6) > #define PHYSTATUS_4_20 BIT(7) > +/* PCS_PCIE_ENDPOINT_REFCLK_CNTRL */ > +#define EPCLK_ALWAYS_ON_EN BIT(6) > > #define PHY_INIT_COMPLETE_TIMEOUT 10000 > > @@ -77,6 +79,7 @@ enum qphy_reg_layout { > QPHY_START_CTRL, > QPHY_PCS_STATUS, > QPHY_PCS_POWER_DOWN_CONTROL, > + QPHY_PCS_ENDPOINT_REFCLK_CNTRL, > /* Keep last to ensure regs_layout arrays are properly initialized */ > QPHY_LAYOUT_SIZE > }; > @@ -103,10 +106,11 @@ static const unsigned int sdm845_qhp_pciephy_regs_layout[QPHY_LAYOUT_SIZE] = { > }; > > static const unsigned int pciephy_v4_regs_layout[QPHY_LAYOUT_SIZE] = { > - [QPHY_SW_RESET] = QPHY_V4_PCS_SW_RESET, > - [QPHY_START_CTRL] = QPHY_V4_PCS_START_CONTROL, > - [QPHY_PCS_STATUS] = QPHY_V4_PCS_PCS_STATUS1, > - [QPHY_PCS_POWER_DOWN_CONTROL] = QPHY_V4_PCS_POWER_DOWN_CONTROL, > + [QPHY_SW_RESET] = QPHY_V4_PCS_SW_RESET, > + [QPHY_START_CTRL] = QPHY_V4_PCS_START_CONTROL, > + [QPHY_PCS_STATUS] = QPHY_V4_PCS_PCS_STATUS1, > + [QPHY_PCS_POWER_DOWN_CONTROL] = QPHY_V4_PCS_POWER_DOWN_CONTROL, No unnecessary whitespace changes, please. > + [QPHY_PCS_ENDPOINT_REFCLK_CNTRL] = QPHY_V4_PCS_PCIE_ENDPOINT_REFCLK_CNTRL, Any other platform having this register? > }; > > static const unsigned int pciephy_v5_regs_layout[QPHY_LAYOUT_SIZE] = { > @@ -2244,6 +2248,8 @@ struct qmp_pcie { > struct phy *phy; > int mode; > > + bool refclk_always_on; > + > struct clk_fixed_rate pipe_clk_fixed; > }; > > @@ -3159,6 +3165,10 @@ static void qmp_pcie_init_registers(struct qmp_pcie *qmp, const struct qmp_phy_c > qmp_pcie_configure(pcs, tbls->pcs, tbls->pcs_num); > qmp_pcie_configure(pcs_misc, tbls->pcs_misc, tbls->pcs_misc_num); > > + if (qmp->refclk_always_on && cfg->regs[QPHY_PCS_ENDPOINT_REFCLK_CNTRL]) > + qphy_setbits(pcs_misc, cfg->regs[QPHY_PCS_ENDPOINT_REFCLK_CNTRL], > + EPCLK_ALWAYS_ON_EN); > + > if (cfg->lanes >= 4 && qmp->tcsr_4ln_config) { > qmp_pcie_configure(serdes, cfg->serdes_4ln_tbl, cfg->serdes_4ln_num); > qmp_pcie_init_port_b(qmp, tbls); > @@ -3681,6 +3691,9 @@ static int qmp_pcie_probe(struct platform_device *pdev) > if (ret) > goto err_node_put; > > + qmp->refclk_always_on = of_property_read_bool(dev->of_node, > + "qcom,refclk-always-on"); Error out if !cfg->regs[QPHY_PCS_ENDPOINT_REFCLK_CNTRL]). Otherwise your DT value can be silently ignored. > + > ret = phy_pipe_clk_register(qmp, np); > if (ret) > goto err_node_put; > > -- > 2.42.0 > -- With best wishes Dmitry