Skip to content

Commit 930c607

Browse files
lvjianmin-loongsonbjorn-helgaas
authored andcommitted
PCI: loongson: Work around LS7A incorrect Interrupt Pin registers
Several devices integrated into LS7A report 1 (which means they use INTA) in their Interrupt Pin registers, but they actually use a different interrupt. Add a quirk to override the incorrect Interrupt Pin values. This is only needed by ACPI-based systems. For DT-based systems, pci_assign_irq() ignores the Interrupt Pin register except to learn that the device uses INTx and the host bridge .map_irq() function (loongson_map_irq()) learns the IRQ mapping via DT and of_irq_parse_pci(). [bhelgaas: drop PCIE_PORT_x, OHCI, GPU since they are function 0 and don't need the quirk, squash in updates from https://lore.kernel.org/r/CAAhV-H40_o+9KS1t67O98GusM38pDaiB4bssxd3KQZpAByfnLg@mail.gmail.com] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jianmin Lv <[email protected]> Signed-off-by: Huacai Chen <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]>
1 parent 2410e33 commit 930c607

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

drivers/pci/controller/pci-loongson.c

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,15 @@
2020
#define DEV_PCIE_PORT_2 0x7a29
2121

2222
#define DEV_LS2K_APB 0x7a02
23-
#define DEV_LS7A_CONF 0x7a10
23+
#define DEV_LS7A_GMAC 0x7a03
24+
#define DEV_LS7A_DC1 0x7a06
2425
#define DEV_LS7A_LPC 0x7a0c
26+
#define DEV_LS7A_AHCI 0x7a08
27+
#define DEV_LS7A_CONF 0x7a10
28+
#define DEV_LS7A_GNET 0x7a13
29+
#define DEV_LS7A_EHCI 0x7a14
30+
#define DEV_LS7A_DC2 0x7a36
31+
#define DEV_LS7A_HDMI 0x7a37
2532

2633
#define FLAG_CFG0 BIT(0)
2734
#define FLAG_CFG1 BIT(1)
@@ -100,6 +107,25 @@ static void loongson_mrrs_quirk(struct pci_dev *dev)
100107
}
101108
DECLARE_PCI_FIXUP_ENABLE(PCI_ANY_ID, PCI_ANY_ID, loongson_mrrs_quirk);
102109

110+
static void loongson_pci_pin_quirk(struct pci_dev *pdev)
111+
{
112+
pdev->pin = 1 + (PCI_FUNC(pdev->devfn) & 3);
113+
}
114+
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LOONGSON,
115+
DEV_LS7A_DC1, loongson_pci_pin_quirk);
116+
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LOONGSON,
117+
DEV_LS7A_DC2, loongson_pci_pin_quirk);
118+
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LOONGSON,
119+
DEV_LS7A_GMAC, loongson_pci_pin_quirk);
120+
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LOONGSON,
121+
DEV_LS7A_AHCI, loongson_pci_pin_quirk);
122+
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LOONGSON,
123+
DEV_LS7A_EHCI, loongson_pci_pin_quirk);
124+
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LOONGSON,
125+
DEV_LS7A_GNET, loongson_pci_pin_quirk);
126+
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_LOONGSON,
127+
DEV_LS7A_HDMI, loongson_pci_pin_quirk);
128+
103129
static struct loongson_pci *pci_bus_to_loongson_pci(struct pci_bus *bus)
104130
{
105131
struct pci_config_window *cfg;

0 commit comments

Comments
 (0)