From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2A9B7CCF9F8 for ; Wed, 12 Nov 2025 08:36:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VjJ7dxhPC/rhdiS/CNzlUVK4pGXkE71jovjcZTZTmLA=; b=irU43yy8NVrAbA ulBReE0oavzhAFhCO9xLyYqiaYx+lsctb6UmSxCqkTXbRYbA3t0QMLFEKxRwQUtFrClpPg+Kuttpr F1dvYvnYeCp2Al+7XW8E/cN+W3sL3YFwq6/7ZWXD2BP1uQD1BeV/HsINOj6lzd5LTLMvAzSpX+lGx 4Ri6sUMSa4jF+Xe4m/kXoDD66H3aSR3TeUpg5UW0T0Nphs8gVngbSpmuf1R8iGz9oSX+TBlfHq0Gq Bz7qtIzJ7w/fu52Yp9DBmRi8fQLatuXicJx4O64m5FhlQOGF5IDpyks46U9ns0lx9bpVB3BVLoNrK mA3M2NbdlLQ1/a0ORFbA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vJ6Kt-00000008MqM-2IR8; Wed, 12 Nov 2025 08:36:15 +0000 Received: from tor.source.kernel.org ([2600:3c04:e001:324:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vJ6Kr-00000008Mpn-0Y76; Wed, 12 Nov 2025 08:36:13 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 747E760213; Wed, 12 Nov 2025 08:36:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26358C116B1; Wed, 12 Nov 2025 08:36:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1762936572; bh=fWtxxuQo/pcCl3z56fIUSvnvcb5WQwnMx9dhO06VUw0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=nnqY7nbCbUmaOh+u9j3N/fhjowP7Af290Yh4h7g/iJasPzzW9wnJuuAn9w1M/z+Bd sYxDOViilw63B5geo3xE/HzVDkvfOri9XNmUY075vAqEinUKm1KkowCwyoI0GU4f63 ZTyD04h6EYdhMHONmuEyl7wlQDmDAf/FhkSZd4aV4WDLdcpMCX633ibmPGrGQpZhnM EYtMww30pLG73tWC0Ch8hUtHIgZsyaYnhsgcKEXCiJ2uHGhfNKaHDJfPjIrjYMaAa4 zGhgVT2J1KkOQylmtrQaEp59caFa5dbFva2kyOQroE0HzpaabwBkJQmTLqAMQ1vAf+ q428iGjHOdOkw== Date: Wed, 12 Nov 2025 09:36:03 +0100 From: Niklas Cassel To: Bjorn Helgaas Cc: Shawn Lin , Manivannan Sadhasivam , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , Heiko Stuebner , Kever Yang , Simon Xue , Damien Le Moal , Dragan Simic , FUKAUMI Naoki , Diederik de Haas , Richard Zhu , Frank Li , Lucas Stach , Shawn Guo , Sascha Hauer , Fabio Estevam , Conor Dooley , Krzysztof Kozlowski , Thierry Reding , Jonathan Hunter , Hans Zhang , linux-tegra@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, kernel@pengutronix.de, Bjorn Helgaas Subject: Re: [PATCH 3/4] PCI: dw-rockchip: Configure L1sub support Message-ID: References: <20251111221621.2208606-1-helgaas@kernel.org> <20251111221621.2208606-4-helgaas@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20251111221621.2208606-4-helgaas@kernel.org> X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org On Tue, Nov 11, 2025 at 04:16:10PM -0600, Bjorn Helgaas wrote: > From: Shawn Lin > > L1 PM Substates for RC mode require support in the dw-rockchip driver > including proper handling of the CLKREQ# sideband signal. It is mostly > handled by hardware, but software still needs to set the clkreq fields > in the PCIE_CLIENT_POWER_CON register to match the hardware implementation. > > For more details, see section '18.6.6.4 L1 Substate' in the RK3658 TRM 1.1 > Part 2, or section '11.6.6.4 L1 Substate' in the RK3588 TRM 1.0 Part2. > > Meanwhile, for the EP mode, we haven't prepared enough to actually support > L1 PM Substates yet. So disable it now until proper support is added later. Considering that patch 1/4 is disabling L1ss for EP mode, I think we can remove this last sentence. > > Signed-off-by: Shawn Lin > [bhelgaas: set pci->l1ss_support so DWC core preserves L1SS Capability bits; > drop corresponding code here] > Signed-off-by: Bjorn Helgaas > Link: https://patch.msgid.link/1761187883-150120-1-git-send-email-shawn.lin@rock-chips.com > --- > drivers/pci/controller/dwc/pcie-dw-rockchip.c | 38 +++++++++++++++++++ > 1 file changed, 38 insertions(+) > > diff --git a/drivers/pci/controller/dwc/pcie-dw-rockchip.c b/drivers/pci/controller/dwc/pcie-dw-rockchip.c > index 3e2752c7dd09..62a095752833 100644 > --- a/drivers/pci/controller/dwc/pcie-dw-rockchip.c > +++ b/drivers/pci/controller/dwc/pcie-dw-rockchip.c > @@ -62,6 +62,12 @@ > /* Interrupt Mask Register Related to Miscellaneous Operation */ > #define PCIE_CLIENT_INTR_MASK_MISC 0x24 > > +/* Power Management Control Register */ > +#define PCIE_CLIENT_POWER_CON 0x2c > +#define PCIE_CLKREQ_READY FIELD_PREP_WM16(BIT(0), 1) > +#define PCIE_CLKREQ_NOT_READY FIELD_PREP_WM16(BIT(0), 0) > +#define PCIE_CLKREQ_PULL_DOWN FIELD_PREP_WM16(GENMASK(13, 12), 1) > + > /* Hot Reset Control Register */ > #define PCIE_CLIENT_HOT_RESET_CTRL 0x180 > #define PCIE_LTSSM_APP_DLY2_EN BIT(1) > @@ -85,6 +91,7 @@ struct rockchip_pcie { > struct regulator *vpcie3v3; > struct irq_domain *irq_domain; > const struct rockchip_pcie_of_data *data; > + bool supports_clkreq; > }; > > struct rockchip_pcie_of_data { > @@ -200,6 +207,32 @@ static bool rockchip_pcie_link_up(struct dw_pcie *pci) > return FIELD_GET(PCIE_LINKUP_MASK, val) == PCIE_LINKUP; > } > > +/* > + * See e.g. section '11.6.6.4 L1 Substate' in the RK3588 TRM V1.0 for the steps > + * needed to support L1 substates. Currently, just enable L1 substates for RC > + * mode if CLKREQ# is properly connected and supports-clkreq is present in DT. > + * For EP mode, there are more things should be done to actually save power in > + * L1 substates, so disable L1 substates until there is proper support. > + */ > +static void rockchip_pcie_configure_l1sub(struct dw_pcie *pci) > +{ > + struct rockchip_pcie *rockchip = to_rockchip_pcie(pci); > + > + /* Enable L1 substates if CLKREQ# is properly connected */ > + if (rockchip->supports_clkreq && > + rockchip->data->mode == DW_PCIE_RC_TYPE ) { Superfluous space before '(' Considering that DWC core clears L1ss cap, and according to Shawn, there is more code needed to support L1ss in EP mode, perhaps simply drop the function call from rockchip_pcie_ep_init(), then we can drop 'rockchip->data->mode == DW_PCIE_RC_TYPE' from the above if statement. > + rockchip_pcie_writel_apb(rockchip, PCIE_CLKREQ_READY, > + PCIE_CLIENT_POWER_CON); > + pci->l1ss_support = true; > + return; > + } > + > + /* Otherwise, pull down CLKREQ# */ > + rockchip_pcie_writel_apb(rockchip, > + PCIE_CLKREQ_PULL_DOWN | PCIE_CLKREQ_NOT_READY, > + PCIE_CLIENT_POWER_CON); > +} > + > static void rockchip_pcie_enable_l0s(struct dw_pcie *pci) > { > u32 cap, lnkcap; > @@ -264,6 +297,7 @@ static int rockchip_pcie_host_init(struct dw_pcie_rp *pp) > irq_set_chained_handler_and_data(irq, rockchip_pcie_intx_handler, > rockchip); > > + rockchip_pcie_configure_l1sub(pci); > rockchip_pcie_enable_l0s(pci); > > return 0; > @@ -301,6 +335,7 @@ static void rockchip_pcie_ep_init(struct dw_pcie_ep *ep) > struct dw_pcie *pci = to_dw_pcie_from_ep(ep); > enum pci_barno bar; > > + rockchip_pcie_configure_l1sub(pci); Considering that DWC core clears L1ss cap, and according to Shawn, there is more code needed to support L1ss in EP mode, perhaps simply drop this function call? > rockchip_pcie_enable_l0s(pci); > rockchip_pcie_ep_hide_broken_ats_cap_rk3588(ep); > > @@ -412,6 +447,9 @@ static int rockchip_pcie_resource_get(struct platform_device *pdev, > return dev_err_probe(&pdev->dev, PTR_ERR(rockchip->rst), > "failed to get reset lines\n"); > > + rockchip->supports_clkreq = of_property_read_bool(pdev->dev.of_node, > + "supports-clkreq"); > + > return 0; > } > > -- > 2.43.0 > _______________________________________________ Linux-rockchip mailing list Linux-rockchip@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip