Commit 5dc626358f76e32c4f111904f165bb28e2b447c0
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
Merge tag 'pci-v3.18-fixes-4' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
Pull PCI fix from Bjorn Helgaas: "This fixes a Tegra20 regression that we introduced during the v3.18 merge window" * tag 'pci-v3.18-fixes-4' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: PCI: tegra: Use physical range for I/O mapping
Showing 1 changed file Side-by-side Diff
drivers/pci/host/pci-tegra.c
... | ... | @@ -276,6 +276,7 @@ |
276 | 276 | |
277 | 277 | struct resource all; |
278 | 278 | struct resource io; |
279 | + struct resource pio; | |
279 | 280 | struct resource mem; |
280 | 281 | struct resource prefetch; |
281 | 282 | struct resource busn; |
... | ... | @@ -658,7 +659,6 @@ |
658 | 659 | { |
659 | 660 | struct tegra_pcie *pcie = sys_to_pcie(sys); |
660 | 661 | int err; |
661 | - phys_addr_t io_start; | |
662 | 662 | |
663 | 663 | err = devm_request_resource(pcie->dev, &pcie->all, &pcie->mem); |
664 | 664 | if (err < 0) |
665 | 665 | |
... | ... | @@ -668,14 +668,12 @@ |
668 | 668 | if (err) |
669 | 669 | return err; |
670 | 670 | |
671 | - io_start = pci_pio_to_address(pcie->io.start); | |
672 | - | |
673 | 671 | pci_add_resource_offset(&sys->resources, &pcie->mem, sys->mem_offset); |
674 | 672 | pci_add_resource_offset(&sys->resources, &pcie->prefetch, |
675 | 673 | sys->mem_offset); |
676 | 674 | pci_add_resource(&sys->resources, &pcie->busn); |
677 | 675 | |
678 | - pci_ioremap_io(nr * SZ_64K, io_start); | |
676 | + pci_ioremap_io(pcie->pio.start, pcie->io.start); | |
679 | 677 | |
680 | 678 | return 1; |
681 | 679 | } |
... | ... | @@ -786,7 +784,6 @@ |
786 | 784 | static void tegra_pcie_setup_translations(struct tegra_pcie *pcie) |
787 | 785 | { |
788 | 786 | u32 fpci_bar, size, axi_address; |
789 | - phys_addr_t io_start = pci_pio_to_address(pcie->io.start); | |
790 | 787 | |
791 | 788 | /* Bar 0: type 1 extended configuration space */ |
792 | 789 | fpci_bar = 0xfe100000; |
... | ... | @@ -799,7 +796,7 @@ |
799 | 796 | /* Bar 1: downstream IO bar */ |
800 | 797 | fpci_bar = 0xfdfc0000; |
801 | 798 | size = resource_size(&pcie->io); |
802 | - axi_address = io_start; | |
799 | + axi_address = pcie->io.start; | |
803 | 800 | afi_writel(pcie, axi_address, AFI_AXI_BAR1_START); |
804 | 801 | afi_writel(pcie, size >> 12, AFI_AXI_BAR1_SZ); |
805 | 802 | afi_writel(pcie, fpci_bar, AFI_FPCI_BAR1); |
... | ... | @@ -1690,8 +1687,23 @@ |
1690 | 1687 | |
1691 | 1688 | switch (res.flags & IORESOURCE_TYPE_BITS) { |
1692 | 1689 | case IORESOURCE_IO: |
1693 | - memcpy(&pcie->io, &res, sizeof(res)); | |
1694 | - pcie->io.name = np->full_name; | |
1690 | + memcpy(&pcie->pio, &res, sizeof(res)); | |
1691 | + pcie->pio.name = np->full_name; | |
1692 | + | |
1693 | + /* | |
1694 | + * The Tegra PCIe host bridge uses this to program the | |
1695 | + * mapping of the I/O space to the physical address, | |
1696 | + * so we override the .start and .end fields here that | |
1697 | + * of_pci_range_to_resource() converted to I/O space. | |
1698 | + * We also set the IORESOURCE_MEM type to clarify that | |
1699 | + * the resource is in the physical memory space. | |
1700 | + */ | |
1701 | + pcie->io.start = range.cpu_addr; | |
1702 | + pcie->io.end = range.cpu_addr + range.size - 1; | |
1703 | + pcie->io.flags = IORESOURCE_MEM; | |
1704 | + pcie->io.name = "I/O"; | |
1705 | + | |
1706 | + memcpy(&res, &pcie->io, sizeof(res)); | |
1695 | 1707 | break; |
1696 | 1708 | |
1697 | 1709 | case IORESOURCE_MEM: |