diff options
author | Ben Dooks <ben-linux@fluff.org> | 2006-06-18 18:04:05 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-06-18 18:04:05 -0400 |
commit | 66a9b49a370baac75d90b7da9a2445997a8a9438 (patch) | |
tree | 62b22d1559c1c1d1e02428f27c08dca0fb66aa83 /arch/arm/mach-s3c2410/cpu.c | |
parent | 810c894f2b27b634883723f9fee10a7cf1d0bcb4 (diff) |
[ARM] 3557/1: S3C24XX: centralise and cleanup uart registration
Patch from Ben Dooks
All the S3C24XX based devices currently have similar
uart blocks, in the same location. Make the process
of adding new uart blocks easier by commonising the
device definitions and adding a new init function
for the cpu code.
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-s3c2410/cpu.c')
-rw-r--r-- | arch/arm/mach-s3c2410/cpu.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/arch/arm/mach-s3c2410/cpu.c b/arch/arm/mach-s3c2410/cpu.c index 987d34c9ea99..acc58adfbd21 100644 --- a/arch/arm/mach-s3c2410/cpu.c +++ b/arch/arm/mach-s3c2410/cpu.c | |||
@@ -37,8 +37,10 @@ | |||
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" |
@@ -208,6 +210,49 @@ void __init s3c24xx_init_clocks(int xtal) | |||
208 | (cpu->init_clocks)(xtal); | 210 | (cpu->init_clocks)(xtal); |
209 | } | 211 | } |
210 | 212 | ||
213 | /* uart management */ | ||
214 | |||
215 | static int nr_uarts __initdata = 0; | ||
216 | |||
217 | static struct s3c2410_uartcfg uart_cfgs[3]; | ||
218 | |||
219 | /* s3c24xx_init_uartdevs | ||
220 | * | ||
221 | * copy the specified platform data and configuration into our central | ||
222 | * set of devices, before the data is thrown away after the init process. | ||
223 | * | ||
224 | * This also fills in the array passed to the serial driver for the | ||
225 | * early initialisation of the console. | ||
226 | */ | ||
227 | |||
228 | void __init s3c24xx_init_uartdevs(char *name, | ||
229 | struct s3c24xx_uart_resources *res, | ||
230 | struct s3c2410_uartcfg *cfg, int no) | ||
231 | { | ||
232 | struct platform_device *platdev; | ||
233 | struct s3c2410_uartcfg *cfgptr = uart_cfgs; | ||
234 | struct s3c24xx_uart_resources *resp; | ||
235 | int uart; | ||
236 | |||
237 | memcpy(cfgptr, cfg, sizeof(struct s3c2410_uartcfg) * no); | ||
238 | |||
239 | for (uart = 0; uart < no; uart++, cfg++, cfgptr++) { | ||
240 | platdev = s3c24xx_uart_src[cfgptr->hwport]; | ||
241 | |||
242 | resp = res + cfgptr->hwport; | ||
243 | |||
244 | s3c24xx_uart_devs[uart] = platdev; | ||
245 | |||
246 | platdev->name = name; | ||
247 | platdev->resource = resp->resources; | ||
248 | platdev->num_resources = resp->nr_resources; | ||
249 | |||
250 | platdev->dev.platform_data = cfgptr; | ||
251 | } | ||
252 | |||
253 | nr_uarts = no; | ||
254 | } | ||
255 | |||
211 | void __init s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no) | 256 | void __init s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no) |
212 | { | 257 | { |
213 | if (cpu == NULL) | 258 | if (cpu == NULL) |
@@ -232,6 +277,10 @@ static int __init s3c_arch_init(void) | |||
232 | if (ret != 0) | 277 | if (ret != 0) |
233 | return ret; | 278 | return ret; |
234 | 279 | ||
280 | ret = platform_add_devices(s3c24xx_uart_devs, nr_uarts); | ||
281 | if (ret != 0) | ||
282 | return ret; | ||
283 | |||
235 | if (board != NULL) { | 284 | if (board != NULL) { |
236 | struct platform_device **ptr = board->devices; | 285 | struct platform_device **ptr = board->devices; |
237 | int i; | 286 | int i; |