Linux-2.6.12-rc2
[pandora-kernel.git] / arch / arm / mach-s3c2410 / mach-smdk2440.c
1 /* linux/arch/arm/mach-s3c2410/mach-smdk2440.c
2  *
3  * Copyright (c) 2004,2005 Simtec Electronics
4  *      Ben Dooks <ben@simtec.co.uk>
5  *
6  * http://www.fluff.org/ben/smdk2440/
7  *
8  * Thanks to Dimity Andric and TomTom for the loan of an SMDK2440.
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License version 2 as
12  * published by the Free Software Foundation.
13  *
14  * Modifications:
15  *      01-Nov-2004 BJD   Initial version
16  *      12-Nov-2004 BJD   Updated for release
17  *      04-Jan-2005 BJD   Fixes for pre-release
18  *      22-Feb-2005 BJD   Updated for 2.6.11-rc5 relesa
19  *      10-Mar-2005 LCVR  Replaced S3C2410_VA by S3C24XX_VA
20  *      14-Mar-2005 BJD   void __iomem fixes
21 */
22
23 #include <linux/kernel.h>
24 #include <linux/types.h>
25 #include <linux/interrupt.h>
26 #include <linux/list.h>
27 #include <linux/timer.h>
28 #include <linux/init.h>
29
30 #include <asm/mach/arch.h>
31 #include <asm/mach/map.h>
32 #include <asm/mach/irq.h>
33
34 #include <asm/hardware.h>
35 #include <asm/hardware/iomd.h>
36 #include <asm/io.h>
37 #include <asm/irq.h>
38 #include <asm/mach-types.h>
39
40 //#include <asm/debug-ll.h>
41 #include <asm/arch/regs-serial.h>
42 #include <asm/arch/regs-gpio.h>
43 #include <asm/arch/idle.h>
44
45 #include "s3c2410.h"
46 #include "s3c2440.h"
47 #include "clock.h"
48 #include "devs.h"
49 #include "cpu.h"
50 #include "pm.h"
51
52 static struct map_desc smdk2440_iodesc[] __initdata = {
53         /* ISA IO Space map (memory space selected by A24) */
54
55         { (u32)S3C24XX_VA_ISA_WORD, S3C2410_CS2, SZ_16M, MT_DEVICE },
56         { (u32)S3C24XX_VA_ISA_BYTE, S3C2410_CS2, SZ_16M, MT_DEVICE },
57 };
58
59 #define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
60 #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
61 #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
62
63 static struct s3c2410_uartcfg smdk2440_uartcfgs[] = {
64         [0] = {
65                 .hwport      = 0,
66                 .flags       = 0,
67                 .ucon        = 0x3c5,
68                 .ulcon       = 0x03,
69                 .ufcon       = 0x51,
70         },
71         [1] = {
72                 .hwport      = 1,
73                 .flags       = 0,
74                 .ucon        = 0x3c5,
75                 .ulcon       = 0x03,
76                 .ufcon       = 0x51,
77         },
78         /* IR port */
79         [2] = {
80                 .hwport      = 2,
81                 .flags       = 0,
82                 .ucon        = 0x3c5,
83                 .ulcon       = 0x43,
84                 .ufcon       = 0x51,
85         }
86 };
87
88 static struct platform_device *smdk2440_devices[] __initdata = {
89         &s3c_device_usb,
90         &s3c_device_lcd,
91         &s3c_device_wdt,
92         &s3c_device_i2c,
93         &s3c_device_iis,
94 };
95
96 static struct s3c24xx_board smdk2440_board __initdata = {
97         .devices       = smdk2440_devices,
98         .devices_count = ARRAY_SIZE(smdk2440_devices)
99 };
100
101 void __init smdk2440_map_io(void)
102 {
103         s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc));
104         s3c24xx_init_clocks(16934400);
105         s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs));
106         s3c24xx_set_board(&smdk2440_board);
107 }
108
109 void __init smdk2440_machine_init(void)
110 {
111         /* Configure the LEDs (even if we have no LED support)*/
112
113         s3c2410_gpio_cfgpin(S3C2410_GPF4, S3C2410_GPF4_OUTP);
114         s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP);
115         s3c2410_gpio_cfgpin(S3C2410_GPF6, S3C2410_GPF6_OUTP);
116         s3c2410_gpio_cfgpin(S3C2410_GPF7, S3C2410_GPF7_OUTP);
117
118         s3c2410_gpio_setpin(S3C2410_GPF4, 0);
119         s3c2410_gpio_setpin(S3C2410_GPF5, 0);
120         s3c2410_gpio_setpin(S3C2410_GPF6, 0);
121         s3c2410_gpio_setpin(S3C2410_GPF7, 0);
122
123         s3c2410_pm_init();
124 }
125
126 MACHINE_START(S3C2440, "SMDK2440")
127         MAINTAINER("Ben Dooks <ben@fluff.org>")
128         BOOT_MEM(S3C2410_SDRAM_PA, S3C2410_PA_UART, (u32)S3C24XX_VA_UART)
129         BOOT_PARAMS(S3C2410_SDRAM_PA + 0x100)
130
131         .init_irq       = s3c24xx_init_irq,
132         .map_io         = smdk2440_map_io,
133         .init_machine   = smdk2440_machine_init,
134         .timer          = &s3c24xx_timer,
135 MACHINE_END