* [PATCH 0/4] ARM: SAMSUNG: Add support CPU ID and Rev. at runtime
@ 2011-08-20 5:05 Kukjin Kim
2011-08-20 5:05 ` [PATCH 1/4] ARM: SAMSUNG: Add support for detecting CPU " Kukjin Kim
` (4 more replies)
0 siblings, 5 replies; 10+ messages in thread
From: Kukjin Kim @ 2011-08-20 5:05 UTC (permalink / raw)
To: linux-arm-kernel
This patch adds support handling of CPU ID and varialble silicon revision
at runtime.
[PATCH 1/4] ARM: SAMSUNG: Add support for detecting CPU at runtime
[PATCH 2/4] ARM: S5P64X0: Use cpu_is_s5p64x0() to distinguish cpu at runtime
[PATCH 3/4] ARM: SAMSUNG: Add support for handling of cpu revision
[PATCH 4/4] ARM: EXYNOS4: Use samsung_rev() to distinguish silicon revision
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/4] ARM: SAMSUNG: Add support for detecting CPU at runtime
2011-08-20 5:05 [PATCH 0/4] ARM: SAMSUNG: Add support CPU ID and Rev. at runtime Kukjin Kim
@ 2011-08-20 5:05 ` Kukjin Kim
2011-08-20 8:07 ` Russell King - ARM Linux
2011-08-20 5:05 ` [PATCH 2/4] ARM: S5P64X0: Use cpu_is_s5p64x0() to distinguish cpu " Kukjin Kim
` (3 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: Kukjin Kim @ 2011-08-20 5:05 UTC (permalink / raw)
To: linux-arm-kernel
The cpu_is_[name]() can be used to distinguish cpu at runtime.
This patch was originally from Changhwan Youn <chaos.youn@samsung.com>
Acked-by: Changhwan Youn <chaos.youn@samsung.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
---
arch/arm/mach-s3c64xx/cpu.c | 18 +++----
arch/arm/plat-s3c24xx/cpu.c | 8 +--
arch/arm/plat-s5p/cpu.c | 26 ++++-----
arch/arm/plat-samsung/include/plat/cpu.h | 87 +++++++++++++++++++++++++++++-
arch/arm/plat-samsung/init.c | 1 +
5 files changed, 110 insertions(+), 30 deletions(-)
diff --git a/arch/arm/mach-s3c64xx/cpu.c b/arch/arm/mach-s3c64xx/cpu.c
index 374e45e..7b665f3 100644
--- a/arch/arm/mach-s3c64xx/cpu.c
+++ b/arch/arm/mach-s3c64xx/cpu.c
@@ -43,16 +43,16 @@ static const char name_s3c6410[] = "S3C6410";
static struct cpu_table cpu_ids[] __initdata = {
{
- .idcode = 0x36400000,
- .idmask = 0xfffff000,
+ .idcode = S3C6400_CPU_ID,
+ .idmask = S3C64XX_CPU_MASK,
.map_io = s3c6400_map_io,
.init_clocks = s3c6400_init_clocks,
.init_uarts = s3c6400_init_uarts,
.init = s3c6400_init,
.name = name_s3c6400,
}, {
- .idcode = 0x36410100,
- .idmask = 0xffffff00,
+ .idcode = S3C6410_CPU_ID,
+ .idmask = S3C64XX_CPU_MASK,
.map_io = s3c6410_map_io,
.init_clocks = s3c6410_init_clocks,
.init_uarts = s3c6410_init_uarts,
@@ -140,22 +140,20 @@ void __init s3c6400_common_init_uarts(struct s3c2410_uartcfg *cfg, int no)
void __init s3c64xx_init_io(struct map_desc *mach_desc, int size)
{
- unsigned long idcode;
-
/* initialise the io descriptors we need for initialisation */
iotable_init(s3c_iodesc, ARRAY_SIZE(s3c_iodesc));
iotable_init(mach_desc, size);
- idcode = __raw_readl(S3C_VA_SYS + 0x118);
- if (!idcode) {
+ samsung_cpu_id = __raw_readl(S3C_VA_SYS + 0x118);
+ if (!samsung_cpu_id) {
/* S3C6400 has the ID register in a different place,
* and needs a write before it can be read. */
__raw_writel(0x0, S3C_VA_SYS + 0xA1C);
- idcode = __raw_readl(S3C_VA_SYS + 0xA1C);
+ samsung_cpu_id = __raw_readl(S3C_VA_SYS + 0xA1C);
}
- s3c_init_cpu(idcode, cpu_ids, ARRAY_SIZE(cpu_ids));
+ s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
}
static __init int s3c64xx_sysdev_init(void)
diff --git a/arch/arm/plat-s3c24xx/cpu.c b/arch/arm/plat-s3c24xx/cpu.c
index c1fc6c6..ead21a4 100644
--- a/arch/arm/plat-s3c24xx/cpu.c
+++ b/arch/arm/plat-s3c24xx/cpu.c
@@ -215,19 +215,17 @@ static void s3c24xx_pm_restart(char mode, const char *cmd)
void __init s3c24xx_init_io(struct map_desc *mach_desc, int size)
{
- unsigned long idcode = 0x0;
-
/* initialise the io descriptors we need for initialisation */
iotable_init(mach_desc, size);
iotable_init(s3c_iodesc, ARRAY_SIZE(s3c_iodesc));
if (cpu_architecture() >= CPU_ARCH_ARMv5) {
- idcode = s3c24xx_read_idcode_v5();
+ samsung_cpu_id = s3c24xx_read_idcode_v5();
} else {
- idcode = s3c24xx_read_idcode_v4();
+ samsung_cpu_id = s3c24xx_read_idcode_v4();
}
arm_pm_restart = s3c24xx_pm_restart;
- s3c_init_cpu(idcode, cpu_ids, ARRAY_SIZE(cpu_ids));
+ s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
}
diff --git a/arch/arm/plat-s5p/cpu.c b/arch/arm/plat-s5p/cpu.c
index bbc2aa7..3ef6734 100644
--- a/arch/arm/plat-s5p/cpu.c
+++ b/arch/arm/plat-s5p/cpu.c
@@ -36,40 +36,40 @@ static const char name_exynos4210[] = "EXYNOS4210";
static struct cpu_table cpu_ids[] __initdata = {
{
- .idcode = 0x56440100,
- .idmask = 0xfffff000,
+ .idcode = S5P6440_CPU_ID,
+ .idmask = S5P64XX_CPU_MASK,
.map_io = s5p6440_map_io,
.init_clocks = s5p6440_init_clocks,
.init_uarts = s5p6440_init_uarts,
.init = s5p64x0_init,
.name = name_s5p6440,
}, {
- .idcode = 0x36450000,
- .idmask = 0xfffff000,
+ .idcode = S5P6450_CPU_ID,
+ .idmask = S5P64XX_CPU_MASK,
.map_io = s5p6450_map_io,
.init_clocks = s5p6450_init_clocks,
.init_uarts = s5p6450_init_uarts,
.init = s5p64x0_init,
.name = name_s5p6450,
}, {
- .idcode = 0x43100000,
- .idmask = 0xfffff000,
+ .idcode = S5PC100_CPU_ID,
+ .idmask = S5PC100_CPU_MASK,
.map_io = s5pc100_map_io,
.init_clocks = s5pc100_init_clocks,
.init_uarts = s5pc100_init_uarts,
.init = s5pc100_init,
.name = name_s5pc100,
}, {
- .idcode = 0x43110000,
- .idmask = 0xfffff000,
+ .idcode = S5PV210_CPU_ID,
+ .idmask = S5PV210_CPU_MASK,
.map_io = s5pv210_map_io,
.init_clocks = s5pv210_init_clocks,
.init_uarts = s5pv210_init_uarts,
.init = s5pv210_init,
.name = name_s5pv210,
}, {
- .idcode = 0x43210000,
- .idmask = 0xfffe0000,
+ .idcode = EXYNOS4210_CPU_ID,
+ .idmask = EXYNOS4_CPU_MASK,
.map_io = exynos4_map_io,
.init_clocks = exynos4_init_clocks,
.init_uarts = exynos4_init_uarts,
@@ -114,13 +114,11 @@ static struct map_desc s5p_iodesc[] __initdata = {
void __init s5p_init_io(struct map_desc *mach_desc,
int size, void __iomem *cpuid_addr)
{
- unsigned long idcode;
-
/* initialize the io descriptors we need for initialization */
iotable_init(s5p_iodesc, ARRAY_SIZE(s5p_iodesc));
if (mach_desc)
iotable_init(mach_desc, size);
- idcode = __raw_readl(cpuid_addr);
- s3c_init_cpu(idcode, cpu_ids, ARRAY_SIZE(cpu_ids));
+ samsung_cpu_id = __raw_readl(cpuid_addr);
+ s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
}
diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h
index c0a5741..b762b37 100644
--- a/arch/arm/plat-samsung/include/plat/cpu.h
+++ b/arch/arm/plat-samsung/include/plat/cpu.h
@@ -1,9 +1,12 @@
/* linux/arch/arm/plat-samsung/include/plat/cpu.h
*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com/
+ *
* Copyright (c) 2004-2005 Simtec Electronics
* Ben Dooks <ben@simtec.co.uk>
*
- * Header file for S3C24XX CPU support
+ * Header file for Samsung CPU support
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -15,6 +18,88 @@
#ifndef __SAMSUNG_PLAT_CPU_H
#define __SAMSUNG_PLAT_CPU_H
+extern unsigned long samsung_cpu_id;
+
+#define S3C24XX_CPU_ID 0x32400000
+#define S3C24XX_CPU_MASK 0xFFF00000
+
+#define S3C6400_CPU_ID 0x36400000
+#define S3C6410_CPU_ID 0x36410000
+#define S3C64XX_CPU_ID (S3C6400_CPU_ID & S3C6410_CPU_ID)
+#define S3C64XX_CPU_MASK 0x1FF40000
+
+#define S5P6440_CPU_ID 0x56440000
+#define S5P6450_CPU_ID 0x36450000
+#define S5P64XX_CPU_MASK 0x1FF40000
+
+#define S5PC100_CPU_ID 0x43100000
+#define S5PC100_CPU_MASK 0xFFFFF000
+
+#define S5PV210_CPU_ID 0x43110000
+#define S5PV210_CPU_MASK 0xFFFFF000
+
+#define EXYNOS4210_CPU_ID 0x43210000
+#define EXYNOS4_CPU_MASK 0xFFFE0000
+
+#define IS_SAMSUNG_CPU(name, id, mask) \
+static inline int is_samsung_##name(void) \
+{ \
+ return ((samsung_cpu_id & mask) == (id & mask)); \
+}
+
+IS_SAMSUNG_CPU(s3c24xx, S3C24XX_CPU_ID, S3C24XX_CPU_MASK)
+IS_SAMSUNG_CPU(s3c64xx, S3C64XX_CPU_ID, S3C64XX_CPU_MASK)
+IS_SAMSUNG_CPU(s5p6440, S5P6440_CPU_ID, S5P64XX_CPU_MASK)
+IS_SAMSUNG_CPU(s5p6450, S5P6450_CPU_ID, S5P64XX_CPU_MASK)
+IS_SAMSUNG_CPU(s5pc100, S5PC100_CPU_ID, S5PC100_CPU_MASK)
+IS_SAMSUNG_CPU(s5pv210, S5PV210_CPU_ID, S5PV210_CPU_MASK)
+IS_SAMSUNG_CPU(exynos4210, EXYNOS4210_CPU_ID, EXYNOS4_CPU_MASK)
+
+#if defined(CONFIG_CPU_S3C2410) || defined(CONFIG_CPU_S3C2412) || \
+ defined(CONFIG_CPU_S3C2416) || defined(CONFIG_CPU_S3C2440) || \
+ defined(CONFIG_CPU_S3C2442) || defined(CONFIG_CPU_S3C244X) || \
+ defined(CONFIG_CPU_S3C2443)
+# define cpu_is_s3c24xx() is_samsung_s3c24xx()
+#else
+# define cpu_is_s3c24xx() 0
+#endif
+
+#if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410)
+# define cpu_is_s3c64xx() is_samsung_s3c64xx()
+#else
+# define cpu_is_s3c64xx() 0
+#endif
+
+#if defined(CONFIG_CPU_S5P6440)
+# define cpu_is_s5p6440() is_samsung_s5p6440()
+#else
+# define cpu_is_s5p6440() 0
+#endif
+
+#if defined(CONFIG_CPU_S5P6450)
+# define cpu_is_s5p6450() is_samsung_s5p6450()
+#else
+# define cpu_is_s5p6450() 0
+#endif
+
+#if defined(CONFIG_CPU_S5PC100)
+# define cpu_is_s5pc100() is_samsung_s5pc100()
+#else
+# define cpu_is_s5pc100() 0
+#endif
+
+#if defined(CONFIG_CPU_S5PV210)
+# define cpu_is_s5pv210() is_samsung_s5pv210()
+#else
+# define cpu_is_s5pv210() 0
+#endif
+
+#if defined(CONFIG_CPU_EXYNOS4210)
+# define cpu_is_exynos4210() is_samsung_exynos4210()
+#else
+# define cpu_is_exynos4210() 0
+#endif
+
#define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE }
#ifndef MHZ
diff --git a/arch/arm/plat-samsung/init.c b/arch/arm/plat-samsung/init.c
index 79d10fc..40b1228 100644
--- a/arch/arm/plat-samsung/init.c
+++ b/arch/arm/plat-samsung/init.c
@@ -30,6 +30,7 @@
#include <plat/regs-serial.h>
static struct cpu_table *cpu;
+unsigned long samsung_cpu_id;
static struct cpu_table * __init s3c_lookup_cpu(unsigned long idcode,
struct cpu_table *tab,
--
1.7.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/4] ARM: S5P64X0: Use cpu_is_s5p64x0() to distinguish cpu at runtime
2011-08-20 5:05 [PATCH 0/4] ARM: SAMSUNG: Add support CPU ID and Rev. at runtime Kukjin Kim
2011-08-20 5:05 ` [PATCH 1/4] ARM: SAMSUNG: Add support for detecting CPU " Kukjin Kim
@ 2011-08-20 5:05 ` Kukjin Kim
2011-08-20 5:05 ` [PATCH 3/4] ARM: SAMSUNG: Add support for handling of cpu revision Kukjin Kim
` (2 subsequent siblings)
4 siblings, 0 replies; 10+ messages in thread
From: Kukjin Kim @ 2011-08-20 5:05 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
---
arch/arm/mach-s5p64x0/dev-spi.c | 8 +++-----
arch/arm/mach-s5p64x0/dma.c | 7 ++-----
arch/arm/mach-s5p64x0/gpiolib.c | 7 ++-----
arch/arm/mach-s5p64x0/irq-eint.c | 3 ++-
4 files changed, 9 insertions(+), 16 deletions(-)
diff --git a/arch/arm/mach-s5p64x0/dev-spi.c b/arch/arm/mach-s5p64x0/dev-spi.c
index ac825e8..aa24442 100644
--- a/arch/arm/mach-s5p64x0/dev-spi.c
+++ b/arch/arm/mach-s5p64x0/dev-spi.c
@@ -21,6 +21,7 @@
#include <mach/regs-clock.h>
#include <mach/spi-clocks.h>
+#include <plat/cpu.h>
#include <plat/s3c64xx-spi.h>
#include <plat/gpio-cfg.h>
@@ -185,11 +186,8 @@ struct platform_device s5p64x0_device_spi1 = {
void __init s5p64x0_spi_set_info(int cntrlr, int src_clk_nr, int num_cs)
{
- unsigned int id;
struct s3c64xx_spi_info *pd;
- id = __raw_readl(S5P64X0_SYS_ID) & 0xFF000;
-
/* Reject invalid configuration */
if (!num_cs || src_clk_nr < 0
|| src_clk_nr > S5P64X0_SPI_SRCCLK_SCLK) {
@@ -199,7 +197,7 @@ void __init s5p64x0_spi_set_info(int cntrlr, int src_clk_nr, int num_cs)
switch (cntrlr) {
case 0:
- if (id == 0x50000)
+ if (cpu_is_s5p6450())
pd = &s5p6450_spi0_pdata;
else
pd = &s5p6440_spi0_pdata;
@@ -207,7 +205,7 @@ void __init s5p64x0_spi_set_info(int cntrlr, int src_clk_nr, int num_cs)
s5p64x0_device_spi0.dev.platform_data = pd;
break;
case 1:
- if (id == 0x50000)
+ if (cpu_is_s5p6450())
pd = &s5p6450_spi1_pdata;
else
pd = &s5p6440_spi1_pdata;
diff --git a/arch/arm/mach-s5p64x0/dma.c b/arch/arm/mach-s5p64x0/dma.c
index d7ad944..0ac3d59 100644
--- a/arch/arm/mach-s5p64x0/dma.c
+++ b/arch/arm/mach-s5p64x0/dma.c
@@ -28,6 +28,7 @@
#include <mach/irqs.h>
#include <mach/regs-clock.h>
+#include <plat/cpu.h>
#include <plat/devs.h>
#include <plat/s3c-pl330-pdata.h>
@@ -133,11 +134,7 @@ static struct platform_device s5p64x0_device_pdma = {
static int __init s5p64x0_dma_init(void)
{
- unsigned int id;
-
- id = __raw_readl(S5P64X0_SYS_ID) & 0xFF000;
-
- if (id == 0x50000)
+ if (cpu_is_s5p6450())
s5p64x0_device_pdma.dev.platform_data = &s5p6450_pdma_pdata;
else
s5p64x0_device_pdma.dev.platform_data = &s5p6440_pdma_pdata;
diff --git a/arch/arm/mach-s5p64x0/gpiolib.c b/arch/arm/mach-s5p64x0/gpiolib.c
index e7fb3b0..c65684e 100644
--- a/arch/arm/mach-s5p64x0/gpiolib.c
+++ b/arch/arm/mach-s5p64x0/gpiolib.c
@@ -19,6 +19,7 @@
#include <mach/regs-gpio.h>
#include <mach/regs-clock.h>
+#include <plat/cpu.h>
#include <plat/gpio-core.h>
#include <plat/gpio-cfg.h>
#include <plat/gpio-cfg-helpers.h>
@@ -473,14 +474,10 @@ static void __init s5p64x0_gpio_add_rbank_4bit2(struct s3c_gpio_chip *chip,
static int __init s5p64x0_gpiolib_init(void)
{
- unsigned int chipid;
-
- chipid = __raw_readl(S5P64X0_SYS_ID);
-
s5p64x0_gpiolib_set_cfg(s5p64x0_gpio_cfgs,
ARRAY_SIZE(s5p64x0_gpio_cfgs));
- if ((chipid & 0xff000) == 0x50000) {
+ if (cpu_is_s5p6450()) {
samsung_gpiolib_add_2bit_chips(s5p6450_gpio_2bit,
ARRAY_SIZE(s5p6450_gpio_2bit));
diff --git a/arch/arm/mach-s5p64x0/irq-eint.c b/arch/arm/mach-s5p64x0/irq-eint.c
index 69ed454..eef01f1 100644
--- a/arch/arm/mach-s5p64x0/irq-eint.c
+++ b/arch/arm/mach-s5p64x0/irq-eint.c
@@ -17,6 +17,7 @@
#include <linux/irq.h>
#include <linux/io.h>
+#include <plat/cpu.h>
#include <plat/regs-irqtype.h>
#include <plat/gpio-cfg.h>
@@ -67,7 +68,7 @@ static int s5p64x0_irq_eint_set_type(struct irq_data *data, unsigned int type)
__raw_writel(ctrl, S5P64X0_EINT0CON0);
/* Configure the GPIO pin for 6450 or 6440 based on CPU ID */
- if (0x50000 == (__raw_readl(S5P64X0_SYS_ID) & 0xFF000))
+ if (cpu_is_s5p6450())
s3c_gpio_cfgpin(S5P6450_GPN(offs), S3C_GPIO_SFN(2));
else
s3c_gpio_cfgpin(S5P6440_GPN(offs), S3C_GPIO_SFN(2));
--
1.7.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/4] ARM: SAMSUNG: Add support for handling of cpu revision
2011-08-20 5:05 [PATCH 0/4] ARM: SAMSUNG: Add support CPU ID and Rev. at runtime Kukjin Kim
2011-08-20 5:05 ` [PATCH 1/4] ARM: SAMSUNG: Add support for detecting CPU " Kukjin Kim
2011-08-20 5:05 ` [PATCH 2/4] ARM: S5P64X0: Use cpu_is_s5p64x0() to distinguish cpu " Kukjin Kim
@ 2011-08-20 5:05 ` Kukjin Kim
2011-08-24 11:13 ` Kukjin Kim
2011-08-20 5:05 ` [PATCH 4/4] ARM: EXYNOS4: Use samsung_rev() to distinguish silicon revision Kukjin Kim
2011-08-20 6:34 ` [PATCH 0/4] ARM: SAMSUNG: Add support CPU ID and Rev. at runtime Kyungmin Park
4 siblings, 1 reply; 10+ messages in thread
From: Kukjin Kim @ 2011-08-20 5:05 UTC (permalink / raw)
To: linux-arm-kernel
This patch adds plat-samsung/cpu.c for detecting of cpu id and
silicon revision.
This patch was originally from Changhwan Youn <chaos.youn@samsung.com>
Acked-by: Changhwan Youn <chaos.youn@samsung.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
---
arch/arm/mach-s3c64xx/cpu.c | 10 +----
arch/arm/plat-s3c24xx/cpu.c | 1 +
arch/arm/plat-s5p/cpu.c | 4 ++-
arch/arm/plat-samsung/Makefile | 2 +-
arch/arm/plat-samsung/cpu.c | 58 ++++++++++++++++++++++++++++++
arch/arm/plat-samsung/include/plat/cpu.h | 4 ++
arch/arm/plat-samsung/init.c | 1 -
7 files changed, 69 insertions(+), 11 deletions(-)
create mode 100644 arch/arm/plat-samsung/cpu.c
diff --git a/arch/arm/mach-s3c64xx/cpu.c b/arch/arm/mach-s3c64xx/cpu.c
index 7b665f3..6c498f9 100644
--- a/arch/arm/mach-s3c64xx/cpu.c
+++ b/arch/arm/mach-s3c64xx/cpu.c
@@ -144,14 +144,8 @@ void __init s3c64xx_init_io(struct map_desc *mach_desc, int size)
iotable_init(s3c_iodesc, ARRAY_SIZE(s3c_iodesc));
iotable_init(mach_desc, size);
- samsung_cpu_id = __raw_readl(S3C_VA_SYS + 0x118);
- if (!samsung_cpu_id) {
- /* S3C6400 has the ID register in a different place,
- * and needs a write before it can be read. */
-
- __raw_writel(0x0, S3C_VA_SYS + 0xA1C);
- samsung_cpu_id = __raw_readl(S3C_VA_SYS + 0xA1C);
- }
+ /* detect cpu id */
+ s3c64xx_init_cpu();
s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
}
diff --git a/arch/arm/plat-s3c24xx/cpu.c b/arch/arm/plat-s3c24xx/cpu.c
index ead21a4..3c63353 100644
--- a/arch/arm/plat-s3c24xx/cpu.c
+++ b/arch/arm/plat-s3c24xx/cpu.c
@@ -224,6 +224,7 @@ void __init s3c24xx_init_io(struct map_desc *mach_desc, int size)
} else {
samsung_cpu_id = s3c24xx_read_idcode_v4();
}
+ s3c24xx_init_cpu();
arm_pm_restart = s3c24xx_pm_restart;
diff --git a/arch/arm/plat-s5p/cpu.c b/arch/arm/plat-s5p/cpu.c
index 3ef6734..04392c7 100644
--- a/arch/arm/plat-s5p/cpu.c
+++ b/arch/arm/plat-s5p/cpu.c
@@ -119,6 +119,8 @@ void __init s5p_init_io(struct map_desc *mach_desc,
if (mach_desc)
iotable_init(mach_desc, size);
- samsung_cpu_id = __raw_readl(cpuid_addr);
+ /* detect cpu id and rev. */
+ s5p_init_cpu(cpuid_addr);
+
s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids));
}
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index 853764b..3de756d 100644
--- a/arch/arm/plat-samsung/Makefile
+++ b/arch/arm/plat-samsung/Makefile
@@ -11,7 +11,7 @@ obj- :=
# Objects we always build independent of SoC choice
-obj-y += init.o
+obj-y += init.o cpu.o
obj-$(CONFIG_ARCH_USES_GETTIMEOFFSET) += time.o
obj-y += clock.o
obj-y += pwm-clock.o
diff --git a/arch/arm/plat-samsung/cpu.c b/arch/arm/plat-samsung/cpu.c
new file mode 100644
index 0000000..fb3b293
--- /dev/null
+++ b/arch/arm/plat-samsung/cpu.c
@@ -0,0 +1,58 @@
+/* linux/arch/arm/plat-samsung/cpu.c
+ *
+ * Copyright (c) 2009-2011 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com
+ *
+ * Samsung CPU Support
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/io.h>
+
+#include <asm/system.h>
+
+#include <mach/map.h>
+#include <plat/cpu.h>
+
+unsigned long samsung_cpu_id;
+static unsigned int samsung_cpu_rev;
+
+unsigned int samsung_rev(void)
+{
+ return samsung_cpu_rev;
+}
+EXPORT_SYMBOL(samsung_rev);
+
+void __init s3c24xx_init_cpu(void)
+{
+ /* nothing here yet */
+
+ samsung_cpu_rev = 0;
+}
+
+void __init s3c64xx_init_cpu(void)
+{
+ samsung_cpu_id = __raw_readl(S3C_VA_SYS + 0x118);
+ if (!samsung_cpu_id) {
+ /*
+ * S3C6400 has the ID register in a different place,
+ * and needs a write before it can be read.
+ */
+ __raw_writel(0x0, S3C_VA_SYS + 0xA1C);
+ samsung_cpu_id = __raw_readl(S3C_VA_SYS + 0xA1C);
+ }
+
+ samsung_cpu_rev = 0;
+}
+
+void __init s5p_init_cpu(void __iomem *cpuid_addr)
+{
+ samsung_cpu_id = __raw_readl(cpuid_addr);
+ samsung_cpu_rev = samsung_cpu_id & 0xF;
+}
diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h
index b762b37..16238c8 100644
--- a/arch/arm/plat-samsung/include/plat/cpu.h
+++ b/arch/arm/plat-samsung/include/plat/cpu.h
@@ -140,6 +140,10 @@ extern void s3c64xx_init_io(struct map_desc *mach_desc, int size);
extern void s5p_init_io(struct map_desc *mach_desc,
int size, void __iomem *cpuid_addr);
+extern void s3c24xx_init_cpu(void);
+extern void s3c64xx_init_cpu(void);
+extern void s5p_init_cpu(void __iomem *cpuid_addr);
+
extern void s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no);
extern void s3c24xx_init_clocks(int xtal);
diff --git a/arch/arm/plat-samsung/init.c b/arch/arm/plat-samsung/init.c
index 40b1228..79d10fc 100644
--- a/arch/arm/plat-samsung/init.c
+++ b/arch/arm/plat-samsung/init.c
@@ -30,7 +30,6 @@
#include <plat/regs-serial.h>
static struct cpu_table *cpu;
-unsigned long samsung_cpu_id;
static struct cpu_table * __init s3c_lookup_cpu(unsigned long idcode,
struct cpu_table *tab,
--
1.7.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 4/4] ARM: EXYNOS4: Use samsung_rev() to distinguish silicon revision
2011-08-20 5:05 [PATCH 0/4] ARM: SAMSUNG: Add support CPU ID and Rev. at runtime Kukjin Kim
` (2 preceding siblings ...)
2011-08-20 5:05 ` [PATCH 3/4] ARM: SAMSUNG: Add support for handling of cpu revision Kukjin Kim
@ 2011-08-20 5:05 ` Kukjin Kim
2011-08-24 11:13 ` Kukjin Kim
2011-08-20 6:34 ` [PATCH 0/4] ARM: SAMSUNG: Add support CPU ID and Rev. at runtime Kyungmin Park
4 siblings, 1 reply; 10+ messages in thread
From: Kukjin Kim @ 2011-08-20 5:05 UTC (permalink / raw)
To: linux-arm-kernel
This patch uses samsung_rev() to support variable silicon revision of
EXYNOS4210 so that can support for EXYNOS4210 REV0, REV1.0 and REV1.1.
Note: Need to change timer setting on REV0.
Acked-by: Changhwan Youn <chaos.youn@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
---
arch/arm/mach-exynos4/cpu.c | 28 +++++++++++++++++++++++-----
arch/arm/mach-exynos4/include/mach/map.h | 3 ++-
arch/arm/mach-exynos4/platsmp.c | 8 ++++++--
arch/arm/plat-samsung/include/plat/cpu.h | 6 ++++++
4 files changed, 37 insertions(+), 8 deletions(-)
diff --git a/arch/arm/mach-exynos4/cpu.c b/arch/arm/mach-exynos4/cpu.c
index 2d8a40c..f188c6d 100644
--- a/arch/arm/mach-exynos4/cpu.c
+++ b/arch/arm/mach-exynos4/cpu.c
@@ -43,11 +43,6 @@ static struct map_desc exynos4_iodesc[] __initdata = {
.length = SZ_4K,
.type = MT_DEVICE,
}, {
- .virtual = (unsigned long)S5P_VA_SYSRAM,
- .pfn = __phys_to_pfn(EXYNOS4_PA_SYSRAM),
- .length = SZ_4K,
- .type = MT_DEVICE,
- }, {
.virtual = (unsigned long)S5P_VA_CMU,
.pfn = __phys_to_pfn(EXYNOS4_PA_CMU),
.length = SZ_128K,
@@ -128,6 +123,24 @@ static void exynos4_idle(void)
local_irq_enable();
}
+static struct map_desc exynos4_iodesc0[] __initdata = {
+ {
+ .virtual = (unsigned long)S5P_VA_SYSRAM,
+ .pfn = __phys_to_pfn(EXYNOS4_PA_SYSRAM0),
+ .length = SZ_4K,
+ .type = MT_DEVICE,
+ },
+};
+
+static struct map_desc exynos4_iodesc1[] __initdata = {
+ {
+ .virtual = (unsigned long)S5P_VA_SYSRAM,
+ .pfn = __phys_to_pfn(EXYNOS4_PA_SYSRAM1),
+ .length = SZ_4K,
+ .type = MT_DEVICE,
+ },
+};
+
/*
* exynos4_map_io
*
@@ -137,6 +150,11 @@ void __init exynos4_map_io(void)
{
iotable_init(exynos4_iodesc, ARRAY_SIZE(exynos4_iodesc));
+ if (samsung_rev() == EXYNOS4210_REV_0)
+ iotable_init(exynos4_iodesc0, ARRAY_SIZE(exynos4_iodesc0));
+ else if (samsung_rev() == EXYNOS4210_REV_1_0)
+ iotable_init(exynos4_iodesc1, ARRAY_SIZE(exynos4_iodesc1));
+
/* initialize device information early */
exynos4_default_sdhci0();
exynos4_default_sdhci1();
diff --git a/arch/arm/mach-exynos4/include/mach/map.h b/arch/arm/mach-exynos4/include/mach/map.h
index d32296d..7073ac7 100644
--- a/arch/arm/mach-exynos4/include/mach/map.h
+++ b/arch/arm/mach-exynos4/include/mach/map.h
@@ -23,7 +23,8 @@
#include <plat/map-s5p.h>
-#define EXYNOS4_PA_SYSRAM 0x02020000
+#define EXYNOS4_PA_SYSRAM0 0x02025000
+#define EXYNOS4_PA_SYSRAM1 0x02020000
#define EXYNOS4_PA_FIMC0 0x11800000
#define EXYNOS4_PA_FIMC1 0x11810000
diff --git a/arch/arm/mach-exynos4/platsmp.c b/arch/arm/mach-exynos4/platsmp.c
index 7c2282c..96cc651 100644
--- a/arch/arm/mach-exynos4/platsmp.c
+++ b/arch/arm/mach-exynos4/platsmp.c
@@ -30,9 +30,12 @@
#include <mach/regs-clock.h>
#include <mach/regs-pmu.h>
+#include <plat/cpu.h>
+
extern void exynos4_secondary_startup(void);
-#define CPU1_BOOT_REG S5P_VA_SYSRAM
+#define CPU1_BOOT_REG (samsung_rev() == EXYNOS4210_REV_1_1 ? \
+ S5P_INFORM5 : S5P_VA_SYSRAM)
/*
* control for which core is the next to come out of the secondary
@@ -216,5 +219,6 @@ void __init platform_smp_prepare_cpus(unsigned int max_cpus)
* until it receives a soft interrupt, and then the
* secondary CPU branches to this address.
*/
- __raw_writel(BSYM(virt_to_phys(exynos4_secondary_startup)), S5P_VA_SYSRAM);
+ __raw_writel(BSYM(virt_to_phys(exynos4_secondary_startup)),
+ CPU1_BOOT_REG);
}
diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h
index 16238c8..b0d3d59 100644
--- a/arch/arm/plat-samsung/include/plat/cpu.h
+++ b/arch/arm/plat-samsung/include/plat/cpu.h
@@ -100,6 +100,10 @@ IS_SAMSUNG_CPU(exynos4210, EXYNOS4210_CPU_ID, EXYNOS4_CPU_MASK)
# define cpu_is_exynos4210() 0
#endif
+#define EXYNOS4210_REV_0 (0x0)
+#define EXYNOS4210_REV_1_0 (0x2)
+#define EXYNOS4210_REV_1_1 (0x3)
+
#define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE }
#ifndef MHZ
@@ -144,6 +148,8 @@ extern void s3c24xx_init_cpu(void);
extern void s3c64xx_init_cpu(void);
extern void s5p_init_cpu(void __iomem *cpuid_addr);
+extern unsigned int samsung_rev(void);
+
extern void s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no);
extern void s3c24xx_init_clocks(int xtal);
--
1.7.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 0/4] ARM: SAMSUNG: Add support CPU ID and Rev. at runtime
2011-08-20 5:05 [PATCH 0/4] ARM: SAMSUNG: Add support CPU ID and Rev. at runtime Kukjin Kim
` (3 preceding siblings ...)
2011-08-20 5:05 ` [PATCH 4/4] ARM: EXYNOS4: Use samsung_rev() to distinguish silicon revision Kukjin Kim
@ 2011-08-20 6:34 ` Kyungmin Park
4 siblings, 0 replies; 10+ messages in thread
From: Kyungmin Park @ 2011-08-20 6:34 UTC (permalink / raw)
To: linux-arm-kernel
Good
change the mind to use the runtime soc detection. it's really required
feature. but previous time Ben did'n like it.
https://lkml.org/lkml/2010/3/30/831
I'm still prefer to use it when only early boot time if possible
and another mail said cpu_is_* doesn't proper name, soc_is_* is better.
Thank you,
Kyungmin Park
On Sat, Aug 20, 2011 at 2:05 PM, Kukjin Kim <kgene.kim@samsung.com> wrote:
> This patch adds support handling of CPU ID and varialble silicon revision
> at runtime.
>
> [PATCH 1/4] ARM: SAMSUNG: Add support for detecting CPU at runtime
> [PATCH 2/4] ARM: S5P64X0: Use cpu_is_s5p64x0() to distinguish cpu at runtime
> [PATCH 3/4] ARM: SAMSUNG: Add support for handling of cpu revision
> [PATCH 4/4] ARM: EXYNOS4: Use samsung_rev() to distinguish silicon revision
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at ?http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/4] ARM: SAMSUNG: Add support for detecting CPU at runtime
2011-08-20 5:05 ` [PATCH 1/4] ARM: SAMSUNG: Add support for detecting CPU " Kukjin Kim
@ 2011-08-20 8:07 ` Russell King - ARM Linux
2011-08-23 1:50 ` Kukjin Kim
0 siblings, 1 reply; 10+ messages in thread
From: Russell King - ARM Linux @ 2011-08-20 8:07 UTC (permalink / raw)
To: linux-arm-kernel
On Sat, Aug 20, 2011 at 02:05:56PM +0900, Kukjin Kim wrote:
> The cpu_is_[name]() can be used to distinguish cpu at runtime.
This really should be soc_is_xxx(). The CPU is stuff like ARM920, ARM926,
Cortex-A9 etc. The SoC is the CPU plus the peripherals.
S3C6410 describes the entire SoC, not just the CPU.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/4] ARM: SAMSUNG: Add support for detecting CPU at runtime
2011-08-20 8:07 ` Russell King - ARM Linux
@ 2011-08-23 1:50 ` Kukjin Kim
0 siblings, 0 replies; 10+ messages in thread
From: Kukjin Kim @ 2011-08-23 1:50 UTC (permalink / raw)
To: linux-arm-kernel
Russell King - ARM Linux wrote:
>
> On Sat, Aug 20, 2011 at 02:05:56PM +0900, Kukjin Kim wrote:
> > The cpu_is_[name]() can be used to distinguish cpu at runtime.
>
> This really should be soc_is_xxx(). The CPU is stuff like ARM920, ARM926,
> Cortex-A9 etc. The SoC is the CPU plus the peripherals.
>
> S3C6410 describes the entire SoC, not just the CPU.
OK and will address comments from you.
Russell, I'm not sure it is required to change CPU_XXX such as
CPU_EXYNOS4210 to SOC_XXX in Kconfig.
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 3/4] ARM: SAMSUNG: Add support for handling of cpu revision
2011-08-20 5:05 ` [PATCH 3/4] ARM: SAMSUNG: Add support for handling of cpu revision Kukjin Kim
@ 2011-08-24 11:13 ` Kukjin Kim
0 siblings, 0 replies; 10+ messages in thread
From: Kukjin Kim @ 2011-08-24 11:13 UTC (permalink / raw)
To: linux-arm-kernel
Kukjin Kim wrote:
>
> This patch adds plat-samsung/cpu.c for detecting of cpu id and
> silicon revision.
>
> This patch was originally from Changhwan Youn <chaos.youn@samsung.com>
>
> Acked-by: Changhwan Youn <chaos.youn@samsung.com>
> Cc: Ben Dooks <ben-linux@fluff.org>
> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
> ---
(snip)
> +void __init s5p_init_cpu(void __iomem *cpuid_addr)
> +{
> + samsung_cpu_id = __raw_readl(cpuid_addr);
> + samsung_cpu_rev = samsung_cpu_id & 0xF;
Oops, should be 0xFF not 0xF.
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 4/4] ARM: EXYNOS4: Use samsung_rev() to distinguish silicon revision
2011-08-20 5:05 ` [PATCH 4/4] ARM: EXYNOS4: Use samsung_rev() to distinguish silicon revision Kukjin Kim
@ 2011-08-24 11:13 ` Kukjin Kim
0 siblings, 0 replies; 10+ messages in thread
From: Kukjin Kim @ 2011-08-24 11:13 UTC (permalink / raw)
To: linux-arm-kernel
Kukjin Kim wrote:
>
> This patch uses samsung_rev() to support variable silicon revision of
> EXYNOS4210 so that can support for EXYNOS4210 REV0, REV1.0 and REV1.1.
>
> Note: Need to change timer setting on REV0.
>
> Acked-by: Changhwan Youn <chaos.youn@samsung.com>
> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
> ---
(snip)
> +#define EXYNOS4210_REV_1_0 (0x2)
> +#define EXYNOS4210_REV_1_1 (0x3)
Should be following...
+#define EXYNOS4210_REV_1_0 (0x10)
+#define EXYNOS4210_REV_1_1 (0x11)
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2011-08-24 11:13 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-20 5:05 [PATCH 0/4] ARM: SAMSUNG: Add support CPU ID and Rev. at runtime Kukjin Kim
2011-08-20 5:05 ` [PATCH 1/4] ARM: SAMSUNG: Add support for detecting CPU " Kukjin Kim
2011-08-20 8:07 ` Russell King - ARM Linux
2011-08-23 1:50 ` Kukjin Kim
2011-08-20 5:05 ` [PATCH 2/4] ARM: S5P64X0: Use cpu_is_s5p64x0() to distinguish cpu " Kukjin Kim
2011-08-20 5:05 ` [PATCH 3/4] ARM: SAMSUNG: Add support for handling of cpu revision Kukjin Kim
2011-08-24 11:13 ` Kukjin Kim
2011-08-20 5:05 ` [PATCH 4/4] ARM: EXYNOS4: Use samsung_rev() to distinguish silicon revision Kukjin Kim
2011-08-24 11:13 ` Kukjin Kim
2011-08-20 6:34 ` [PATCH 0/4] ARM: SAMSUNG: Add support CPU ID and Rev. at runtime Kyungmin Park
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).