summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Cooper <ecc@cmu.edu>2011-02-02 17:16:10 -0500
committerNicolas Pitre <nico@fluxnic.net>2011-03-03 16:26:56 -0500
commit0e0cdd37709ba7ac9f0bff5de1b22f1b7987b04c (patch)
tree10fedbe7429bbb9afddd01215aef3cd490c31bdd
parent868d172b8ac23070418ec6265195e88e8d5dbe92 (diff)
[ARM] Kirkwood: enable PCIe before reading device ID register
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>
-rw-r--r--arch/arm/mach-kirkwood/common.h1
-rw-r--r--arch/arm/mach-kirkwood/pcie.c8
2 files changed, 9 insertions, 0 deletions
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
index 95bb0a73adf..a35b8623577 100644
--- a/arch/arm/mach-kirkwood/common.h
+++ b/arch/arm/mach-kirkwood/common.h
@@ -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);
diff --git a/arch/arm/mach-kirkwood/pcie.c b/arch/arm/mach-kirkwood/pcie.c
index 513ad3102d7..ca294ff6d5b 100644
--- a/arch/arm/mach-kirkwood/pcie.c
+++ b/arch/arm/mach-kirkwood/pcie.c
@@ -18,8 +18,16 @@
#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);
}