The ColdFire PCI configuration space access functions swap addressing
regions to do their work. Just letting the read/write cycles exit
the CPU core (via the ColdFire "nop" instruction) is not enough to
guarantee that the address region remapping has actually completed.
Insert a read back of the mapping register to be absolutely sure
that the remapping has completed.

This fixes an occasional boot hang during the ColdFire PCI initialization
phase.

Signed-off-by: Greg Ungerer <g...@linux-m68k.org>
---
 arch/m68k/coldfire/pci.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/arch/m68k/coldfire/pci.c b/arch/m68k/coldfire/pci.c
index dc6d125..9d6342c 100644
--- a/arch/m68k/coldfire/pci.c
+++ b/arch/m68k/coldfire/pci.c
@@ -46,13 +46,6 @@
        0, 69, 69, 71, 71,
 };
 
-
-static inline void syncio(void)
-{
-       /* The ColdFire "nop" instruction waits for all bus IO to complete */
-       __asm__ __volatile__ ("nop");
-}
-
 /*
  * Configuration space access functions. Configuration space access is
  * through the IO mapping window, enabling it via the PCICAR register.
@@ -75,9 +68,9 @@ static int mcf_pci_readconfig(struct pci_bus *bus, unsigned 
int devfn,
                        return PCIBIOS_SUCCESSFUL;
        }
 
-       syncio();
        offset = mcf_mk_pcicar(bus->number, devfn, where);
        __raw_writel(PCICAR_E | offset, iomem(PCICAR));
+       __raw_readl(iomem(PCICAR));
        addr = iospace + (where & 0x3);
 
        switch (size) {
@@ -92,8 +85,8 @@ static int mcf_pci_readconfig(struct pci_bus *bus, unsigned 
int devfn,
                break;
        }
 
-       syncio();
        __raw_writel(0, iomem(PCICAR));
+       __raw_readl(iomem(PCICAR));
        return PCIBIOS_SUCCESSFUL;
 }
 
@@ -108,9 +101,9 @@ static int mcf_pci_writeconfig(struct pci_bus *bus, 
unsigned int devfn,
                        return PCIBIOS_SUCCESSFUL;
        }
 
-       syncio();
        offset = mcf_mk_pcicar(bus->number, devfn, where);
        __raw_writel(PCICAR_E | offset, iomem(PCICAR));
+       __raw_readl(iomem(PCICAR));
        addr = iospace + (where & 0x3);
 
        switch (size) {
@@ -125,8 +118,8 @@ static int mcf_pci_writeconfig(struct pci_bus *bus, 
unsigned int devfn,
                break;
        }
 
-       syncio();
        __raw_writel(0, iomem(PCICAR));
+       __raw_readl(iomem(PCICAR));
        return PCIBIOS_SUCCESSFUL;
 }
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-m68k" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to