diff options
author | Thomas Petazzoni <thomas.petazzoni@bootlin.com> | 2018-08-03 10:38:46 -0400 |
---|---|---|
committer | Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> | 2018-08-08 10:51:06 -0400 |
commit | 5a553d6ba103e28247f4e2d10bcc25545cd4d9cb (patch) | |
tree | 19499d31b8adfc2c2afadc9b5af71bb84253a7e2 | |
parent | ee1604381a371b3ea6aec7d5e43b6e3f5e153854 (diff) |
PCI: mvebu: Use resource_size() to remap I/O space
Instead of hardcoding the remapping of IO_SPACE_LIMIT - SZ_64K, use
resource_size().
However, we cannot use just IO_SPACE_LIMIT, because pci_ioremap_io() has
a bug and doesn't allow remapping the last 64 KB before IO_SPACE_LIMIT,
so we ensure that we do not exceed this limit. When the pci_ioremap_io()
issue is fixed, this work around can be dropped.
Note that this workaround already existed, since we were mapping only
up to IO_SPACE_LIMIT - SZ_64K.
Suggested-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
[lorenzo.pieralisi@arm.com: tweaked the commit log]
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
-rw-r--r-- | drivers/pci/controller/pci-mvebu.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pci-mvebu.c index 9aa224f2f009..05f863435e5e 100644 --- a/drivers/pci/controller/pci-mvebu.c +++ b/drivers/pci/controller/pci-mvebu.c | |||
@@ -1218,10 +1218,10 @@ static int mvebu_pcie_probe(struct platform_device *pdev) | |||
1218 | pcie->realio.flags = pcie->io.flags; | 1218 | pcie->realio.flags = pcie->io.flags; |
1219 | pcie->realio.start = PCIBIOS_MIN_IO; | 1219 | pcie->realio.start = PCIBIOS_MIN_IO; |
1220 | pcie->realio.end = min_t(resource_size_t, | 1220 | pcie->realio.end = min_t(resource_size_t, |
1221 | IO_SPACE_LIMIT, | 1221 | IO_SPACE_LIMIT - SZ_64K, |
1222 | resource_size(&pcie->io) - 1); | 1222 | resource_size(&pcie->io) - 1); |
1223 | 1223 | ||
1224 | for (i = 0; i < (IO_SPACE_LIMIT - SZ_64K); i += SZ_64K) | 1224 | for (i = 0; i < resource_size(&pcie->realio); i += SZ_64K) |
1225 | pci_ioremap_io(i, pcie->io.start + i); | 1225 | pci_ioremap_io(i, pcie->io.start + i); |
1226 | } else | 1226 | } else |
1227 | pcie->realio = pcie->io; | 1227 | pcie->realio = pcie->io; |