Skip to content

Commit e3bca37

Browse files
kishonLorenzo Pieralisi
authored andcommitted
PCI: cadence: Fix updating Vendor ID and Subsystem Vendor ID register
Commit 1b79c52 ("PCI: cadence: Add host driver for Cadence PCIe controller") in order to update Vendor ID, directly wrote to PCI_VENDOR_ID register. However PCI_VENDOR_ID in root port configuration space is read-only register and writing to it will have no effect. Use local management register to configure Vendor ID and Subsystem Vendor ID. Link: https://lore.kernel.org/r/[email protected] Fixes: 1b79c52 ("PCI: cadence: Add host driver for Cadence PCIe controller") Signed-off-by: Kishon Vijay Abraham I <[email protected]> Signed-off-by: Lorenzo Pieralisi <[email protected]> Reviewed-by: Rob Herring <[email protected]>
1 parent d07701a commit e3bca37

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

drivers/pci/controller/cadence/pcie-cadence-host.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ static int cdns_pcie_host_init_root_port(struct cdns_pcie_rc *rc)
8282
{
8383
struct cdns_pcie *pcie = &rc->pcie;
8484
u32 value, ctrl;
85+
u32 id;
8586

8687
/*
8788
* Set the root complex BAR configuration register:
@@ -101,8 +102,12 @@ static int cdns_pcie_host_init_root_port(struct cdns_pcie_rc *rc)
101102
cdns_pcie_writel(pcie, CDNS_PCIE_LM_RC_BAR_CFG, value);
102103

103104
/* Set root port configuration space */
104-
if (rc->vendor_id != 0xffff)
105-
cdns_pcie_rp_writew(pcie, PCI_VENDOR_ID, rc->vendor_id);
105+
if (rc->vendor_id != 0xffff) {
106+
id = CDNS_PCIE_LM_ID_VENDOR(rc->vendor_id) |
107+
CDNS_PCIE_LM_ID_SUBSYS(rc->vendor_id);
108+
cdns_pcie_writel(pcie, CDNS_PCIE_LM_ID, id);
109+
}
110+
106111
if (rc->device_id != 0xffff)
107112
cdns_pcie_rp_writew(pcie, PCI_DEVICE_ID, rc->device_id);
108113

0 commit comments

Comments
 (0)