Skip to content

Commit a4bbcac

Browse files
chenhuacaibjorn-helgaas
authored andcommitted
PCI: loongson: Enable MSI in LS7A Root Complex
The LS7A chipset can be used as part of a PCIe Root Complex with Loongson-3C6000 and similar CPUs. In this case, DEV_LS7A_PCIE_PORT5 has a PCI_CLASS_BRIDGE_HOST class code, and it is a Type 0 Function whose config space provides access to Root Complex registers. The DEV_LS7A_PCIE_PORT5 has an MSI Capability, and its MSI Enable bit must be set before other devices below the Root Complex can use MSI. This is not the standard PCI behavior of MSI Enable, so the normal PCI MSI code does not set it. Set the DEV_LS7A_PCIE_PORT5 MSI Enable bit via a quirk so other devices below the Root Complex can use MSI. [kwilczynski: exit early to reduce indentation; commit log] Link: https://lore.kernel.org/linux-pci/[email protected] Signed-off-by: Sheng Wu <[email protected]> Signed-off-by: Huacai Chen <[email protected]> Signed-off-by: Krzysztof Wilczyński <[email protected]> [bhelgaas: commit log] Signed-off-by: Bjorn Helgaas <[email protected]> Cc: [email protected]
1 parent 1613e60 commit a4bbcac

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

drivers/pci/controller/pci-loongson.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,19 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LOONGSON,
163163
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LOONGSON,
164164
DEV_LS7A_HDMI, loongson_pci_pin_quirk);
165165

166+
static void loongson_pci_msi_quirk(struct pci_dev *dev)
167+
{
168+
u16 val, class = dev->class >> 8;
169+
170+
if (class != PCI_CLASS_BRIDGE_HOST)
171+
return;
172+
173+
pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &val);
174+
val |= PCI_MSI_FLAGS_ENABLE;
175+
pci_write_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, val);
176+
}
177+
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LOONGSON, DEV_LS7A_PCIE_PORT5, loongson_pci_msi_quirk);
178+
166179
static struct loongson_pci *pci_bus_to_loongson_pci(struct pci_bus *bus)
167180
{
168181
struct pci_config_window *cfg;

0 commit comments

Comments
 (0)