mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Inochi Amaoto <inochiama@gmail.com>
To: Manivannan Sadhasivam <mani@kernel.org>,
	 Inochi Amaoto <inochiama@gmail.com>
Cc: "Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Chen Wang" <unicorn_wang@outlook.com>,
	"Christophe JAILLET" <christophe.jaillet@wanadoo.fr>,
	"Han Gao" <rabenda.cn@gmail.com>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Yixun Lan" <dlan@gentoo.org>,
	"Longbin Li" <looong.bin@gmail.com>,
	"Han Gao" <gaohan@iscas.ac.cn>
Subject: Re: [PATCH] PCI/sg2042: Avoid L0s and L1 on Sophgo 2042 PCIe Root Ports
Date: Thu, 15 Jan 2026 08:29:18 +0800	[thread overview]
Message-ID: <aWg0uytowyzbOBMX@inochi.infowork> (raw)
In-Reply-To: <rbypcgy3laht64wrjdnpo2xgjcuriy2avmeo5kxlpqdw5mk4lk@lwyjoq5p62iq>

On Tue, Jan 13, 2026 at 08:23:17PM +0530, Manivannan Sadhasivam wrote:
> On Fri, Jan 09, 2026 at 12:07:54PM +0800, Inochi Amaoto 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.
> > 
> > Override the L0s and L1 Support advertised in Link Capabilities in
> > the LINKCTL register of SG2042 Root Ports, so it doesn't try to enable
> > those states.
> > 
> 
> You need to disable L0s and L1 capabilities in LNKCAP. LNKCTL change is
> volatile, since both PCI core and userspace can override it as long as the
> capabilities are supported.
> 
> - Mani
> 

Good to know, I will switch to the LNKCAP.

Regards,
Inochi

> > Fixes: 4e27aca4881a ("riscv: sophgo: dts: add PCIe controllers for SG2042")
> > Signed-off-by: Inochi Amaoto <inochiama@gmail.com>
> > Tested-by: Han Gao <gaohan@iscas.ac.cn>
> > ---
> > Change from original patch:
> > 1. use driver to mask the ASPM advertisement
> > 
> > Separate from the folloing patch
> > - https://lore.kernel.org/all/20251225100530.1301625-1-inochiama@gmail.com
> > ---
> >  drivers/pci/controller/cadence/pcie-sg2042.c | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> > 
> > diff --git a/drivers/pci/controller/cadence/pcie-sg2042.c b/drivers/pci/controller/cadence/pcie-sg2042.c
> > index 0c50c74d03ee..9c42e05d3c46 100644
> > --- a/drivers/pci/controller/cadence/pcie-sg2042.c
> > +++ b/drivers/pci/controller/cadence/pcie-sg2042.c
> > @@ -32,6 +32,15 @@ static struct pci_ops sg2042_pcie_child_ops = {
> >  	.write		= pci_generic_config_write,
> >  };
> > 
> > +static void sg2042_pcie_disable_l0s_l1(struct cdns_pcie *pcie)
> > +{
> > +	u32 val;
> > +
> > +	val = cdns_pcie_rp_readw(pcie, CDNS_PCIE_RP_CAP_OFFSET + PCI_EXP_LNKCTL);
> > +	val &= ~PCI_EXP_LNKCTL_ASPMC;
> > +	cdns_pcie_rp_writew(pcie, CDNS_PCIE_RP_CAP_OFFSET + PCI_EXP_LNKCTL, val);
> > +}
> > +
> >  static int sg2042_pcie_probe(struct platform_device *pdev)
> >  {
> >  	struct device *dev = &pdev->dev;
> > @@ -68,6 +77,8 @@ static int sg2042_pcie_probe(struct platform_device *pdev)
> >  		return ret;
> >  	}
> > 
> > +	sg2042_pcie_disable_l0s_l1(pcie);
> > +
> >  	return 0;
> >  }
> > 
> > --
> > 2.52.0
> > 
> 
> -- 
> மணிவண்ணன் சதாசிவம்

      reply	other threads:[~2026-01-15  0:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-09  4:07 Inochi Amaoto
2026-01-13 14:53 ` Manivannan Sadhasivam
2026-01-15  0:29   ` Inochi Amaoto [this message]

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=aWg0uytowyzbOBMX@inochi.infowork \
    --to=inochiama@gmail.com \
    --cc=bhelgaas@google.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=dlan@gentoo.org \
    --cc=gaohan@iscas.ac.cn \
    --cc=kwilczynski@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=looong.bin@gmail.com \
    --cc=lpieralisi@kernel.org \
    --cc=mani@kernel.org \
    --cc=rabenda.cn@gmail.com \
    --cc=robh@kernel.org \
    --cc=unicorn_wang@outlook.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®