diff options
Diffstat (limited to 'arch/arm/mach-s3c2410/cpu.c')
-rw-r--r-- | arch/arm/mach-s3c2410/cpu.c | 77 |
1 files changed, 69 insertions, 8 deletions
diff --git a/arch/arm/mach-s3c2410/cpu.c b/arch/arm/mach-s3c2410/cpu.c index 70c34fcf7858..52842e6e86e6 100644 --- a/arch/arm/mach-s3c2410/cpu.c +++ b/arch/arm/mach-s3c2410/cpu.c | |||
@@ -37,12 +37,16 @@ | |||
37 | #include <asm/mach/map.h> | 37 | #include <asm/mach/map.h> |
38 | 38 | ||
39 | #include <asm/arch/regs-gpio.h> | 39 | #include <asm/arch/regs-gpio.h> |
40 | #include <asm/arch/regs-serial.h> | ||
40 | 41 | ||
41 | #include "cpu.h" | 42 | #include "cpu.h" |
43 | #include "devs.h" | ||
42 | #include "clock.h" | 44 | #include "clock.h" |
43 | #include "s3c2400.h" | 45 | #include "s3c2400.h" |
44 | #include "s3c2410.h" | 46 | #include "s3c2410.h" |
47 | #include "s3c244x.h" | ||
45 | #include "s3c2440.h" | 48 | #include "s3c2440.h" |
49 | #include "s3c2442.h" | ||
46 | 50 | ||
47 | struct cpu_table { | 51 | struct cpu_table { |
48 | unsigned long idcode; | 52 | unsigned long idcode; |
@@ -59,6 +63,7 @@ struct cpu_table { | |||
59 | static const char name_s3c2400[] = "S3C2400"; | 63 | static const char name_s3c2400[] = "S3C2400"; |
60 | static const char name_s3c2410[] = "S3C2410"; | 64 | static const char name_s3c2410[] = "S3C2410"; |
61 | static const char name_s3c2440[] = "S3C2440"; | 65 | static const char name_s3c2440[] = "S3C2440"; |
66 | static const char name_s3c2442[] = "S3C2442"; | ||
62 | static const char name_s3c2410a[] = "S3C2410A"; | 67 | static const char name_s3c2410a[] = "S3C2410A"; |
63 | static const char name_s3c2440a[] = "S3C2440A"; | 68 | static const char name_s3c2440a[] = "S3C2440A"; |
64 | 69 | ||
@@ -84,22 +89,31 @@ static struct cpu_table cpu_ids[] __initdata = { | |||
84 | { | 89 | { |
85 | .idcode = 0x32440000, | 90 | .idcode = 0x32440000, |
86 | .idmask = 0xffffffff, | 91 | .idmask = 0xffffffff, |
87 | .map_io = s3c2440_map_io, | 92 | .map_io = s3c244x_map_io, |
88 | .init_clocks = s3c2440_init_clocks, | 93 | .init_clocks = s3c244x_init_clocks, |
89 | .init_uarts = s3c2440_init_uarts, | 94 | .init_uarts = s3c244x_init_uarts, |
90 | .init = s3c2440_init, | 95 | .init = s3c2440_init, |
91 | .name = name_s3c2440 | 96 | .name = name_s3c2440 |
92 | }, | 97 | }, |
93 | { | 98 | { |
94 | .idcode = 0x32440001, | 99 | .idcode = 0x32440001, |
95 | .idmask = 0xffffffff, | 100 | .idmask = 0xffffffff, |
96 | .map_io = s3c2440_map_io, | 101 | .map_io = s3c244x_map_io, |
97 | .init_clocks = s3c2440_init_clocks, | 102 | .init_clocks = s3c244x_init_clocks, |
98 | .init_uarts = s3c2440_init_uarts, | 103 | .init_uarts = s3c244x_init_uarts, |
99 | .init = s3c2440_init, | 104 | .init = s3c2440_init, |
100 | .name = name_s3c2440a | 105 | .name = name_s3c2440a |
101 | }, | 106 | }, |
102 | { | 107 | { |
108 | .idcode = 0x32440aaa, | ||
109 | .idmask = 0xffffffff, | ||
110 | .map_io = s3c244x_map_io, | ||
111 | .init_clocks = s3c244x_init_clocks, | ||
112 | .init_uarts = s3c244x_init_uarts, | ||
113 | .init = s3c2442_init, | ||
114 | .name = name_s3c2442 | ||
115 | }, | ||
116 | { | ||
103 | .idcode = 0x0, /* S3C2400 doesn't have an idcode */ | 117 | .idcode = 0x0, /* S3C2400 doesn't have an idcode */ |
104 | .idmask = 0xffffffff, | 118 | .idmask = 0xffffffff, |
105 | .map_io = s3c2400_map_io, | 119 | .map_io = s3c2400_map_io, |
@@ -175,13 +189,13 @@ void __init s3c24xx_init_io(struct map_desc *mach_desc, int size) | |||
175 | panic("Unknown S3C24XX CPU"); | 189 | panic("Unknown S3C24XX CPU"); |
176 | } | 190 | } |
177 | 191 | ||
192 | printk("CPU %s (id 0x%08lx)\n", cpu->name, idcode); | ||
193 | |||
178 | if (cpu->map_io == NULL || cpu->init == NULL) { | 194 | if (cpu->map_io == NULL || cpu->init == NULL) { |
179 | printk(KERN_ERR "CPU %s support not enabled\n", cpu->name); | 195 | printk(KERN_ERR "CPU %s support not enabled\n", cpu->name); |
180 | panic("Unsupported S3C24XX CPU"); | 196 | panic("Unsupported S3C24XX CPU"); |
181 | } | 197 | } |
182 | 198 | ||
183 | printk("CPU %s (id 0x%08lx)\n", cpu->name, idcode); | ||
184 | |||
185 | (cpu->map_io)(mach_desc, size); | 199 | (cpu->map_io)(mach_desc, size); |
186 | } | 200 | } |
187 | 201 | ||
@@ -208,6 +222,49 @@ void __init s3c24xx_init_clocks(int xtal) | |||
208 | (cpu->init_clocks)(xtal); | 222 | (cpu->init_clocks)(xtal); |
209 | } | 223 | } |
210 | 224 | ||
225 | /* uart management */ | ||
226 | |||
227 | static int nr_uarts __initdata = 0; | ||
228 | |||
229 | static struct s3c2410_uartcfg uart_cfgs[3]; | ||
230 | |||
231 | /* s3c24xx_init_uartdevs | ||
232 | * | ||
233 | * copy the specified platform data and configuration into our central | ||
234 | * set of devices, before the data is thrown away after the init process. | ||
235 | * | ||
236 | * This also fills in the array passed to the serial driver for the | ||
237 | * early initialisation of the console. | ||
238 | */ | ||
239 | |||
240 | void __init s3c24xx_init_uartdevs(char *name, | ||
241 | struct s3c24xx_uart_resources *res, | ||
242 | struct s3c2410_uartcfg *cfg, int no) | ||
243 | { | ||
244 | struct platform_device *platdev; | ||
245 | struct s3c2410_uartcfg *cfgptr = uart_cfgs; | ||
246 | struct s3c24xx_uart_resources *resp; | ||
247 | int uart; | ||
248 | |||
249 | memcpy(cfgptr, cfg, sizeof(struct s3c2410_uartcfg) * no); | ||
250 | |||
251 | for (uart = 0; uart < no; uart++, cfg++, cfgptr++) { | ||
252 | platdev = s3c24xx_uart_src[cfgptr->hwport]; | ||
253 | |||
254 | resp = res + cfgptr->hwport; | ||
255 | |||
256 | s3c24xx_uart_devs[uart] = platdev; | ||
257 | |||
258 | platdev->name = name; | ||
259 | platdev->resource = resp->resources; | ||
260 | platdev->num_resources = resp->nr_resources; | ||
261 | |||
262 | platdev->dev.platform_data = cfgptr; | ||
263 | } | ||
264 | |||
265 | nr_uarts = no; | ||
266 | } | ||
267 | |||
211 | void __init s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no) | 268 | void __init s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no) |
212 | { | 269 | { |
213 | if (cpu == NULL) | 270 | if (cpu == NULL) |
@@ -232,6 +289,10 @@ static int __init s3c_arch_init(void) | |||
232 | if (ret != 0) | 289 | if (ret != 0) |
233 | return ret; | 290 | return ret; |
234 | 291 | ||
292 | ret = platform_add_devices(s3c24xx_uart_devs, nr_uarts); | ||
293 | if (ret != 0) | ||
294 | return ret; | ||
295 | |||
235 | if (board != NULL) { | 296 | if (board != NULL) { |
236 | struct platform_device **ptr = board->devices; | 297 | struct platform_device **ptr = board->devices; |
237 | int i; | 298 | int i; |