Linux PCI subsystem development
 help / color / mirror / Atom feed
* [PATCH] PCI: dwc: Fix writing wrong value if snps,enable-cdm-check
@ 2023-02-16  9:20 Yoshihiro Shimoda
  2023-02-16 17:58 ` Bjorn Helgaas
  2023-02-16 20:37 ` Serge Semin
  0 siblings, 2 replies; 7+ messages in thread
From: Yoshihiro Shimoda @ 2023-02-16  9:20 UTC (permalink / raw)
  To: jingoohan1, gustavo.pimentel, Sergey.Semin, lpieralisi, kw, robh,
	bhelgaas
  Cc: linux-pci, Yoshihiro Shimoda

The "val" of PCIE_PORT_LINK_CONTROL will be reused on the
"Set the number of lanes". But, if snps,enable-cdm-check" exists,
the "val" will be set to PCIE_PL_CHK_REG_CONTROL_STATUS.
Therefore, unexpected register value is possible to be used
to PCIE_PORT_LINK_CONTROL register if snps,enable-cdm-check" exists.
So, read PCIE_PORT_LINK_CONTROL register again to fix the issue.

Fixes: ec7b952f453c ("PCI: dwc: Always enable CDM check if "snps,enable-cdm-check" exists")
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/pci/controller/dwc/pcie-designware.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c
index 6d5d619ab2e9..3bb9ca14fb9c 100644
--- a/drivers/pci/controller/dwc/pcie-designware.c
+++ b/drivers/pci/controller/dwc/pcie-designware.c
@@ -824,6 +824,7 @@ void dw_pcie_setup(struct dw_pcie *pci)
 	}
 
 	/* Set the number of lanes */
+	val = dw_pcie_readl_dbi(pci, PCIE_PORT_LINK_CONTROL);
 	val &= ~PORT_LINK_FAST_LINK_MODE;
 	val &= ~PORT_LINK_MODE_MASK;
 	switch (pci->num_lanes) {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-02-17 11:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-16  9:20 [PATCH] PCI: dwc: Fix writing wrong value if snps,enable-cdm-check Yoshihiro Shimoda
2023-02-16 17:58 ` Bjorn Helgaas
2023-02-16 20:49   ` Serge Semin
2023-02-17  0:46     ` Yoshihiro Shimoda
2023-02-17  8:06       ` Serge Semin
2023-02-17 11:21         ` Bjorn Helgaas
2023-02-16 20:37 ` Serge Semin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox