lkml.org 
[lkml]   [2025]   [Nov]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
Subject[PATCH 1/2] PCI: dwc: Program device-id
For some controllers, HW doesn't program the correct device-id
leading to incorrect identification in lspci. For ex, QCOM
controller SC7280 uses same device id as SM8250. This would
cause issues while applying controller specific quirks.

So, program the correct device-id after reading it from the
devicetree.

Signed-off-by: Sushrut Shree Trivedi <sushrut.trivedi@oss.qualcomm.com>
---
drivers/pci/controller/dwc/pcie-designware-host.c | 7 +++++++
drivers/pci/controller/dwc/pcie-designware.h | 2 ++
2 files changed, 9 insertions(+)

diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
index e92513c5bda5..e8b975044b22 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -619,6 +619,9 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp)
}
}

+ pp->device_id = 0xffff;
+ of_property_read_u32(np, "device-id", &pp->device_id);
+
dw_pcie_version_detect(pci);

dw_pcie_iatu_detect(pci);
@@ -1094,6 +1097,10 @@ int dw_pcie_setup_rc(struct dw_pcie_rp *pp)

dw_pcie_writel_dbi(pci, PCI_BASE_ADDRESS_0, 0);

+ /* Program correct device id */
+ if (pp->device_id != 0xffff)
+ dw_pcie_writew_dbi(pci, PCI_DEVICE_ID, pp->device_id);
+
/* Program correct class for RC */
dw_pcie_writew_dbi(pci, PCI_CLASS_DEVICE, PCI_CLASS_BRIDGE_PCI);

diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h
index e995f692a1ec..eff6da9438c4 100644
--- a/drivers/pci/controller/dwc/pcie-designware.h
+++ b/drivers/pci/controller/dwc/pcie-designware.h
@@ -431,6 +431,8 @@ struct dw_pcie_rp {
struct pci_config_window *cfg;
bool ecam_enabled;
bool native_ecam;
+ u32 vendor_id;
+ u32 device_id;
};

struct dw_pcie_ep_ops {
--
2.25.1


\
 
 \ /
  Last update: 2025-11-27 16:32    [from the cache]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and my Meterkast|Read the blog