linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: chao.xie@marvell.com (Chao Xie)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm: pj4: check cpu id for pj4 cp0 access
Date: Fri, 14 Jun 2013 04:42:16 -0400	[thread overview]
Message-ID: <1371199336-28027-1-git-send-email-chao.xie@marvell.com> (raw)

Check cpu id in pj4_cp0_init. So for no-PJ4 V7 cpus,
pj4_cpu0_init just return.
This fix will help to make the all the V7 cpus(pj4 and no-PJ4)
use same platform code.

Signed-off-by: Chao Xie <chao.xie@marvell.com>
---
 arch/arm/kernel/pj4-cp0.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/arch/arm/kernel/pj4-cp0.c b/arch/arm/kernel/pj4-cp0.c
index 679cf4d..684dec7 100644
--- a/arch/arm/kernel/pj4-cp0.c
+++ b/arch/arm/kernel/pj4-cp0.c
@@ -18,6 +18,9 @@
 #include <linux/io.h>
 #include <asm/thread_notify.h>
 
+#define CORE_PJ4_MASK	0xfffffff0
+#define CORE_PJ4_ID	0x562f5840
+
 static int iwmmxt_do(struct notifier_block *self, unsigned long cmd, void *t)
 {
 	struct thread_info *thread = t;
@@ -79,6 +82,15 @@ static void __init pj4_cp_access_write(u32 value)
 static int __init pj4_cp0_init(void)
 {
 	u32 cp_access;
+	u32 cpuid;
+
+	__asm__ __volatile__ (
+		"mrc	p15, 0, %0, c0, c0\n\t"
+		: "=r" (cpuid));
+
+	/* If it is not a pj4 core, skip it. */
+	if ((cpuid & CORE_PJ4_MASK) != CORE_PJ4_ID)
+		return 0;
 
 	cp_access = pj4_cp_access_read() & ~0xf;
 	pj4_cp_access_write(cp_access);
-- 
1.7.4.1

             reply	other threads:[~2013-06-14  8:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-14  8:42 Chao Xie [this message]
2013-06-14  8:47 ` [PATCH] arm: pj4: check cpu id for pj4 cp0 access Russell King - ARM Linux

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=1371199336-28027-1-git-send-email-chao.xie@marvell.com \
    --to=chao.xie@marvell.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).