diff options
author | David Daney <david.daney@cavium.com> | 2015-10-08 22:54:16 +0300 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2015-10-10 02:18:35 +0300 |
commit | f6225c3a0c1f2ef908244c31b91d62066360ce1d (patch) | |
tree | b0728bcd16ae1e87c8c5dd8bd9268da13e4944b5 /drivers/pci/host/pci-host-generic.c | |
parent | 47ddb949029f9517a773e67b0e5eaf80ef596dad (diff) | |
download | linux-f6225c3a0c1f2ef908244c31b91d62066360ce1d.tar.xz |
PCI: generic: Fix address window calculation for non-zero starting bus
Make the offset from the beginning of the "reg" property be from the
starting bus number, rather than zero. Hoist the invariant size
calculation out of the mapping for loop.
Update host-generic-pci.txt to clarify the semantics of the "reg" property
with respect to non-zero starting bus numbers.
Signed-off-by: David Daney <david.daney@cavium.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Rob Herring <robh@kernel.org>
Diffstat (limited to 'drivers/pci/host/pci-host-generic.c')
-rw-r--r-- | drivers/pci/host/pci-host-generic.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/pci/host/pci-host-generic.c b/drivers/pci/host/pci-host-generic.c index 895c0e39ca3b..5434c90db243 100644 --- a/drivers/pci/host/pci-host-generic.c +++ b/drivers/pci/host/pci-host-generic.c @@ -169,6 +169,7 @@ static int gen_pci_parse_map_cfg_windows(struct gen_pci *pci) struct resource *bus_range; struct device *dev = pci->host.dev.parent; struct device_node *np = dev->of_node; + u32 sz = 1 << pci->cfg.ops->bus_shift; err = of_address_to_resource(np, 0, &pci->cfg.res); if (err) { @@ -196,10 +197,9 @@ static int gen_pci_parse_map_cfg_windows(struct gen_pci *pci) bus_range = pci->cfg.bus_range; for (busn = bus_range->start; busn <= bus_range->end; ++busn) { u32 idx = busn - bus_range->start; - u32 sz = 1 << pci->cfg.ops->bus_shift; pci->cfg.win[idx] = devm_ioremap(dev, - pci->cfg.res.start + busn * sz, + pci->cfg.res.start + idx * sz, sz); if (!pci->cfg.win[idx]) return -ENOMEM; |