1 diff --git a/arch/arm/plat-s3c/include/mach/cpu.h b/arch/arm/plat-s3c/include/mach/cpu.h
5 +++ b/arch/arm/plat-s3c/include/mach/cpu.h
8 + * arch/arm/plat-s3c/include/mach/cpu.h
10 + * S3C cpu type detection
12 + * Copyright (C) 2008 Samsung Electronics
13 + * Kyungmin Park <kyungmin.park@samsung.com>
15 + * Derived from OMAP cpu.h
17 + * This program is free software; you can redistribute it and/or modify
18 + * it under the terms of the GNU General Public License as published by
19 + * the Free Software Foundation; either version 2 of the License, or
20 + * (at your option) any later version.
22 + * This program is distributed in the hope that it will be useful,
23 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 + * GNU General Public License for more details.
27 + * You should have received a copy of the GNU General Public License
28 + * along with this program; if not, write to the Free Software
29 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 +#ifndef __ASM_ARCH_S3C_CPU_H
33 +#define __ASM_ARCH_S3C_CPU_H
35 +extern unsigned int system_rev;
37 +#define S3C_SYSTEM_REV_ATAG (system_rev & 0xffff)
38 +#define S3C_SYSTEM_REV_CPU (system_rev & 0xffff0000)
41 + * cpu_is_s3c24xx(): True for s3c2400, s3c2410, s3c2440 and so on
42 + * cpu_is_s3c241x(): True fro s3c2410, s3c2412
43 + * cpu_is_s3c244x(): True fro s3c2440, s3c2442, s3c2443
44 + * cpu_is_s3c64xx(): True for s3c6400, s3c6410
46 +#define GET_S3C_CLASS ((system_rev >> 24) & 0xff)
48 +#define IS_S3C_CLASS(class, id) \
49 +static inline int is_s3c ##class (void) \
51 + return (GET_S3C_CLASS == (id)) ? 1 : 0; \
54 +#define GET_S3C_SUBCLASS ((system_rev >> 20) & 0xfff)
56 +#define IS_S3C_SUBCLASS(subclass, id) \
57 +static inline int is_s3c ##subclass (void) \
59 + return (GET_S3C_SUBCLASS == (id)) ? 1 : 0; \
62 +IS_S3C_CLASS(24xx, 0x24)
63 +IS_S3C_CLASS(64xx, 0x64)
65 +IS_S3C_SUBCLASS(241x, 0x241)
66 +IS_S3C_SUBCLASS(244x, 0x244)
68 +#define cpu_is_s3c24xx() 0
69 +#define cpu_is_s3c241x() 0
70 +#define cpu_is_s3c244x() 0
71 +#define cpu_is_s3c64xx() 0
73 +#if defined(CONFIG_ARCH_S3C2410)
74 +# undef cpu_is_s3c24xx
75 +# undef cpu_is_s3c241x
76 +# undef cpu_is_s3c244x
77 +# define cpu_is_s3c24xx() is_s3c24xx()
78 +# define cpu_is_s3c241x() is_s3c241x()
79 +# define cpu_is_s3c244x() is_s3c244x()
82 +#if defined(CONFIG_ARCH_S3C64XX)
83 +# undef cpu_is_s3c64xx
84 +# define cpu_is_s3c64xx() is_s3c64xx()
88 + * Macros to detect individual cpu types.
89 + * cpu_is_s3c2410(): True for s3c2410
90 + * cpu_is_s3c2440(): True for s3c2440
91 + * cpu_is_s3c6400(): True for s3c6400
92 + * cpu_is_s3c6410(): True for s3c6410
95 + * Store Revision A to 1
96 + * s3c2410a -> s3c2411
97 + * s3c2440a -> s3c2441
100 +#define GET_S3C_TYPE ((system_rev >> 16) & 0xffff)
102 +#define IS_S3C_TYPE(type, id) \
103 +static inline int is_s3c ##type (void) \
105 + return (GET_S3C_TYPE == (id)) ? 1 : 0; \
108 +IS_S3C_TYPE(2400, 0x2400)
109 +IS_S3C_TYPE(2410, 0x2410)
110 +IS_S3C_TYPE(2410a, 0x2411)
111 +IS_S3C_TYPE(2412, 0x2412)
112 +IS_S3C_TYPE(2440, 0x2440)
113 +IS_S3C_TYPE(2440a, 0x2441)
114 +IS_S3C_TYPE(2442, 0x2442)
115 +IS_S3C_TYPE(2443, 0x2443)
116 +IS_S3C_TYPE(6400, 0x6400)
117 +IS_S3C_TYPE(6410, 0x6410)
119 +#define cpu_is_s3c2400() 0
120 +#define cpu_is_s3c2410() 0
121 +#define cpu_is_s3c2410a() 0
122 +#define cpu_is_s3c2412() 0
123 +#define cpu_is_s3c2440() 0
124 +#define cpu_is_s3c2440a() 0
125 +#define cpu_is_s3c2442() 0
126 +#define cpu_is_s3c2443() 0
127 +#define cpu_is_s3c6400() 0
128 +#define cpu_is_s3c6410() 0
130 +#if defined(CONFIG_ARCH_S3C2410)
131 +# undef cpu_is_s3c2400
132 +# define cpu_is_s3c2400() is_s3c2400()
135 +#if defined(CONFIG_CPU_S3C2410)
136 +# undef cpu_is_s3c2410
137 +# undef cpu_is_s3c2410a
138 +# define cpu_is_s3c2410() is_s3c2410()
139 +# define cpu_is_s3c2410a() is_s3c2410a()
142 +#if defined(CONFIG_CPU_S3C2412)
143 +# undef cpu_is_s3c2412
144 +# define cpu_is_s3c2412() is_s3c2412()
147 +#if defined(CONFIG_CPU_S3C2440)
148 +# undef cpu_is_s3c2440
149 +# undef cpu_is_s3c2440a
150 +# define cpu_is_s3c2440() is_s3c2440()
151 +# define cpu_is_s3c2440a() is_s3c2440a()
154 +#if defined(CONFIG_CPU_S3C2442)
155 +# undef cpu_is_s3c2442
156 +# define cpu_is_s3c2442() is_s3c2442()
159 +#if defined(CONFIG_CPU_S3C2443)
160 +# undef cpu_is_s3c2443
161 +# define cpu_is_s3c2443() is_s3c2443()
164 +#if defined(CONFIG_ARCH_S3C64XX)
165 +# undef cpu_is_s3c6400
166 +# undef cpu_is_s3c6410
167 +# define cpu_is_s3c6400() is_s3c6400()
168 +# define cpu_is_s3c6410() is_s3c6410()
172 diff --git a/arch/arm/plat-s3c/init.c b/arch/arm/plat-s3c/init.c
173 index 6790edf..c1ddac1 100644
174 --- a/arch/arm/plat-s3c/init.c
175 +++ b/arch/arm/plat-s3c/init.c
178 static struct cpu_table *cpu;
180 +static void __init set_system_rev(unsigned int idcode)
183 + * system_rev encoding is as follows
184 + * system_rev & 0xff000000 -> S3C Class (24xx/64xx)
185 + * system_rev & 0xfff00000 -> S3C Sub Class (241x/244x)
186 + * system_rev & 0xffff0000 -> S3C Type (2410/2440/6400/6410)
188 + * Remaining[15:0] are preserved from the value set by ATAG
191 + * Store Revision A to 1 such as
192 + * s3c2410A to s3c2411
193 + * s3c2440A to s3c2441
196 + system_rev &= 0xffff;
197 + system_rev |= (idcode & 0x0ffff000) << 4;
199 + if (idcode == 0x32410002 || idcode == 0x32440001)
200 + system_rev |= (0x1 << 16);
201 + if (idcode == 0x32440aaa /* s3c2442 */
202 + || idcode == 0x32440aab) /* s3c2442b */
203 + system_rev |= (0x2 << 16);
204 + if (idcode == 0x0) /* s3c2400 */
205 + system_rev |= (0x2400 << 16);
208 static struct cpu_table * __init s3c_lookup_cpu(unsigned long idcode,
209 struct cpu_table *tab,
211 @@ -53,6 +81,8 @@ void __init s3c_init_cpu(unsigned long idcode,
212 panic("Unknown S3C24XX CPU");
215 + set_system_rev(idcode);
217 printk("CPU %s (id 0x%08lx)\n", cpu->name, idcode);
219 if (cpu->map_io == NULL || cpu->init == NULL) {
220 diff --git a/arch/arm/plat-s3c24xx/cpu.c b/arch/arm/plat-s3c24xx/cpu.c
221 index 1932b7e..ed4c19f 100644
222 --- a/arch/arm/plat-s3c24xx/cpu.c
223 +++ b/arch/arm/plat-s3c24xx/cpu.c
224 @@ -61,6 +61,7 @@ static const char name_s3c2410[] = "S3C2410";
225 static const char name_s3c2412[] = "S3C2412";
226 static const char name_s3c2440[] = "S3C2440";
227 static const char name_s3c2442[] = "S3C2442";
228 +static const char name_s3c2442b[] = "S3C2442B";
229 static const char name_s3c2443[] = "S3C2443";
230 static const char name_s3c2410a[] = "S3C2410A";
231 static const char name_s3c2440a[] = "S3C2440A";
232 @@ -112,6 +113,15 @@ static struct cpu_table cpu_ids[] __initdata = {
236 + .idcode = 0x32440aab,
237 + .idmask = 0xffffffff,
238 + .map_io = s3c244x_map_io,
239 + .init_clocks = s3c244x_init_clocks,
240 + .init_uarts = s3c244x_init_uarts,
241 + .init = s3c2442_init,
242 + .name = name_s3c2442b
245 .idcode = 0x32412001,
246 .idmask = 0xffffffff,
247 .map_io = s3c2412_map_io,