PCI: mvebu: Only remap I/O space if configured
authorThomas Petazzoni <thomas.petazzoni@bootlin.com>
Fri, 3 Aug 2018 14:38:45 +0000 (16:38 +0200)
committerLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Wed, 8 Aug 2018 14:50:30 +0000 (15:50 +0100)
If there is no PCI I/O aperture configured in the Device Tree, it does
not make sense to create the virtual mapping for the PCI I/O space,
since we will anyway not create the MBus window that will allow to
access it. Therefore, do the pci_ioremap_io() only if necessary.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
drivers/pci/controller/pci-mvebu.c

index a195592723c2f0828ec5fc9f5c20f9b9d2c0aec0..9aa224f2f009784690ae2a5401c8546507cf4cec 100644 (file)
@@ -1220,6 +1220,9 @@ static int mvebu_pcie_probe(struct platform_device *pdev)
                pcie->realio.end = min_t(resource_size_t,
                                         IO_SPACE_LIMIT,
                                         resource_size(&pcie->io) - 1);
+
+               for (i = 0; i < (IO_SPACE_LIMIT - SZ_64K); i += SZ_64K)
+                       pci_ioremap_io(i, pcie->io.start + i);
        } else
                pcie->realio = pcie->io;
 
@@ -1278,9 +1281,6 @@ static int mvebu_pcie_probe(struct platform_device *pdev)
 
        pcie->nports = i;
 
-       for (i = 0; i < (IO_SPACE_LIMIT - SZ_64K); i += SZ_64K)
-               pci_ioremap_io(i, pcie->io.start + i);
-
        mvebu_pcie_enable(pcie);
 
        return 0;