linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: kyungmin.park@samsung.com (Kyungmin Park)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] Samsung SoCs: Cpu detection support (v3)
Date: Wed, 16 Sep 2009 14:59:36 +0900	[thread overview]
Message-ID: <20090916055936.GA13338@july> (raw)

Store the CPU ID to cpu_id variable and use it to detect CPU

On S3C64XX, Some pheripherals such as OneNAND have different configuration
and handle it differently to do this it needs to detect CPU ID.

Also S5PC1XX is supported.

Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
diff --git a/arch/arm/plat-s3c/init.c b/arch/arm/plat-s3c/init.c
index 6790edf..b3bc18f 100644
--- a/arch/arm/plat-s3c/init.c
+++ b/arch/arm/plat-s3c/init.c
@@ -31,6 +31,45 @@
 
 static struct cpu_table *cpu;
 
+static unsigned long cpu_id;
+
+unsigned long samsung_cpu_id(void)
+{
+        return cpu_id;
+}
+EXPORT_SYMBOL(samsung_cpu_id);
+
+static void __init set_cpu_id(unsigned int idcode)
+{
+	/*
+	 * cpu_id encoding is as follows
+	 * cpu_id & 0xff000000 -> S3C Class (24xx/64xx/C1xx)
+	 * cpu_id & 0xfff00000 -> S3C Sub Class (241x/244x)
+	 * cpu_id & 0xffff0000 -> S3C Type (2410/2440/6400/6410/C100/C110)
+	 *
+	 * Remains[15:0] are reserved
+	 *
+	 * 24xx/64xx is started from 0x30000000
+	 * C1xx is started from 0x40000000
+	 *
+	 * Exception:
+	 *  Store Revision A to 1 such as
+	 *  s3c2410A to s3c2411
+	 *  s3c2440A to s3c2441
+	 */
+	if ((idcode >> 28) == 0x4)
+		cpu_id = 0xC0000000 | ((idcode & 0x00fff000) << 4);
+	else
+		cpu_id = (idcode & 0x0ffff000) << 4;
+
+	if (idcode == 0x32410002 || idcode == 0x32440001)
+		cpu_id |= (0x1 << 16);
+	if (idcode == 0x32440aaa)       /* s3c2442 */
+		cpu_id |= (0x2 << 16);
+	if (idcode == 0x0)              /* s3c2400 */
+		cpu_id |= (0x2400 << 16);
+}
+
 static struct cpu_table * __init s3c_lookup_cpu(unsigned long idcode,
 						struct cpu_table *tab,
 						unsigned int count)
@@ -53,6 +92,8 @@ void __init s3c_init_cpu(unsigned long idcode,
 		panic("Unknown S3C24XX CPU");
 	}
 
+	set_cpu_id(idcode);
+
 	printk("CPU %s (id 0x%08lx)\n", cpu->name, idcode);
 
 	if (cpu->map_io == NULL || cpu->init == NULL) {

                 reply	other threads:[~2009-09-16  5:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20090916055936.GA13338@july \
    --to=kyungmin.park@samsung.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).