From: Chen Wang <unicorn_wang@outlook.com>
To: "Yao Zi" <me@ziyao.cc>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
"Manivannan Sadhasivam" <mani@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Siddharth Vadapalli" <s-vadapalli@ti.com>,
"Hans Zhang" <18255117159@163.com>,
"Kishon Vijay Abraham I" <kishon@kernel.org>,
"Manikandan K Pillai" <mpillai@cadence.com>,
"Christophe JAILLET" <christophe.jaillet@wanadoo.fr>,
"Inochi Amaoto" <inochiama@gmail.com>,
"Han Gao" <rabenda.cn@gmail.com>
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] PCI: sg2042: Avoid L0s and L1 on Sophgo 2042 PCIe Root Ports
Date: Tue, 3 Mar 2026 14:37:17 +0800 [thread overview]
Message-ID: <MA5PR01MB125002DDDB79A0FE9689E9DD5FE7FA@MA5PR01MB12500.INDPRD01.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <20260227181925.52475-3-me@ziyao.cc>
On 2/28/2026 2:19 AM, Yao Zi wrote:
> Since commit f3ac2ff14834 ("PCI/ASPM: Enable all ClockPM and ASPM
> states for devicetree platforms") force enable ASPM on all device tree
> platform, the SG2042 root port breaks as it advertises L0s and L1
> capabilities without supporting it.
>
> Provide a platform-specific initialization hook to override the L0s and
> L1 support advertised in LNKCAP register of SG2042 Root Ports, so it
> doesn't try to enable those states.
>
> Fixes: 4e27aca4881a ("riscv: sophgo: dts: add PCIe controllers for SG2042")
> Co-authored-by: Inochi Amaoto <inochiama@gmail.com>
> Signed-off-by: Inochi Amaoto <inochiama@gmail.com>
> Signed-off-by: Yao Zi <me@ziyao.cc>
> ---
> drivers/pci/controller/cadence/pcie-sg2042.c | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/drivers/pci/controller/cadence/pcie-sg2042.c b/drivers/pci/controller/cadence/pcie-sg2042.c
> index 0c50c74d03ee..3142f82bd393 100644
> --- a/drivers/pci/controller/cadence/pcie-sg2042.c
> +++ b/drivers/pci/controller/cadence/pcie-sg2042.c
> @@ -32,6 +32,25 @@ static struct pci_ops sg2042_pcie_child_ops = {
> .write = pci_generic_config_write,
> };
>
> +static int sg2042_pcie_disable_l0s_l1(struct cdns_pcie_rc *rc)
> +{
> + struct cdns_pcie *pcie = &rc->pcie;
> + u32 pcie_lnkcap_off;
> + u32 lnkcap;
> +
> + pcie_lnkcap_off = CDNS_PCIE_RP_CAP_OFFSET + PCI_EXP_LNKCAP;
> +
> + lnkcap = cdns_pcie_rp_readw(pcie, pcie_lnkcap_off);
> + lnkcap &= ~PCI_EXP_LNKCAP_ASPMS;
> + cdns_pcie_rp_writew(pcie, pcie_lnkcap_off, lnkcap);
> +
> + return 0;
> +}
> +
> +static const struct cdns_pcie_rc_ops sg2042_pcie_rc_ops = {
> + .init = sg2042_pcie_disable_l0s_l1,
> +};
> +
> static int sg2042_pcie_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> @@ -48,6 +67,7 @@ static int sg2042_pcie_probe(struct platform_device *pdev)
> bridge->child_ops = &sg2042_pcie_child_ops;
>
> rc = pci_host_bridge_priv(bridge);
> + rc->ops = &sg2042_pcie_rc_ops;
> pcie = &rc->pcie;
> pcie->dev = dev;
>
LGTM.
Reviewd-by: Chen Wang <unicorn_wang@outlook.com>
Tested-by: Chen Wang <unicorn_wang@outlook.com>
Thanks,
Chen
next prev parent reply other threads:[~2026-03-03 6:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-27 18:19 [PATCH v2 0/2] PCI/sg2042: " Yao Zi
2026-02-27 18:19 ` [PATCH v2 1/2] PCI: cadence: Support platform-specific hooks for RC init/deinit Yao Zi
2026-03-03 1:08 ` Inochi Amaoto
2026-03-03 6:34 ` Chen Wang
2026-02-27 18:19 ` [PATCH v2 2/2] PCI: sg2042: Avoid L0s and L1 on Sophgo 2042 PCIe Root Ports Yao Zi
2026-02-27 18:24 ` Yao Zi
2026-03-03 1:09 ` Inochi Amaoto
2026-03-03 6:37 ` Chen Wang [this message]
2026-03-26 16:45 ` Manivannan Sadhasivam
2026-03-27 8:19 ` Yao Zi
2026-04-02 12:26 ` Chen Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=MA5PR01MB125002DDDB79A0FE9689E9DD5FE7FA@MA5PR01MB12500.INDPRD01.PROD.OUTLOOK.COM \
--to=unicorn_wang@outlook.com \
--cc=18255117159@163.com \
--cc=bhelgaas@google.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=inochiama@gmail.com \
--cc=kishon@kernel.org \
--cc=kwilczynski@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=mani@kernel.org \
--cc=me@ziyao.cc \
--cc=mpillai@cadence.com \
--cc=rabenda.cn@gmail.com \
--cc=robh@kernel.org \
--cc=s-vadapalli@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®