[ARM] Kirkwood: enable PCIe before reading device ID register
authorEric Cooper <ecc@cmu.edu>
Wed, 2 Feb 2011 22:16:10 +0000 (17:16 -0500)
committerNicolas Pitre <nico@fluxnic.net>
Thu, 3 Mar 2011 21:26:56 +0000 (16:26 -0500)
PCIe may have been disabled (by kirkwood_clock_gate)
if this kernel was started by kexec.  Make sure PCIe
is enabled before attempting to access the device ID
register, otherwise the system will hang.

Signed-off-by: Eric Cooper <ecc@cmu.edu>
Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
arch/arm/mach-kirkwood/common.h
arch/arm/mach-kirkwood/pcie.c

index 95bb0a73adfbb90e097735ef30208459a15f6a56..a35b86235772f7e3483a31986b591e13330188b2 100644 (file)
@@ -32,6 +32,7 @@ void kirkwood_init_irq(void);
 extern struct mbus_dram_target_info kirkwood_mbus_dram_info;
 void kirkwood_setup_cpu_mbus(void);
 
+void kirkwood_enable_pcie(void);
 void kirkwood_pcie_id(u32 *dev, u32 *rev);
 
 void kirkwood_ehci_init(void);
index 513ad3102d7c192d2fdc00229b6cdb527b002d87..ca294ff6d5be02a4d6103a16db7e4666fa80c83c 100644 (file)
 #include <mach/bridge-regs.h>
 #include "common.h"
 
+void kirkwood_enable_pcie(void)
+{
+       u32 curr = readl(CLOCK_GATING_CTRL);
+       if (!(curr & CGC_PEX0))
+               writel(curr | CGC_PEX0, CLOCK_GATING_CTRL);
+}
+
 void __init kirkwood_pcie_id(u32 *dev, u32 *rev)
 {
+       kirkwood_enable_pcie();
        *dev = orion_pcie_dev_id((void __iomem *)PCIE_VIRT_BASE);
        *rev = orion_pcie_rev((void __iomem *)PCIE_VIRT_BASE);
 }
This page took 0.026468 seconds and 5 git commands to generate.