• Home
  • Raw
  • Download

Lines Matching +full:loongson +full:- +full:1

1 // SPDX-License-Identifier: GPL-2.0
3 * Loongson PCI Host Controller Driver
12 #include <linux/pci-acpi.h>
13 #include <linux/pci-ecam.h>
32 #define FLAG_CFG1 BIT(1)
50 dev->class = PCI_CLASS_BRIDGE_PCI << 8; in bridge_class_quirk()
65 pdev->mmio_always_on = 1; in system_bus_quirk()
66 pdev->non_compliant_bars = 1; in system_bus_quirk()
76 * Some Loongson PCIe ports have hardware limitations on their Maximum Read
79 * bridges. However, some MIPS Loongson firmware doesn't set MRRS properly,
85 struct pci_bus *bus = pdev->bus; in loongson_set_min_mrrs_quirk()
88 { PCI_VDEVICE(LOONGSON, DEV_LS2K_PCIE_PORT0) }, in loongson_set_min_mrrs_quirk()
89 { PCI_VDEVICE(LOONGSON, DEV_LS7A_PCIE_PORT0) }, in loongson_set_min_mrrs_quirk()
90 { PCI_VDEVICE(LOONGSON, DEV_LS7A_PCIE_PORT1) }, in loongson_set_min_mrrs_quirk()
91 { PCI_VDEVICE(LOONGSON, DEV_LS7A_PCIE_PORT2) }, in loongson_set_min_mrrs_quirk()
92 { PCI_VDEVICE(LOONGSON, DEV_LS7A_PCIE_PORT3) }, in loongson_set_min_mrrs_quirk()
93 { PCI_VDEVICE(LOONGSON, DEV_LS7A_PCIE_PORT4) }, in loongson_set_min_mrrs_quirk()
94 { PCI_VDEVICE(LOONGSON, DEV_LS7A_PCIE_PORT5) }, in loongson_set_min_mrrs_quirk()
95 { PCI_VDEVICE(LOONGSON, DEV_LS7A_PCIE_PORT6) }, in loongson_set_min_mrrs_quirk()
101 bridge = bus->self; in loongson_set_min_mrrs_quirk()
102 bus = bus->parent; in loongson_set_min_mrrs_quirk()
118 struct pci_host_bridge *bridge = pci_find_host_bridge(pdev->bus); in loongson_mrrs_quirk()
120 bridge->no_inc_mrrs = 1; in loongson_mrrs_quirk()
141 pdev->pin = 1 + (PCI_FUNC(pdev->devfn) & 3); in loongson_pci_pin_quirk()
167 return (struct loongson_pci *)(bus->sysdata); in pci_bus_to_loongson_pci()
169 cfg = bus->sysdata; in pci_bus_to_loongson_pci()
170 return (struct loongson_pci *)(cfg->priv); in pci_bus_to_loongson_pci()
177 unsigned char busnum = bus->number; in cfg0_map()
180 addroff |= BIT(24); /* Type 1 Access */ in cfg0_map()
184 return priv->cfg0_base + addroff; in cfg0_map()
191 unsigned char busnum = bus->number; in cfg1_map()
194 addroff |= BIT(28); /* Type 1 Access */ in cfg1_map()
198 return priv->cfg1_base + addroff; in cfg1_map()
212 if ((priv->data->flags & FLAG_DEV_FIX) && bus->self) { in pci_loongson_map_bus()
222 if (where < PCI_CFG_SPACE_SIZE && priv->cfg0_base) in pci_loongson_map_bus()
226 if (where < PCI_CFG_SPACE_EXP_SIZE && priv->cfg1_base) in pci_loongson_map_bus()
252 /* LS2K/LS7A accept 8/16/32-bit PCI config operations */
259 /* RS780/SR5690 only accept 32-bit PCI config operations */
282 { .compatible = "loongson,ls2k-pci",
284 { .compatible = "loongson,ls7a-pci",
286 { .compatible = "loongson,rs780e-pci",
294 struct device *dev = &pdev->dev; in loongson_pci_probe()
295 struct device_node *node = dev->of_node; in loongson_pci_probe()
300 return -ENODEV; in loongson_pci_probe()
304 return -ENODEV; in loongson_pci_probe()
307 priv->pdev = pdev; in loongson_pci_probe()
308 priv->data = (struct pci_controller_data *)of_device_get_match_data(dev); in loongson_pci_probe()
310 if (priv->data->flags & FLAG_CFG0) { in loongson_pci_probe()
315 priv->cfg0_base = devm_pci_remap_cfg_resource(dev, regs); in loongson_pci_probe()
316 if (IS_ERR(priv->cfg0_base)) in loongson_pci_probe()
317 return PTR_ERR(priv->cfg0_base); in loongson_pci_probe()
321 if (priv->data->flags & FLAG_CFG1) { in loongson_pci_probe()
322 regs = platform_get_resource(pdev, IORESOURCE_MEM, 1); in loongson_pci_probe()
326 priv->cfg1_base = devm_pci_remap_cfg_resource(dev, regs); in loongson_pci_probe()
327 if (IS_ERR(priv->cfg1_base)) in loongson_pci_probe()
328 priv->cfg1_base = NULL; in loongson_pci_probe()
332 bridge->sysdata = priv; in loongson_pci_probe()
333 bridge->ops = priv->data->ops; in loongson_pci_probe()
334 bridge->map_irq = loongson_map_irq; in loongson_pci_probe()
341 .name = "loongson-pci",
354 struct device *dev = cfg->parent; in loongson_pci_ecam_init()
360 return -ENOMEM; in loongson_pci_ecam_init()
364 return -ENOMEM; in loongson_pci_ecam_init()
366 cfg->priv = priv; in loongson_pci_ecam_init()
367 data->flags = FLAG_CFG1; in loongson_pci_ecam_init()
368 priv->data = data; in loongson_pci_ecam_init()
369 priv->cfg1_base = cfg->win - (cfg->busr.start << 16); in loongson_pci_ecam_init()