All of lore.kernel.org
 help / color / mirror / Atom feed
From: ecc@cmu.edu (Eric Cooper)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/3] Kirkwood: enable PCIe before reading device ID register
Date: Wed,  2 Feb 2011 17:16:10 -0500	[thread overview]
Message-ID: <1296684971-10577-2-git-send-email-ecc@cmu.edu> (raw)
In-Reply-To: <1296684971-10577-1-git-send-email-ecc@cmu.edu>

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>
---
 arch/arm/mach-kirkwood/common.h |    1 +
 arch/arm/mach-kirkwood/pcie.c   |    8 ++++++++
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
index 95bb0a7..a35b862 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 513ad31..ca294ff 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);
 }
-- 
1.7.2.3

  reply	other threads:[~2011-02-02 22:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-02 22:16 [PATCH v2 1/3] add machine-specific hook to machine_kexec Eric Cooper
2011-02-02 22:16 ` Eric Cooper [this message]
2011-02-04 13:16   ` [PATCH v2 2/3] Kirkwood: enable PCIe before reading device ID register Sergei Shtylyov
2011-02-02 22:16 ` [PATCH v2 3/3] Kirkwood: enable PCIe for kexec Eric Cooper
2011-02-02 22:22 ` [PATCH v2 1/3] add machine-specific hook to machine_kexec Nicolas Pitre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1296684971-10577-2-git-send-email-ecc@cmu.edu \
    --to=ecc@cmu.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.