Skip to content

Commit 5a74445

Browse files
palismb49
authored andcommitted
PCI: aardvark: Set PCI Bridge Class Code to PCI Bridge
BugLink: https://bugs.launchpad.net/bugs/1956380 commit 84e1b40 upstream. Aardvark controller has something like config space of a Root Port available at offset 0x0 of internal registers - these registers are used for implementation of the emulated bridge. The default value of Class Code of this bridge corresponds to a RAID Mass storage controller, though. (This is probably intended for when the controller is used as Endpoint.) Change the Class Code to correspond to a PCI Bridge. Add comment explaining this change. Link: https://lore.kernel.org/r/20211028185659.20329-6-kabel@kernel.org Fixes: 8a3ebd8 ("PCI: aardvark: Implement emulated root PCI bridge config space") Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Cc: stable@vger.kernel.org Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Kamal Mostafa <kamal@canonical.com> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
1 parent 075f553 commit 5a74445

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

drivers/pci/controller/pci-aardvark.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,26 @@ static void advk_pcie_setup_hw(struct advk_pcie *pcie)
502502
reg = (PCI_VENDOR_ID_MARVELL << 16) | PCI_VENDOR_ID_MARVELL;
503503
advk_writel(pcie, reg, VENDOR_ID_REG);
504504

505+
/*
506+
* Change Class Code of PCI Bridge device to PCI Bridge (0x600400),
507+
* because the default value is Mass storage controller (0x010400).
508+
*
509+
* Note that this Aardvark PCI Bridge does not have compliant Type 1
510+
* Configuration Space and it even cannot be accessed via Aardvark's
511+
* PCI config space access method. Something like config space is
512+
* available in internal Aardvark registers starting at offset 0x0
513+
* and is reported as Type 0. In range 0x10 - 0x34 it has totally
514+
* different registers.
515+
*
516+
* Therefore driver uses emulation of PCI Bridge which emulates
517+
* access to configuration space via internal Aardvark registers or
518+
* emulated configuration buffer.
519+
*/
520+
reg = advk_readl(pcie, PCIE_CORE_DEV_REV_REG);
521+
reg &= ~0xffffff00;
522+
reg |= (PCI_CLASS_BRIDGE_PCI << 8) << 8;
523+
advk_writel(pcie, reg, PCIE_CORE_DEV_REV_REG);
524+
505525
/* Disable Root Bridge I/O space, memory space and bus mastering */
506526
reg = advk_readl(pcie, PCIE_CORE_CMD_STATUS_REG);
507527
reg &= ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER);

0 commit comments

Comments
 (0)