Lines Matching +full:child +full:- +full:interrupt +full:- +full:base
1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright (C) 2011-2013 Gabor Juhos <juhosg@openwrt.org>
15 #include <linux/interrupt.h>
22 #include <asm/mach-ralink/rt3883.h>
23 #include <asm/mach-ralink/ralink_regs.h>
60 void __iomem *base; member
77 hose = (struct pci_controller *) bus->sysdata; in pci_bus_to_rt3883_controller()
84 return ioread32(rpc->base + reg); in rt3883_pci_r32()
90 iowrite32(val, rpc->base + reg); in rt3883_pci_w32()
143 generic_handle_domain_irq(rpc->irq_domain, bit); in rt3883_pci_irq_handler()
157 rt3883_pci_w32(rpc, t | BIT(d->hwirq), RT3883_PCI_REG_PCIENA); in rt3883_pci_irq_unmask()
170 rt3883_pci_w32(rpc, t & ~BIT(d->hwirq), RT3883_PCI_REG_PCIENA); in rt3883_pci_irq_mask()
186 irq_set_chip_data(irq, d->host_data); in rt3883_pci_irq_map()
201 irq = irq_of_parse_and_map(rpc->intc_of_node, 0); in rt3883_pci_irq_init()
203 dev_err(dev, "%pOF has no IRQ", rpc->intc_of_node); in rt3883_pci_irq_init()
204 return -EINVAL; in rt3883_pci_irq_init()
210 rpc->irq_domain = in rt3883_pci_irq_init()
211 irq_domain_add_linear(rpc->intc_of_node, RT3883_PCI_IRQ_COUNT, in rt3883_pci_irq_init()
214 if (!rpc->irq_domain) { in rt3883_pci_irq_init()
216 return -ENODEV; in rt3883_pci_irq_init()
233 if (!rpc->pcie_ready && bus->number == 1) in rt3883_pci_config_read()
236 address = rt3883_pci_get_cfgaddr(bus->number, PCI_SLOT(devfn), in rt3883_pci_config_read()
266 if (!rpc->pcie_ready && bus->number == 1) in rt3883_pci_config_write()
269 address = rt3883_pci_get_cfgaddr(bus->number, PCI_SLOT(devfn), in rt3883_pci_config_write()
363 * and de-assert the reset line in rt3883_pci_preinit()
377 rpc->pcie_ready = t & BIT(0); in rt3883_pci_preinit()
379 if (!rpc->pcie_ready) { in rt3883_pci_preinit()
405 struct device *dev = &pdev->dev; in rt3883_pci_probe()
406 struct device_node *np = dev->of_node; in rt3883_pci_probe()
407 struct device_node *child; in rt3883_pci_probe() local
414 return -ENOMEM; in rt3883_pci_probe()
416 rpc->base = devm_platform_ioremap_resource(pdev, 0); in rt3883_pci_probe()
417 if (IS_ERR(rpc->base)) in rt3883_pci_probe()
418 return PTR_ERR(rpc->base); in rt3883_pci_probe()
420 /* find the interrupt controller child node */ in rt3883_pci_probe()
421 for_each_child_of_node(np, child) { in rt3883_pci_probe()
422 if (of_property_read_bool(child, "interrupt-controller")) { in rt3883_pci_probe()
423 rpc->intc_of_node = child; in rt3883_pci_probe()
428 if (!rpc->intc_of_node) { in rt3883_pci_probe()
429 dev_err(dev, "%pOF has no %s child node", in rt3883_pci_probe()
430 np, "interrupt controller"); in rt3883_pci_probe()
431 return -EINVAL; in rt3883_pci_probe()
434 /* find the PCI host bridge child node */ in rt3883_pci_probe()
435 for_each_child_of_node(np, child) { in rt3883_pci_probe()
436 if (of_node_is_type(child, "pci")) { in rt3883_pci_probe()
437 rpc->pci_controller.of_node = child; in rt3883_pci_probe()
442 if (!rpc->pci_controller.of_node) { in rt3883_pci_probe()
443 dev_err(dev, "%pOF has no %s child node", in rt3883_pci_probe()
445 err = -EINVAL; in rt3883_pci_probe()
450 for_each_available_child_of_node(rpc->pci_controller.of_node, child) { in rt3883_pci_probe()
453 if (!of_node_is_type(child, "pci")) in rt3883_pci_probe()
456 devfn = of_pci_get_devfn(child); in rt3883_pci_probe()
474 err = -EINVAL; in rt3883_pci_probe()
484 rpc->pci_controller.pci_ops = &rt3883_pci_ops; in rt3883_pci_probe()
485 rpc->pci_controller.io_resource = &rpc->io_res; in rt3883_pci_probe()
486 rpc->pci_controller.mem_resource = &rpc->mem_res; in rt3883_pci_probe()
489 pci_load_of_ranges(&rpc->pci_controller, in rt3883_pci_probe()
490 rpc->pci_controller.of_node); in rt3883_pci_probe()
492 rt3883_pci_w32(rpc, rpc->mem_res.start, RT3883_PCI_REG_MEMBASE); in rt3883_pci_probe()
493 rt3883_pci_w32(rpc, rpc->io_res.start, RT3883_PCI_REG_IOBASE); in rt3883_pci_probe()
495 ioport_resource.start = rpc->io_res.start; in rt3883_pci_probe()
496 ioport_resource.end = rpc->io_res.end; in rt3883_pci_probe()
541 register_pci_controller(&rpc->pci_controller); in rt3883_pci_probe()
546 of_node_put(rpc->pci_controller.of_node); in rt3883_pci_probe()
548 of_node_put(rpc->intc_of_node); in rt3883_pci_probe()
563 { .compatible = "ralink,rt3883-pci" },
570 .name = "rt3883-pci",