aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-s3c2410/cpu.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-s3c2410/cpu.c')
-rw-r--r--arch/arm/mach-s3c2410/cpu.c49
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
215static int nr_uarts __initdata = 0;
216
217static 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
228void __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
211void __init s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no) 256void __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;