The root port advertises ASPM L1 support in its Link Capabilities, so
software that configures ASPM from what the port reports, such as an
EFI application or an operating system that does not reinitialise the
controller, may put the link into L1.

Linux's pcie-spacemit-k1 driver clears PCI_EXP_LNKCAP_ASPM_L1 at init,
as a workaround for errors reported on some NVMe drives. Do the same
before link training starts, so the port is set up as Linux sets it up.

Signed-off-by: Dave Klotz <[email protected]>
---
 drivers/pci/pcie_dw_spacemit.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/pci/pcie_dw_spacemit.c b/drivers/pci/pcie_dw_spacemit.c
index 6ac1d6bea4..3b5c2dc4e0 100644
--- a/drivers/pci/pcie_dw_spacemit.c
+++ b/drivers/pci/pcie_dw_spacemit.c
@@ -71,6 +71,12 @@ static void pcie_dw_configure(struct pcie_dw_spacemit *pci)
 
        dw_pcie_dbi_write_enable(&pci->dw, true);
 
+       /*
+        * Do not advertise ASPM L1: as Linux's driver notes, some NVMe drives
+        * report errors with it.
+        */
+       clrbits_le32(cap + PCI_EXP_LNKCAP, PCI_EXP_LNKCAP_ASPM_L1);
+
        /*
         * Keep the hardware's supported speeds unless the device tree limits
         * them with "max-link-speed", as Linux's DesignWare core does.
-- 
2.55.0


Reply via email to