Lines Matching +full:rs780e +full:- +full:pci

1 // SPDX-License-Identifier: GPL-2.0
3 * Loongson PCI Host Controller Driver
10 #include <linux/pci.h>
12 #include <linux/pci-acpi.h>
13 #include <linux/pci-ecam.h>
15 #include "../pci.h"
58 dev->class = PCI_CLASS_BRIDGE_PCI_NORMAL; in bridge_class_quirk()
73 pdev->mmio_always_on = 1; in system_bus_quirk()
74 pdev->non_compliant_bars = 1; in system_bus_quirk()
93 struct pci_bus *bus = pdev->bus; in loongson_set_min_mrrs_quirk()
109 bridge = bus->self; in loongson_set_min_mrrs_quirk()
110 bus = bus->parent; in loongson_set_min_mrrs_quirk()
126 struct pci_host_bridge *bridge = pci_find_host_bridge(pdev->bus); in loongson_mrrs_quirk()
128 bridge->no_inc_mrrs = 1; in loongson_mrrs_quirk()
149 pdev->pin = 1 + (PCI_FUNC(pdev->devfn) & 3); in loongson_pci_pin_quirk()
168 u16 val, class = dev->class >> 8; in loongson_pci_msi_quirk()
173 pci_read_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, &val); in loongson_pci_msi_quirk()
175 pci_write_config_word(dev, dev->msi_cap + PCI_MSI_FLAGS, val); in loongson_pci_msi_quirk()
184 return (struct loongson_pci *)(bus->sysdata); in pci_bus_to_loongson_pci()
186 cfg = bus->sysdata; in pci_bus_to_loongson_pci()
187 return (struct loongson_pci *)(cfg->priv); in pci_bus_to_loongson_pci()
194 unsigned char busnum = bus->number; in cfg0_map()
201 return priv->cfg0_base + addroff; in cfg0_map()
208 unsigned char busnum = bus->number; in cfg1_map()
215 return priv->cfg1_base + addroff; in cfg1_map()
236 if ((priv->data->flags & FLAG_DEV_FIX) && bus->self) { in pci_loongson_map_bus()
241 /* Don't access non-existent devices */ in pci_loongson_map_bus()
242 if (priv->data->flags & FLAG_DEV_HIDDEN) { in pci_loongson_map_bus()
248 if (where < PCI_CFG_SPACE_SIZE && priv->cfg0_base) in pci_loongson_map_bus()
252 if (where < PCI_CFG_SPACE_EXP_SIZE && priv->cfg1_base) in pci_loongson_map_bus()
278 /* LS2K/LS7A accept 8/16/32-bit PCI config operations */
285 /* RS780/SR5690 only accept 32-bit PCI config operations */
308 { .compatible = "loongson,ls2k-pci",
310 { .compatible = "loongson,ls7a-pci",
312 { .compatible = "loongson,rs780e-pci",
320 struct device *dev = &pdev->dev; in loongson_pci_probe()
321 struct device_node *node = dev->of_node; in loongson_pci_probe()
326 return -ENODEV; in loongson_pci_probe()
330 return -ENODEV; in loongson_pci_probe()
333 priv->pdev = pdev; in loongson_pci_probe()
334 priv->data = of_device_get_match_data(dev); in loongson_pci_probe()
336 if (priv->data->flags & FLAG_CFG0) { in loongson_pci_probe()
341 priv->cfg0_base = devm_pci_remap_cfg_resource(dev, regs); in loongson_pci_probe()
342 if (IS_ERR(priv->cfg0_base)) in loongson_pci_probe()
343 return PTR_ERR(priv->cfg0_base); in loongson_pci_probe()
347 if (priv->data->flags & FLAG_CFG1) { in loongson_pci_probe()
352 priv->cfg1_base = devm_pci_remap_cfg_resource(dev, regs); in loongson_pci_probe()
353 if (IS_ERR(priv->cfg1_base)) in loongson_pci_probe()
354 priv->cfg1_base = NULL; in loongson_pci_probe()
358 bridge->sysdata = priv; in loongson_pci_probe()
359 bridge->ops = priv->data->ops; in loongson_pci_probe()
360 bridge->map_irq = loongson_map_irq; in loongson_pci_probe()
367 .name = "loongson-pci",
380 struct device *dev = cfg->parent; in loongson_pci_ecam_init()
386 return -ENOMEM; in loongson_pci_ecam_init()
390 return -ENOMEM; in loongson_pci_ecam_init()
392 cfg->priv = priv; in loongson_pci_ecam_init()
393 data->flags = FLAG_CFG1 | FLAG_DEV_HIDDEN; in loongson_pci_ecam_init()
394 priv->data = data; in loongson_pci_ecam_init()
395 priv->cfg1_base = cfg->win - (cfg->busr.start << 16); in loongson_pci_ecam_init()