aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Dooks <ben-linux@fluff.org>2006-06-18 18:04:05 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2006-06-18 18:04:05 -0400
commit66a9b49a370baac75d90b7da9a2445997a8a9438 (patch)
tree62b22d1559c1c1d1e02428f27c08dca0fb66aa83
parent810c894f2b27b634883723f9fee10a7cf1d0bcb4 (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>
-rw-r--r--arch/arm/mach-s3c2410/cpu.c49
-rw-r--r--arch/arm/mach-s3c2410/cpu.h6
-rw-r--r--arch/arm/mach-s3c2410/devs.c78
-rw-r--r--arch/arm/mach-s3c2410/devs.h8
-rw-r--r--arch/arm/mach-s3c2410/mach-anubis.c2
-rw-r--r--arch/arm/mach-s3c2410/mach-bast.c2
-rw-r--r--arch/arm/mach-s3c2410/mach-h1940.c2
-rw-r--r--arch/arm/mach-s3c2410/mach-nexcoder.c2
-rw-r--r--arch/arm/mach-s3c2410/mach-osiris.c3
-rw-r--r--arch/arm/mach-s3c2410/mach-otom.c2
-rw-r--r--arch/arm/mach-s3c2410/mach-smdk2410.c2
-rw-r--r--arch/arm/mach-s3c2410/mach-smdk2440.c2
-rw-r--r--arch/arm/mach-s3c2410/mach-vr1000.c2
-rw-r--r--arch/arm/mach-s3c2410/s3c2410.c85
-rw-r--r--arch/arm/mach-s3c2410/s3c2440.c94
15 files changed, 154 insertions, 185 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;
diff --git a/arch/arm/mach-s3c2410/cpu.h b/arch/arm/mach-s3c2410/cpu.h
index fc1067783f6d..0c776acb063a 100644
--- a/arch/arm/mach-s3c2410/cpu.h
+++ b/arch/arm/mach-s3c2410/cpu.h
@@ -31,6 +31,8 @@
31#define print_mhz(m) ((m) / MHZ), ((m / 1000) % 1000) 31#define print_mhz(m) ((m) / MHZ), ((m / 1000) % 1000)
32 32
33/* forward declaration */ 33/* forward declaration */
34struct s3c24xx_uart_resources;
35struct platform_device;
34struct s3c2410_uartcfg; 36struct s3c2410_uartcfg;
35struct map_desc; 37struct map_desc;
36 38
@@ -44,6 +46,10 @@ extern void s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no);
44 46
45extern void s3c24xx_init_clocks(int xtal); 47extern void s3c24xx_init_clocks(int xtal);
46 48
49extern void s3c24xx_init_uartdevs(char *name,
50 struct s3c24xx_uart_resources *res,
51 struct s3c2410_uartcfg *cfg, int no);
52
47/* the board structure is used at first initialsation time 53/* the board structure is used at first initialsation time
48 * to get info such as the devices to register for this 54 * to get info such as the devices to register for this
49 * board. This is done because platfrom_add_devices() cannot 55 * board. This is done because platfrom_add_devices() cannot
diff --git a/arch/arm/mach-s3c2410/devs.c b/arch/arm/mach-s3c2410/devs.c
index ca09ba516e4c..ad3845e329ba 100644
--- a/arch/arm/mach-s3c2410/devs.c
+++ b/arch/arm/mach-s3c2410/devs.c
@@ -38,10 +38,86 @@
38#include <asm/arch/regs-serial.h> 38#include <asm/arch/regs-serial.h>
39 39
40#include "devs.h" 40#include "devs.h"
41#include "cpu.h"
41 42
42/* Serial port registrations */ 43/* Serial port registrations */
43 44
44struct platform_device *s3c24xx_uart_devs[3]; 45static struct resource s3c2410_uart0_resource[] = {
46 [0] = {
47 .start = S3C2410_PA_UART0,
48 .end = S3C2410_PA_UART0 + 0x3fff,
49 .flags = IORESOURCE_MEM,
50 },
51 [1] = {
52 .start = IRQ_S3CUART_RX0,
53 .end = IRQ_S3CUART_ERR0,
54 .flags = IORESOURCE_IRQ,
55 }
56};
57
58static struct resource s3c2410_uart1_resource[] = {
59 [0] = {
60 .start = S3C2410_PA_UART1,
61 .end = S3C2410_PA_UART1 + 0x3fff,
62 .flags = IORESOURCE_MEM,
63 },
64 [1] = {
65 .start = IRQ_S3CUART_RX1,
66 .end = IRQ_S3CUART_ERR1,
67 .flags = IORESOURCE_IRQ,
68 }
69};
70
71static struct resource s3c2410_uart2_resource[] = {
72 [0] = {
73 .start = S3C2410_PA_UART2,
74 .end = S3C2410_PA_UART2 + 0x3fff,
75 .flags = IORESOURCE_MEM,
76 },
77 [1] = {
78 .start = IRQ_S3CUART_RX2,
79 .end = IRQ_S3CUART_ERR2,
80 .flags = IORESOURCE_IRQ,
81 }
82};
83
84struct s3c24xx_uart_resources s3c2410_uart_resources[] __initdata = {
85 [0] = {
86 .resources = s3c2410_uart0_resource,
87 .nr_resources = ARRAY_SIZE(s3c2410_uart0_resource),
88 },
89 [1] = {
90 .resources = s3c2410_uart1_resource,
91 .nr_resources = ARRAY_SIZE(s3c2410_uart1_resource),
92 },
93 [2] = {
94 .resources = s3c2410_uart2_resource,
95 .nr_resources = ARRAY_SIZE(s3c2410_uart2_resource),
96 },
97};
98
99/* yart devices */
100
101static struct platform_device s3c24xx_uart_device0 = {
102 .id = 0,
103};
104
105static struct platform_device s3c24xx_uart_device1 = {
106 .id = 1,
107};
108
109static struct platform_device s3c24xx_uart_device2 = {
110 .id = 2,
111};
112
113struct platform_device *s3c24xx_uart_src[3] = {
114 &s3c24xx_uart_device0,
115 &s3c24xx_uart_device1,
116 &s3c24xx_uart_device2,
117};
118
119struct platform_device *s3c24xx_uart_devs[3] = {
120};
45 121
46/* USB Host Controller */ 122/* USB Host Controller */
47 123
diff --git a/arch/arm/mach-s3c2410/devs.h b/arch/arm/mach-s3c2410/devs.h
index 52c4bab5c761..fa124ed920e0 100644
--- a/arch/arm/mach-s3c2410/devs.h
+++ b/arch/arm/mach-s3c2410/devs.h
@@ -17,7 +17,15 @@
17#include <linux/config.h> 17#include <linux/config.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19 19
20struct s3c24xx_uart_resources {
21 struct resource *resources;
22 unsigned long nr_resources;
23};
24
25extern struct s3c24xx_uart_resources s3c2410_uart_resources[];
26
20extern struct platform_device *s3c24xx_uart_devs[]; 27extern struct platform_device *s3c24xx_uart_devs[];
28extern struct platform_device *s3c24xx_uart_src[];
21 29
22extern struct platform_device s3c_device_usb; 30extern struct platform_device s3c_device_usb;
23extern struct platform_device s3c_device_lcd; 31extern struct platform_device s3c_device_lcd;
diff --git a/arch/arm/mach-s3c2410/mach-anubis.c b/arch/arm/mach-s3c2410/mach-anubis.c
index cc97fbf66291..52bf718137d4 100644
--- a/arch/arm/mach-s3c2410/mach-anubis.c
+++ b/arch/arm/mach-s3c2410/mach-anubis.c
@@ -131,7 +131,7 @@ static struct s3c24xx_uart_clksrc anubis_serial_clocks[] = {
131}; 131};
132 132
133 133
134static struct s3c2410_uartcfg anubis_uartcfgs[] = { 134static struct s3c2410_uartcfg anubis_uartcfgs[] __initdata = {
135 [0] = { 135 [0] = {
136 .hwport = 0, 136 .hwport = 0,
137 .flags = 0, 137 .flags = 0,
diff --git a/arch/arm/mach-s3c2410/mach-bast.c b/arch/arm/mach-s3c2410/mach-bast.c
index 995bb8add331..947234df8160 100644
--- a/arch/arm/mach-s3c2410/mach-bast.c
+++ b/arch/arm/mach-s3c2410/mach-bast.c
@@ -208,7 +208,7 @@ static struct s3c24xx_uart_clksrc bast_serial_clocks[] = {
208}; 208};
209 209
210 210
211static struct s3c2410_uartcfg bast_uartcfgs[] = { 211static struct s3c2410_uartcfg bast_uartcfgs[] __initdata = {
212 [0] = { 212 [0] = {
213 .hwport = 0, 213 .hwport = 0,
214 .flags = 0, 214 .flags = 0,
diff --git a/arch/arm/mach-s3c2410/mach-h1940.c b/arch/arm/mach-s3c2410/mach-h1940.c
index 646a3a5d33a5..aec431b2830a 100644
--- a/arch/arm/mach-s3c2410/mach-h1940.c
+++ b/arch/arm/mach-s3c2410/mach-h1940.c
@@ -72,7 +72,7 @@ static struct map_desc h1940_iodesc[] __initdata = {
72#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB 72#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
73#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE 73#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
74 74
75static struct s3c2410_uartcfg h1940_uartcfgs[] = { 75static struct s3c2410_uartcfg h1940_uartcfgs[] __initdata = {
76 [0] = { 76 [0] = {
77 .hwport = 0, 77 .hwport = 0,
78 .flags = 0, 78 .flags = 0,
diff --git a/arch/arm/mach-s3c2410/mach-nexcoder.c b/arch/arm/mach-s3c2410/mach-nexcoder.c
index 07d09509a626..065a1d4e860b 100644
--- a/arch/arm/mach-s3c2410/mach-nexcoder.c
+++ b/arch/arm/mach-s3c2410/mach-nexcoder.c
@@ -51,7 +51,7 @@ static struct map_desc nexcoder_iodesc[] __initdata = {
51#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB 51#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
52#define UFCON S3C2410_UFCON_RXTRIG12 | S3C2410_UFCON_FIFOMODE 52#define UFCON S3C2410_UFCON_RXTRIG12 | S3C2410_UFCON_FIFOMODE
53 53
54static struct s3c2410_uartcfg nexcoder_uartcfgs[] = { 54static struct s3c2410_uartcfg nexcoder_uartcfgs[] __initdata = {
55 [0] = { 55 [0] = {
56 .hwport = 0, 56 .hwport = 0,
57 .flags = 0, 57 .flags = 0,
diff --git a/arch/arm/mach-s3c2410/mach-osiris.c b/arch/arm/mach-s3c2410/mach-osiris.c
index 49f715a7b273..858fd03c6bc5 100644
--- a/arch/arm/mach-s3c2410/mach-osiris.c
+++ b/arch/arm/mach-s3c2410/mach-osiris.c
@@ -95,8 +95,7 @@ static struct s3c24xx_uart_clksrc osiris_serial_clocks[] = {
95 } 95 }
96}; 96};
97 97
98 98static struct s3c2410_uartcfg osiris_uartcfgs[] __initdata = {
99static struct s3c2410_uartcfg osiris_uartcfgs[] = {
100 [0] = { 99 [0] = {
101 .hwport = 0, 100 .hwport = 0,
102 .flags = 0, 101 .flags = 0,
diff --git a/arch/arm/mach-s3c2410/mach-otom.c b/arch/arm/mach-s3c2410/mach-otom.c
index b39daedf93ca..c71673fd9955 100644
--- a/arch/arm/mach-s3c2410/mach-otom.c
+++ b/arch/arm/mach-s3c2410/mach-otom.c
@@ -45,7 +45,7 @@ static struct map_desc otom11_iodesc[] __initdata = {
45#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB 45#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
46#define UFCON S3C2410_UFCON_RXTRIG12 | S3C2410_UFCON_FIFOMODE 46#define UFCON S3C2410_UFCON_RXTRIG12 | S3C2410_UFCON_FIFOMODE
47 47
48static struct s3c2410_uartcfg otom11_uartcfgs[] = { 48static struct s3c2410_uartcfg otom11_uartcfgs[] __initdata = {
49 [0] = { 49 [0] = {
50 .hwport = 0, 50 .hwport = 0,
51 .flags = 0, 51 .flags = 0,
diff --git a/arch/arm/mach-s3c2410/mach-smdk2410.c b/arch/arm/mach-s3c2410/mach-smdk2410.c
index 2db932d72c5a..25f7e9f4dcee 100644
--- a/arch/arm/mach-s3c2410/mach-smdk2410.c
+++ b/arch/arm/mach-s3c2410/mach-smdk2410.c
@@ -65,7 +65,7 @@ static struct map_desc smdk2410_iodesc[] __initdata = {
65#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB 65#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
66#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE 66#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
67 67
68static struct s3c2410_uartcfg smdk2410_uartcfgs[] = { 68static struct s3c2410_uartcfg smdk2410_uartcfgs[] __initdata = {
69 [0] = { 69 [0] = {
70 .hwport = 0, 70 .hwport = 0,
71 .flags = 0, 71 .flags = 0,
diff --git a/arch/arm/mach-s3c2410/mach-smdk2440.c b/arch/arm/mach-s3c2410/mach-smdk2440.c
index 5fffd1d51047..d661c6b7ff56 100644
--- a/arch/arm/mach-s3c2410/mach-smdk2440.c
+++ b/arch/arm/mach-s3c2410/mach-smdk2440.c
@@ -86,7 +86,7 @@ static struct map_desc smdk2440_iodesc[] __initdata = {
86#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB 86#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
87#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE 87#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
88 88
89static struct s3c2410_uartcfg smdk2440_uartcfgs[] = { 89static struct s3c2410_uartcfg smdk2440_uartcfgs[] __initdata = {
90 [0] = { 90 [0] = {
91 .hwport = 0, 91 .hwport = 0,
92 .flags = 0, 92 .flags = 0,
diff --git a/arch/arm/mach-s3c2410/mach-vr1000.c b/arch/arm/mach-s3c2410/mach-vr1000.c
index 785fc9cdcf7c..d18efb279d3d 100644
--- a/arch/arm/mach-s3c2410/mach-vr1000.c
+++ b/arch/arm/mach-s3c2410/mach-vr1000.c
@@ -166,7 +166,7 @@ static struct s3c24xx_uart_clksrc vr1000_serial_clocks[] = {
166 } 166 }
167}; 167};
168 168
169static struct s3c2410_uartcfg vr1000_uartcfgs[] = { 169static struct s3c2410_uartcfg vr1000_uartcfgs[] __initdata = {
170 [0] = { 170 [0] = {
171 .hwport = 0, 171 .hwport = 0,
172 .flags = 0, 172 .flags = 0,
diff --git a/arch/arm/mach-s3c2410/s3c2410.c b/arch/arm/mach-s3c2410/s3c2410.c
index 0a2013a76549..0852e87a79c4 100644
--- a/arch/arm/mach-s3c2410/s3c2410.c
+++ b/arch/arm/mach-s3c2410/s3c2410.c
@@ -42,6 +42,7 @@
42 42
43#include "s3c2410.h" 43#include "s3c2410.h"
44#include "cpu.h" 44#include "cpu.h"
45#include "devs.h"
45#include "clock.h" 46#include "clock.h"
46 47
47/* Initial IO mappings */ 48/* Initial IO mappings */
@@ -55,93 +56,13 @@ static struct map_desc s3c2410_iodesc[] __initdata = {
55 IODESC_ENT(WATCHDOG), 56 IODESC_ENT(WATCHDOG),
56}; 57};
57 58
58static struct resource s3c_uart0_resource[] = {
59 [0] = {
60 .start = S3C2410_PA_UART0,
61 .end = S3C2410_PA_UART0 + 0x3fff,
62 .flags = IORESOURCE_MEM,
63 },
64 [1] = {
65 .start = IRQ_S3CUART_RX0,
66 .end = IRQ_S3CUART_ERR0,
67 .flags = IORESOURCE_IRQ,
68 }
69
70};
71
72static struct resource s3c_uart1_resource[] = {
73 [0] = {
74 .start = S3C2410_PA_UART1,
75 .end = S3C2410_PA_UART1 + 0x3fff,
76 .flags = IORESOURCE_MEM,
77 },
78 [1] = {
79 .start = IRQ_S3CUART_RX1,
80 .end = IRQ_S3CUART_ERR1,
81 .flags = IORESOURCE_IRQ,
82 }
83};
84
85static struct resource s3c_uart2_resource[] = {
86 [0] = {
87 .start = S3C2410_PA_UART2,
88 .end = S3C2410_PA_UART2 + 0x3fff,
89 .flags = IORESOURCE_MEM,
90 },
91 [1] = {
92 .start = IRQ_S3CUART_RX2,
93 .end = IRQ_S3CUART_ERR2,
94 .flags = IORESOURCE_IRQ,
95 }
96};
97
98/* our uart devices */ 59/* our uart devices */
99 60
100static struct platform_device s3c_uart0 = {
101 .name = "s3c2410-uart",
102 .id = 0,
103 .num_resources = ARRAY_SIZE(s3c_uart0_resource),
104 .resource = s3c_uart0_resource,
105};
106
107
108static struct platform_device s3c_uart1 = {
109 .name = "s3c2410-uart",
110 .id = 1,
111 .num_resources = ARRAY_SIZE(s3c_uart1_resource),
112 .resource = s3c_uart1_resource,
113};
114
115static struct platform_device s3c_uart2 = {
116 .name = "s3c2410-uart",
117 .id = 2,
118 .num_resources = ARRAY_SIZE(s3c_uart2_resource),
119 .resource = s3c_uart2_resource,
120};
121
122static struct platform_device *uart_devices[] __initdata = {
123 &s3c_uart0,
124 &s3c_uart1,
125 &s3c_uart2
126};
127
128static int s3c2410_uart_count = 0;
129
130/* uart registration process */ 61/* uart registration process */
131 62
132void __init s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no) 63void __init s3c2410_init_uarts(struct s3c2410_uartcfg *cfg, int no)
133{ 64{
134 struct platform_device *platdev; 65 s3c24xx_init_uartdevs("s3c2410-uart", s3c2410_uart_resources, cfg, no);
135 int uart;
136
137 for (uart = 0; uart < no; uart++, cfg++) {
138 platdev = uart_devices[cfg->hwport];
139
140 s3c24xx_uart_devs[uart] = platdev;
141 platdev->dev.platform_data = cfg;
142 }
143
144 s3c2410_uart_count = uart;
145} 66}
146 67
147/* s3c2410_map_io 68/* s3c2410_map_io
@@ -193,5 +114,5 @@ int __init s3c2410_init(void)
193{ 114{
194 printk("S3C2410: Initialising architecture\n"); 115 printk("S3C2410: Initialising architecture\n");
195 116
196 return platform_add_devices(s3c24xx_uart_devs, s3c2410_uart_count); 117 return 0;
197} 118}
diff --git a/arch/arm/mach-s3c2410/s3c2440.c b/arch/arm/mach-s3c2410/s3c2440.c
index b7fe6d9453fb..54681740f9f1 100644
--- a/arch/arm/mach-s3c2410/s3c2440.c
+++ b/arch/arm/mach-s3c2410/s3c2440.c
@@ -60,95 +60,13 @@ static struct map_desc s3c2440_iodesc[] __initdata = {
60 IODESC_ENT(WATCHDOG), 60 IODESC_ENT(WATCHDOG),
61}; 61};
62 62
63static struct resource s3c_uart0_resource[] = {
64 [0] = {
65 .start = S3C2410_PA_UART0,
66 .end = S3C2410_PA_UART0 + 0x3fff,
67 .flags = IORESOURCE_MEM,
68 },
69 [1] = {
70 .start = IRQ_S3CUART_RX0,
71 .end = IRQ_S3CUART_ERR0,
72 .flags = IORESOURCE_IRQ,
73 }
74
75};
76
77static struct resource s3c_uart1_resource[] = {
78 [0] = {
79 .start = S3C2410_PA_UART1,
80 .end = S3C2410_PA_UART1 + 0x3fff,
81 .flags = IORESOURCE_MEM,
82 },
83 [1] = {
84 .start = IRQ_S3CUART_RX1,
85 .end = IRQ_S3CUART_ERR1,
86 .flags = IORESOURCE_IRQ,
87 }
88};
89
90static struct resource s3c_uart2_resource[] = {
91 [0] = {
92 .start = S3C2410_PA_UART2,
93 .end = S3C2410_PA_UART2 + 0x3fff,
94 .flags = IORESOURCE_MEM,
95 },
96 [1] = {
97 .start = IRQ_S3CUART_RX2,
98 .end = IRQ_S3CUART_ERR2,
99 .flags = IORESOURCE_IRQ,
100 }
101};
102
103/* our uart devices */
104
105static struct platform_device s3c_uart0 = {
106 .name = "s3c2440-uart",
107 .id = 0,
108 .num_resources = ARRAY_SIZE(s3c_uart0_resource),
109 .resource = s3c_uart0_resource,
110};
111
112static struct platform_device s3c_uart1 = {
113 .name = "s3c2440-uart",
114 .id = 1,
115 .num_resources = ARRAY_SIZE(s3c_uart1_resource),
116 .resource = s3c_uart1_resource,
117};
118
119static struct platform_device s3c_uart2 = {
120 .name = "s3c2440-uart",
121 .id = 2,
122 .num_resources = ARRAY_SIZE(s3c_uart2_resource),
123 .resource = s3c_uart2_resource,
124};
125
126static struct platform_device *uart_devices[] __initdata = {
127 &s3c_uart0,
128 &s3c_uart1,
129 &s3c_uart2
130};
131
132/* uart initialisation */ 63/* uart initialisation */
133 64
134static int __initdata s3c2440_uart_count;
135
136void __init s3c2440_init_uarts(struct s3c2410_uartcfg *cfg, int no) 65void __init s3c2440_init_uarts(struct s3c2410_uartcfg *cfg, int no)
137{ 66{
138 struct platform_device *platdev; 67 s3c24xx_init_uartdevs("s3c2440-uart", s3c2410_uart_resources, cfg, no);
139 int uart;
140
141 for (uart = 0; uart < no; uart++, cfg++) {
142 platdev = uart_devices[cfg->hwport];
143
144 s3c24xx_uart_devs[uart] = platdev;
145 platdev->dev.platform_data = cfg;
146 }
147
148 s3c2440_uart_count = uart;
149} 68}
150 69
151
152#ifdef CONFIG_PM 70#ifdef CONFIG_PM
153 71
154static struct sleep_save s3c2440_sleep[] = { 72static struct sleep_save s3c2440_sleep[] = {
@@ -269,15 +187,7 @@ core_initcall(s3c2440_core_init);
269 187
270int __init s3c2440_init(void) 188int __init s3c2440_init(void)
271{ 189{
272 int ret;
273
274 printk("S3C2440: Initialising architecture\n"); 190 printk("S3C2440: Initialising architecture\n");
275 191
276 ret = sysdev_register(&s3c2440_sysdev); 192 return sysdev_register(&s3c2440_sysdev);
277 if (ret != 0)
278 printk(KERN_ERR "failed to register sysdev for s3c2440\n");
279 else
280 ret = platform_add_devices(s3c24xx_uart_devs, s3c2440_uart_count);
281
282 return ret;
283} 193}