diff options
author | Pratyush Anand <pratyush.anand@st.com> | 2013-12-11 04:38:33 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2013-12-20 11:21:35 -0500 |
commit | fce8591f73c6a30c231f220d1092362aae0b985c (patch) | |
tree | eac01872fe7826851ee3b335f821a232d25584d9 | |
parent | a01ef59e131b78b0fa7af235ea958bd17e5e86ca (diff) |
PCI: designware: Fix I/O transfers by using CPU (not realio) address
pp->io_base, which is the input of the outbound IO address translation
unit, should be the CPU address. It was incorrectly programmed to the
realio address.
We should pass global_io_offset rather than sys->io_offset to
pci_ioremap_io(), so we map the new window into the first available spot in
the Linux view of the I/O space.
We must also pass CPU address instead of realio address to pci_ioremap_io().
This patch fixes above issue. It has been tested with Lecroy PTC in AIC
mode and Pericom PI7C9X2G303EL PCIe switch, which does not work otherwise.
Tested-by: Mohit Kumar <mohit.kumar@st.com>
Tested-by: Tim Harvey <tharvey@gateworks.com>
Signed-off-by: Pratyush Anand <pratyush.anand@st.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Marek Vasut <marex@denx.de
Reviewed-by: Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Jingoo Han <jg1.han@samsung.com>
Cc: Richard Zhu <Hong-Xing.Zhu@freescale.com>
-rw-r--r-- | drivers/pci/host/pcie-designware.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c index fc97f5ace5b5..4a08d30548ce 100644 --- a/drivers/pci/host/pcie-designware.c +++ b/drivers/pci/host/pcie-designware.c | |||
@@ -418,6 +418,7 @@ int __init dw_pcie_host_init(struct pcie_port *pp) | |||
418 | + global_io_offset); | 418 | + global_io_offset); |
419 | pp->config.io_size = resource_size(&pp->io); | 419 | pp->config.io_size = resource_size(&pp->io); |
420 | pp->config.io_bus_addr = range.pci_addr; | 420 | pp->config.io_bus_addr = range.pci_addr; |
421 | pp->io_base = range.cpu_addr; | ||
421 | } | 422 | } |
422 | if (restype == IORESOURCE_MEM) { | 423 | if (restype == IORESOURCE_MEM) { |
423 | of_pci_range_to_resource(&range, np, &pp->mem); | 424 | of_pci_range_to_resource(&range, np, &pp->mem); |
@@ -443,7 +444,6 @@ int __init dw_pcie_host_init(struct pcie_port *pp) | |||
443 | 444 | ||
444 | pp->cfg0_base = pp->cfg.start; | 445 | pp->cfg0_base = pp->cfg.start; |
445 | pp->cfg1_base = pp->cfg.start + pp->config.cfg0_size; | 446 | pp->cfg1_base = pp->cfg.start + pp->config.cfg0_size; |
446 | pp->io_base = pp->io.start; | ||
447 | pp->mem_base = pp->mem.start; | 447 | pp->mem_base = pp->mem.start; |
448 | 448 | ||
449 | pp->va_cfg0_base = devm_ioremap(pp->dev, pp->cfg0_base, | 449 | pp->va_cfg0_base = devm_ioremap(pp->dev, pp->cfg0_base, |
@@ -613,7 +613,6 @@ static int dw_pcie_wr_other_conf(struct pcie_port *pp, struct pci_bus *bus, | |||
613 | return ret; | 613 | return ret; |
614 | } | 614 | } |
615 | 615 | ||
616 | |||
617 | static int dw_pcie_valid_config(struct pcie_port *pp, | 616 | static int dw_pcie_valid_config(struct pcie_port *pp, |
618 | struct pci_bus *bus, int dev) | 617 | struct pci_bus *bus, int dev) |
619 | { | 618 | { |
@@ -707,7 +706,7 @@ static int dw_pcie_setup(int nr, struct pci_sys_data *sys) | |||
707 | 706 | ||
708 | if (global_io_offset < SZ_1M && pp->config.io_size > 0) { | 707 | if (global_io_offset < SZ_1M && pp->config.io_size > 0) { |
709 | sys->io_offset = global_io_offset - pp->config.io_bus_addr; | 708 | sys->io_offset = global_io_offset - pp->config.io_bus_addr; |
710 | pci_ioremap_io(sys->io_offset, pp->io.start); | 709 | pci_ioremap_io(global_io_offset, pp->io_base); |
711 | global_io_offset += SZ_64K; | 710 | global_io_offset += SZ_64K; |
712 | pci_add_resource_offset(&sys->resources, &pp->io, | 711 | pci_add_resource_offset(&sys->resources, &pp->io, |
713 | sys->io_offset); | 712 | sys->io_offset); |