PCI: mvebu: Properly initialize vendor, device and revision of emulated bridge

With this change also PCI vendor id is read from mvebu registers.

Link: https://lore.kernel.org/r/20220104153529.31647-9-pali@kernel.org
Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Rob Herring <robh@kernel.org>
This commit is contained in:
Pali Rohár 2022-01-04 16:35:26 +01:00 committed by Lorenzo Pieralisi
parent 5c88ed7985
commit 16038ebb0f
1 changed files with 5 additions and 4 deletions

View File

@ -712,13 +712,14 @@ static int mvebu_pci_bridge_emul_init(struct mvebu_pcie_port *port)
{ {
unsigned int bridge_flags = PCI_BRIDGE_EMUL_NO_PREFMEM_FORWARD; unsigned int bridge_flags = PCI_BRIDGE_EMUL_NO_PREFMEM_FORWARD;
struct pci_bridge_emul *bridge = &port->bridge; struct pci_bridge_emul *bridge = &port->bridge;
u32 dev_id = mvebu_readl(port, PCIE_DEV_ID_OFF);
u32 dev_rev = mvebu_readl(port, PCIE_DEV_REV_OFF);
u32 pcie_cap = mvebu_readl(port, PCIE_CAP_PCIEXP); u32 pcie_cap = mvebu_readl(port, PCIE_CAP_PCIEXP);
u8 pcie_cap_ver = ((pcie_cap >> 16) & PCI_EXP_FLAGS_VERS); u8 pcie_cap_ver = ((pcie_cap >> 16) & PCI_EXP_FLAGS_VERS);
bridge->conf.vendor = PCI_VENDOR_ID_MARVELL; bridge->conf.vendor = cpu_to_le16(dev_id & 0xffff);
bridge->conf.device = mvebu_readl(port, PCIE_DEV_ID_OFF) >> 16; bridge->conf.device = cpu_to_le16(dev_id >> 16);
bridge->conf.class_revision = bridge->conf.class_revision = cpu_to_le32(dev_rev & 0xff);
mvebu_readl(port, PCIE_DEV_REV_OFF) & 0xff;
if (mvebu_has_ioport(port)) { if (mvebu_has_ioport(port)) {
/* We support 32 bits I/O addressing */ /* We support 32 bits I/O addressing */