Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'pci-v3.15-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci

Pull PCI updates from Bjorn Helgaas:
"These are fixes for a powerpc NULL pointer dereference, an OF
interrupt mapping issue on some of the new host bridges, and a
DesignWare iATU issue.

Host bridge drivers
- Fix OF interrupt mapping for DesignWare, R-Car, Tegra (Lucas Stach)
- Fix DesignWare iATU programming (Mohit Kumar)

Miscellaneous
- Fix powerpc NULL dereference from list_for_each_entry() update (Mike Qiu)"

* tag 'pci-v3.15-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci:
PCI: tegra: Use new OF interrupt mapping when possible
PCI: rcar: Use new OF interrupt mapping when possible
PCI: designware: Use new OF interrupt mapping when possible
PCI: designware: Fix iATU programming for cfg1, io and mem viewport
PCI: designware: Fix comment for setting number of lanes
powerpc/PCI: Fix NULL dereference in sys_pciconfig_iobase() list traversal

+32 -13
+6 -4
arch/powerpc/kernel/pci_64.c
··· 208 208 unsigned long in_devfn) 209 209 { 210 210 struct pci_controller* hose; 211 - struct pci_bus *bus = NULL; 211 + struct pci_bus *tmp_bus, *bus = NULL; 212 212 struct device_node *hose_node; 213 213 214 214 /* Argh ! Please forgive me for that hack, but that's the ··· 229 229 * used on pre-domains setup. We return the first match 230 230 */ 231 231 232 - list_for_each_entry(bus, &pci_root_buses, node) { 233 - if (in_bus >= bus->number && in_bus <= bus->busn_res.end) 232 + list_for_each_entry(tmp_bus, &pci_root_buses, node) { 233 + if (in_bus >= tmp_bus->number && 234 + in_bus <= tmp_bus->busn_res.end) { 235 + bus = tmp_bus; 234 236 break; 235 - bus = NULL; 237 + } 236 238 } 237 239 if (bus == NULL || bus->dev.of_node == NULL) 238 240 return -ENODEV;
+7 -1
drivers/pci/host/pci-rcar-gen2.c
··· 15 15 #include <linux/io.h> 16 16 #include <linux/kernel.h> 17 17 #include <linux/module.h> 18 + #include <linux/of_pci.h> 18 19 #include <linux/pci.h> 19 20 #include <linux/platform_device.h> 20 21 #include <linux/pm_runtime.h> ··· 181 180 { 182 181 struct pci_sys_data *sys = dev->bus->sysdata; 183 182 struct rcar_pci_priv *priv = sys->private_data; 183 + int irq; 184 184 185 - return priv->irq; 185 + irq = of_irq_parse_and_map_pci(dev, slot, pin); 186 + if (!irq) 187 + irq = priv->irq; 188 + 189 + return irq; 186 190 } 187 191 188 192 #ifdef CONFIG_PCI_DEBUG
+6 -1
drivers/pci/host/pci-tegra.c
··· 639 639 static int tegra_pcie_map_irq(const struct pci_dev *pdev, u8 slot, u8 pin) 640 640 { 641 641 struct tegra_pcie *pcie = sys_to_pcie(pdev->bus->sysdata); 642 + int irq; 642 643 643 644 tegra_cpuidle_pcie_irqs_in_use(); 644 645 645 - return pcie->irq; 646 + irq = of_irq_parse_and_map_pci(pdev, slot, pin); 647 + if (!irq) 648 + irq = pcie->irq; 649 + 650 + return irq; 646 651 } 647 652 648 653 static void tegra_pcie_add_bus(struct pci_bus *bus)
+13 -7
drivers/pci/host/pcie-designware.c
··· 17 17 #include <linux/module.h> 18 18 #include <linux/msi.h> 19 19 #include <linux/of_address.h> 20 + #include <linux/of_pci.h> 20 21 #include <linux/pci.h> 21 22 #include <linux/pci_regs.h> 22 23 #include <linux/types.h> ··· 491 490 dw_pci.nr_controllers = 1; 492 491 dw_pci.private_data = (void **)&pp; 493 492 494 - pci_common_init(&dw_pci); 493 + pci_common_init_dev(pp->dev, &dw_pci); 495 494 pci_assign_unassigned_resources(); 496 495 #ifdef CONFIG_PCI_DOMAINS 497 496 dw_pci.domain++; ··· 521 520 dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND | PCIE_ATU_REGION_INDEX1, 522 521 PCIE_ATU_VIEWPORT); 523 522 dw_pcie_writel_rc(pp, PCIE_ATU_TYPE_CFG1, PCIE_ATU_CR1); 524 - dw_pcie_writel_rc(pp, PCIE_ATU_ENABLE, PCIE_ATU_CR2); 525 523 dw_pcie_writel_rc(pp, pp->cfg1_base, PCIE_ATU_LOWER_BASE); 526 524 dw_pcie_writel_rc(pp, (pp->cfg1_base >> 32), PCIE_ATU_UPPER_BASE); 527 525 dw_pcie_writel_rc(pp, pp->cfg1_base + pp->config.cfg1_size - 1, 528 526 PCIE_ATU_LIMIT); 529 527 dw_pcie_writel_rc(pp, busdev, PCIE_ATU_LOWER_TARGET); 530 528 dw_pcie_writel_rc(pp, 0, PCIE_ATU_UPPER_TARGET); 529 + dw_pcie_writel_rc(pp, PCIE_ATU_ENABLE, PCIE_ATU_CR2); 531 530 } 532 531 533 532 static void dw_pcie_prog_viewport_mem_outbound(struct pcie_port *pp) ··· 536 535 dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND | PCIE_ATU_REGION_INDEX0, 537 536 PCIE_ATU_VIEWPORT); 538 537 dw_pcie_writel_rc(pp, PCIE_ATU_TYPE_MEM, PCIE_ATU_CR1); 539 - dw_pcie_writel_rc(pp, PCIE_ATU_ENABLE, PCIE_ATU_CR2); 540 538 dw_pcie_writel_rc(pp, pp->mem_base, PCIE_ATU_LOWER_BASE); 541 539 dw_pcie_writel_rc(pp, (pp->mem_base >> 32), PCIE_ATU_UPPER_BASE); 542 540 dw_pcie_writel_rc(pp, pp->mem_base + pp->config.mem_size - 1, ··· 543 543 dw_pcie_writel_rc(pp, pp->config.mem_bus_addr, PCIE_ATU_LOWER_TARGET); 544 544 dw_pcie_writel_rc(pp, upper_32_bits(pp->config.mem_bus_addr), 545 545 PCIE_ATU_UPPER_TARGET); 546 + dw_pcie_writel_rc(pp, PCIE_ATU_ENABLE, PCIE_ATU_CR2); 546 547 } 547 548 548 549 static void dw_pcie_prog_viewport_io_outbound(struct pcie_port *pp) ··· 552 551 dw_pcie_writel_rc(pp, PCIE_ATU_REGION_OUTBOUND | PCIE_ATU_REGION_INDEX1, 553 552 PCIE_ATU_VIEWPORT); 554 553 dw_pcie_writel_rc(pp, PCIE_ATU_TYPE_IO, PCIE_ATU_CR1); 555 - dw_pcie_writel_rc(pp, PCIE_ATU_ENABLE, PCIE_ATU_CR2); 556 554 dw_pcie_writel_rc(pp, pp->io_base, PCIE_ATU_LOWER_BASE); 557 555 dw_pcie_writel_rc(pp, (pp->io_base >> 32), PCIE_ATU_UPPER_BASE); 558 556 dw_pcie_writel_rc(pp, pp->io_base + pp->config.io_size - 1, ··· 559 559 dw_pcie_writel_rc(pp, pp->config.io_bus_addr, PCIE_ATU_LOWER_TARGET); 560 560 dw_pcie_writel_rc(pp, upper_32_bits(pp->config.io_bus_addr), 561 561 PCIE_ATU_UPPER_TARGET); 562 + dw_pcie_writel_rc(pp, PCIE_ATU_ENABLE, PCIE_ATU_CR2); 562 563 } 563 564 564 565 static int dw_pcie_rd_other_conf(struct pcie_port *pp, struct pci_bus *bus, ··· 724 723 725 724 if (pp) { 726 725 pp->root_bus_nr = sys->busnr; 727 - bus = pci_scan_root_bus(NULL, sys->busnr, &dw_pcie_ops, 726 + bus = pci_scan_root_bus(pp->dev, sys->busnr, &dw_pcie_ops, 728 727 sys, &sys->resources); 729 728 } else { 730 729 bus = NULL; ··· 737 736 static int dw_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 738 737 { 739 738 struct pcie_port *pp = sys_to_pcie(dev->bus->sysdata); 739 + int irq; 740 740 741 - return pp->irq; 741 + irq = of_irq_parse_and_map_pci(dev, slot, pin); 742 + if (!irq) 743 + irq = pp->irq; 744 + 745 + return irq; 742 746 } 743 747 744 748 static void dw_pcie_add_bus(struct pci_bus *bus) ··· 770 764 u32 membase; 771 765 u32 memlimit; 772 766 773 - /* set the number of lines as 4 */ 767 + /* set the number of lanes */ 774 768 dw_pcie_readl_rc(pp, PCIE_PORT_LINK_CONTROL, &val); 775 769 val &= ~PORT_LINK_MODE_MASK; 776 770 switch (pp->lanes) {