From: Jianmin Lv <lvjianmin@xxxxxxxxxxx> In LS7A, multifunction device use same pci PIN and different irq for different function, so fix it for standard pci PIN usage. Signed-off-by: Jianmin Lv <lvjianmin@xxxxxxxxxxx> Signed-off-by: Huacai Chen <chenhuacai@xxxxxxxxxxx> --- drivers/pci/quirks.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 10b3b2057940..6ab4b3bba36b 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -242,6 +242,23 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_LOONGSON, DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_LOONGSON, DEV_LS7A_LPC, loongson_system_bus_quirk); +static void loongson_pci_pin_quirk(struct pci_dev *dev) +{ + static const struct pci_device_id devids[] = { + { PCI_VDEVICE(LOONGSON, DEV_PCIE_PORT_0) }, + { PCI_VDEVICE(LOONGSON, DEV_PCIE_PORT_1) }, + { PCI_VDEVICE(LOONGSON, DEV_PCIE_PORT_2) }, + { 0, }, + }; + + if (pci_match_id(devids, dev)) { + u8 fun = dev->devfn & 7; + + dev->pin = 1 + (fun & 3); + } +} +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LOONGSON, PCI_ANY_ID, loongson_pci_pin_quirk); + static void loongson_mrrs_quirk(struct pci_dev *dev) { struct pci_bus *bus = dev->bus; -- 2.27.0