Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp2232114rdf; Mon, 6 Nov 2023 08:13:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IEk+OacTCh8BKDzPYRM9N4OAz2LgfeFeZt6nCMeJOENeOskZJ6ZU7gbgI/6TXmteHbAcFH2 X-Received: by 2002:a05:6a00:3a03:b0:6be:1b39:2f3a with SMTP id fj3-20020a056a003a0300b006be1b392f3amr33051978pfb.14.1699287211192; Mon, 06 Nov 2023 08:13:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699287211; cv=none; d=google.com; s=arc-20160816; b=e1kPLbQJIXQCDuPoJT3W3rtDGuj9z3mtuHikQTXc7igE1tikXj46fCxcou/NN/82NH qqkhWjQR9Cq9VvD4x4vL7pr0NWuRGlIF6m1XqUHEmI9RBbqO5rXmX23eykMBWqAGDyJd NBOFhi0Ug8/1ynKxTgnn25zl4vhTjpKN56UlRT4Mt+rJ1WVxRujpLyHLI4oH9aLmwN1u FC2N+LiGKiY+cFoP0Q0WO5NR2EF6ksFxfkr1z5WfNQ6TmB4S7X6r7FByOqE7gBiU5r+e h569HhCG4sFLjF6EzaQzIhztNxqsFRjPvv/9WP6dgnKcm1Ky/YuSn6OC8CeeZ5O/dUS9 hhdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=HOOTVPwL2cV2cwc5MHWHUdTh328A2J1FGGim5xbaDG8=; fh=NSsRZ+i56tvAa/BLF5kDIVRMPjY0YATdqIkgHJaRCZw=; b=rSX9m/Y8lR8jD8fGvLSq4oAOA83VtabLQv0IDEZzKE0mepssRYeVs011SpuwbLR4jG pG7ZMa28WOsYptBgIAnaefZdlFgcDSaS2NvIHZqSkBZtca+5tZ1kKiIUu3fKTrqgdA5j 0Yk9ffO1i3EzK/33D5JGJtxeM/PWdWDt7Pudbb4ACzzOXync7/fgmRfyztu3VJZwXHtm JSp4tx/obSsGAZOaWVgTkFhGSZ7fHGnjOdwjWLQHP5URWeU2q+avRfQIJU8j8K0/Rip2 Y4FNNkOog1XzkX/2YPd1muugF2b8PlEJTXE8f0+eggQH9hRK4ctQqmMyuULdIZkbP7JG qaXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="DyNL/Qwq"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id d7-20020a633607000000b005bd27920755si7849716pga.534.2023.11.06.08.13.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 08:13:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="DyNL/Qwq"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 7FD0E809AFD5; Mon, 6 Nov 2023 08:13:22 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232039AbjKFQNE (ORCPT + 99 others); Mon, 6 Nov 2023 11:13:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229642AbjKFQND (ORCPT ); Mon, 6 Nov 2023 11:13:03 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F5391BC; Mon, 6 Nov 2023 08:13:01 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6391DC433C7; Mon, 6 Nov 2023 16:12:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1699287180; bh=0H1dc6HEmRBipKy8E5yk0M2LZ1eX6eHdMCL4x9+kr4s=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DyNL/QwqDDRkV01QwKcgdEd2Bu5G+zzEPC9ycp0QdDGw0GJdSh97VsFF/AI7QejaL 0q6UEbtp1zR1QbBAy2qlRk5TKstR6bNPc2moLb9PJ/x3MBSuhGX0F8HmPpUTvrF6Qe hVZkF5APmmAS5dA4jqBb5qRAnNgYXm3k0+BOpbq/Vc1xqEKDIM9brLzTsOs3DpNFLZ HItclxvXMpEbZJ9rlwtHNqnsq7IrEKn/nPQ24uybJbRGxVU6x9aU+sCtf8mzYexSCP 0UiZTwteOPzRRJ720P4+ciJjj+Xe29LV3Kgw1Sd+wp7m7IZgHMixXIDKJgwHZtiuH+ n8Ak/x5PaLfow== Date: Mon, 6 Nov 2023 08:17:01 -0800 From: Bjorn Andersson To: Krishna chaitanya chundru Cc: Andy Gross , 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 Subject: Re: [PATCH 2/2] phy: qcom-qmp-pcie: Add support for keeping refclk always on Message-ID: References: <20231106-refclk_always_on-v1-0-17a7fd8b532b@quicinc.com> <20231106-refclk_always_on-v1-2-17a7fd8b532b@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231106-refclk_always_on-v1-2-17a7fd8b532b@quicinc.com> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email 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 (fry.vger.email [0.0.0.0]); Mon, 06 Nov 2023 08:13:22 -0800 (PST) On Mon, Nov 06, 2023 at 05:22:35PM +0530, 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 Double ------------^^ > states. > > Add a flag which indicates refclk is always supplied to endpoint. > The patch itself look good, the problem description looks good, but if you have an indication that the refclk "is always supplied to the endpoint", then you don't have a problem with refclk and I don't think you need this patch. Something to the tune of "keep refclk always supplied to endpoint" seems to more appropriately describe what this flag is doing. > 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, > + [QPHY_PCS_ENDPOINT_REFCLK_CNTRL] = QPHY_V4_PCS_PCIE_ENDPOINT_REFCLK_CNTRL, > }; > > 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"); Leave this line unwrapped, for readability. Regards, Bjorn > + > ret = phy_pipe_clk_register(qmp, np); > if (ret) > goto err_node_put; > > -- > 2.42.0 >