* [PATCH] PCI: loongson: Use correct pci config access operations
@ 2021-08-19 7:40 Huacai Chen
0 siblings, 0 replies; only message in thread
From: Huacai Chen @ 2021-08-19 7:40 UTC (permalink / raw)
To: Bjorn Helgaas
Cc: linux-pci, Xuefeng Li, Huacai Chen, Jiaxun Yang, Huacai Chen
From: Huacai Chen <chenhc@lemote.com>
LS2K/LS7A support 8/16/32-bits pci config access operations, so we can
safely use pci_generic_config_read()/pci_generic_config_write() instead
of pci_generic_config_read32()/pci_generic_config_write32().
Signed-off-by: Huacai Chen <chenhc@lemote.com>
---
drivers/pci/controller/pci-loongson.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/controller/pci-loongson.c b/drivers/pci/controller/pci-loongson.c
index 48169b1e3817..7140bdd04d35 100644
--- a/drivers/pci/controller/pci-loongson.c
+++ b/drivers/pci/controller/pci-loongson.c
@@ -159,8 +159,15 @@ static int loongson_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
return val;
}
-/* H/w only accept 32-bit PCI operations */
+/* LS2K/LS7A accept 8/16/32-bit PCI operations */
static struct pci_ops loongson_pci_ops = {
+ .map_bus = pci_loongson_map_bus,
+ .read = pci_generic_config_read,
+ .write = pci_generic_config_write,
+};
+
+/* RS780/SR5690 only accept 32-bit PCI operations */
+static struct pci_ops loongson_pci_ops32 = {
.map_bus = pci_loongson_map_bus,
.read = pci_generic_config_read32,
.write = pci_generic_config_write32,
@@ -218,8 +225,11 @@ static int loongson_pci_probe(struct platform_device *pdev)
}
bridge->sysdata = priv;
- bridge->ops = &loongson_pci_ops;
bridge->map_irq = loongson_map_irq;
+ if (!of_device_is_compatible(node, "loongson,rs780e-pci"))
+ bridge->ops = &loongson_pci_ops;
+ else
+ bridge->ops = &loongson_pci_ops32;
return pci_host_probe(bridge);
}
--
2.27.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-08-19 7:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-19 7:40 [PATCH] PCI: loongson: Use correct pci config access operations Huacai Chen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).