diff options
author | Ben Dooks <ben-linux@fluff.org> | 2008-10-21 09:06:46 -0400 |
---|---|---|
committer | Ben Dooks <ben-linux@fluff.org> | 2008-12-15 16:49:46 -0500 |
commit | 0241cbb9d62613f6952d023a04d565901a3ca1ad (patch) | |
tree | b622324e3ea135a70a71f57f12b762c034d3557e /arch | |
parent | e1a2bd1d2f368faaf377fdf8404a685280a3d0a3 (diff) |
[ARM] S3C64XX: Add UARTdevice definitions
Add resources and information for the UART deviecs
on the S3C64XX CPUs.
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/plat-s3c/include/plat/devs.h | 1 | ||||
-rw-r--r-- | arch/arm/plat-s3c64xx/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/plat-s3c64xx/dev-uart.c | 176 | ||||
-rw-r--r-- | arch/arm/plat-s3c64xx/include/plat/irqs.h | 35 |
4 files changed, 213 insertions, 1 deletions
diff --git a/arch/arm/plat-s3c/include/plat/devs.h b/arch/arm/plat-s3c/include/plat/devs.h index badaac9d64a8..a689c7c5ac23 100644 --- a/arch/arm/plat-s3c/include/plat/devs.h +++ b/arch/arm/plat-s3c/include/plat/devs.h | |||
@@ -17,6 +17,7 @@ struct s3c24xx_uart_resources { | |||
17 | }; | 17 | }; |
18 | 18 | ||
19 | extern struct s3c24xx_uart_resources s3c2410_uart_resources[]; | 19 | extern struct s3c24xx_uart_resources s3c2410_uart_resources[]; |
20 | extern struct s3c24xx_uart_resources s3c64xx_uart_resources[]; | ||
20 | 21 | ||
21 | extern struct platform_device *s3c24xx_uart_devs[]; | 22 | extern struct platform_device *s3c24xx_uart_devs[]; |
22 | extern struct platform_device *s3c24xx_uart_src[]; | 23 | extern struct platform_device *s3c24xx_uart_src[]; |
diff --git a/arch/arm/plat-s3c64xx/Makefile b/arch/arm/plat-s3c64xx/Makefile index 900c86367e1b..178c968bb8da 100644 --- a/arch/arm/plat-s3c64xx/Makefile +++ b/arch/arm/plat-s3c64xx/Makefile | |||
@@ -11,3 +11,5 @@ obj-n := dummy.o | |||
11 | obj- := | 11 | obj- := |
12 | 12 | ||
13 | # Core files | 13 | # Core files |
14 | |||
15 | obj-y += dev-uart.o | ||
diff --git a/arch/arm/plat-s3c64xx/dev-uart.c b/arch/arm/plat-s3c64xx/dev-uart.c new file mode 100644 index 000000000000..62c11a6fc7ba --- /dev/null +++ b/arch/arm/plat-s3c64xx/dev-uart.c | |||
@@ -0,0 +1,176 @@ | |||
1 | /* linux/arch/arm/plat-s3c64xx/dev-uart.c | ||
2 | * | ||
3 | * Copyright 2008 Openmoko, Inc. | ||
4 | * Copyright 2008 Simtec Electronics | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
6 | * http://armlinux.simtec.co.uk/ | ||
7 | * | ||
8 | * Base S3C64XX UART resource and device definitions | ||
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 | */ | ||
15 | |||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/types.h> | ||
18 | #include <linux/interrupt.h> | ||
19 | #include <linux/list.h> | ||
20 | #include <linux/platform_device.h> | ||
21 | |||
22 | #include <asm/mach/arch.h> | ||
23 | #include <asm/mach/irq.h> | ||
24 | #include <mach/hardware.h> | ||
25 | #include <mach/map.h> | ||
26 | |||
27 | #include <plat/devs.h> | ||
28 | |||
29 | /* Serial port registrations */ | ||
30 | |||
31 | /* 64xx uarts are closer together */ | ||
32 | |||
33 | static struct resource s3c64xx_uart0_resource[] = { | ||
34 | [0] = { | ||
35 | .start = S3C_PA_UART0, | ||
36 | .end = S3C_PA_UART0 + 0x100, | ||
37 | .flags = IORESOURCE_MEM, | ||
38 | }, | ||
39 | [1] = { | ||
40 | .start = IRQ_S3CUART_RX0, | ||
41 | .end = IRQ_S3CUART_RX0, | ||
42 | .flags = IORESOURCE_IRQ, | ||
43 | }, | ||
44 | [2] = { | ||
45 | .start = IRQ_S3CUART_TX0, | ||
46 | .end = IRQ_S3CUART_TX0, | ||
47 | .flags = IORESOURCE_IRQ, | ||
48 | |||
49 | }, | ||
50 | [3] = { | ||
51 | .start = IRQ_S3CUART_ERR0, | ||
52 | .end = IRQ_S3CUART_ERR0, | ||
53 | .flags = IORESOURCE_IRQ, | ||
54 | } | ||
55 | }; | ||
56 | |||
57 | static struct resource s3c64xx_uart1_resource[] = { | ||
58 | [0] = { | ||
59 | .start = S3C_PA_UART1, | ||
60 | .end = S3C_PA_UART1 + 0x100, | ||
61 | .flags = IORESOURCE_MEM, | ||
62 | }, | ||
63 | [1] = { | ||
64 | .start = IRQ_S3CUART_RX1, | ||
65 | .end = IRQ_S3CUART_RX1, | ||
66 | .flags = IORESOURCE_IRQ, | ||
67 | }, | ||
68 | [2] = { | ||
69 | .start = IRQ_S3CUART_TX1, | ||
70 | .end = IRQ_S3CUART_TX1, | ||
71 | .flags = IORESOURCE_IRQ, | ||
72 | |||
73 | }, | ||
74 | [3] = { | ||
75 | .start = IRQ_S3CUART_ERR1, | ||
76 | .end = IRQ_S3CUART_ERR1, | ||
77 | .flags = IORESOURCE_IRQ, | ||
78 | }, | ||
79 | }; | ||
80 | |||
81 | static struct resource s3c6xx_uart2_resource[] = { | ||
82 | [0] = { | ||
83 | .start = S3C_PA_UART2, | ||
84 | .end = S3C_PA_UART2 + 0x100, | ||
85 | .flags = IORESOURCE_MEM, | ||
86 | }, | ||
87 | [1] = { | ||
88 | .start = IRQ_S3CUART_RX2, | ||
89 | .end = IRQ_S3CUART_RX2, | ||
90 | .flags = IORESOURCE_IRQ, | ||
91 | }, | ||
92 | [2] = { | ||
93 | .start = IRQ_S3CUART_TX2, | ||
94 | .end = IRQ_S3CUART_TX2, | ||
95 | .flags = IORESOURCE_IRQ, | ||
96 | |||
97 | }, | ||
98 | [3] = { | ||
99 | .start = IRQ_S3CUART_ERR2, | ||
100 | .end = IRQ_S3CUART_ERR2, | ||
101 | .flags = IORESOURCE_IRQ, | ||
102 | }, | ||
103 | }; | ||
104 | |||
105 | static struct resource s3c64xx_uart3_resource[] = { | ||
106 | [0] = { | ||
107 | .start = S3C_PA_UART3, | ||
108 | .end = S3C_PA_UART3 + 0x100, | ||
109 | .flags = IORESOURCE_MEM, | ||
110 | }, | ||
111 | [1] = { | ||
112 | .start = IRQ_S3CUART_RX3, | ||
113 | .end = IRQ_S3CUART_RX3, | ||
114 | .flags = IORESOURCE_IRQ, | ||
115 | }, | ||
116 | [2] = { | ||
117 | .start = IRQ_S3CUART_TX3, | ||
118 | .end = IRQ_S3CUART_TX3, | ||
119 | .flags = IORESOURCE_IRQ, | ||
120 | |||
121 | }, | ||
122 | [3] = { | ||
123 | .start = IRQ_S3CUART_ERR3, | ||
124 | .end = IRQ_S3CUART_ERR3, | ||
125 | .flags = IORESOURCE_IRQ, | ||
126 | }, | ||
127 | }; | ||
128 | |||
129 | |||
130 | struct s3c24xx_uart_resources s3c64xx_uart_resources[] __initdata = { | ||
131 | [0] = { | ||
132 | .resources = s3c64xx_uart0_resource, | ||
133 | .nr_resources = ARRAY_SIZE(s3c64xx_uart0_resource), | ||
134 | }, | ||
135 | [1] = { | ||
136 | .resources = s3c64xx_uart1_resource, | ||
137 | .nr_resources = ARRAY_SIZE(s3c64xx_uart1_resource), | ||
138 | }, | ||
139 | [2] = { | ||
140 | .resources = s3c6xx_uart2_resource, | ||
141 | .nr_resources = ARRAY_SIZE(s3c6xx_uart2_resource), | ||
142 | }, | ||
143 | [3] = { | ||
144 | .resources = s3c64xx_uart3_resource, | ||
145 | .nr_resources = ARRAY_SIZE(s3c64xx_uart3_resource), | ||
146 | }, | ||
147 | }; | ||
148 | |||
149 | /* uart devices */ | ||
150 | |||
151 | static struct platform_device s3c24xx_uart_device0 = { | ||
152 | .id = 0, | ||
153 | }; | ||
154 | |||
155 | static struct platform_device s3c24xx_uart_device1 = { | ||
156 | .id = 1, | ||
157 | }; | ||
158 | |||
159 | static struct platform_device s3c24xx_uart_device2 = { | ||
160 | .id = 2, | ||
161 | }; | ||
162 | |||
163 | static struct platform_device s3c24xx_uart_device3 = { | ||
164 | .id = 3, | ||
165 | }; | ||
166 | |||
167 | struct platform_device *s3c24xx_uart_src[4] = { | ||
168 | &s3c24xx_uart_device0, | ||
169 | &s3c24xx_uart_device1, | ||
170 | &s3c24xx_uart_device2, | ||
171 | &s3c24xx_uart_device3, | ||
172 | }; | ||
173 | |||
174 | struct platform_device *s3c24xx_uart_devs[4] = { | ||
175 | }; | ||
176 | |||
diff --git a/arch/arm/plat-s3c64xx/include/plat/irqs.h b/arch/arm/plat-s3c64xx/include/plat/irqs.h index 592a56354551..0f207ab2df28 100644 --- a/arch/arm/plat-s3c64xx/include/plat/irqs.h +++ b/arch/arm/plat-s3c64xx/include/plat/irqs.h | |||
@@ -15,12 +15,45 @@ | |||
15 | * the ISA space, so that the PC104 has them to itself | 15 | * the ISA space, so that the PC104 has them to itself |
16 | * and we don't end up having to do horrible things to the | 16 | * and we don't end up having to do horrible things to the |
17 | * standard ISA drivers.... | 17 | * standard ISA drivers.... |
18 | * | ||
19 | * note, since we're using the VICs, our start must be a | ||
20 | * mulitple of 32 to allow the common code to work | ||
18 | */ | 21 | */ |
19 | 22 | ||
20 | #define S3C_IRQ_OFFSET (16) | 23 | #define S3C_IRQ_OFFSET (32) |
21 | 24 | ||
22 | #define S3C_IRQ(x) ((x) + S3C_IRQ_OFFSET) | 25 | #define S3C_IRQ(x) ((x) + S3C_IRQ_OFFSET) |
23 | 26 | ||
27 | /* UART interrupts, each UART has 4 intterupts per channel so | ||
28 | * use the space between the ISA and S3C main interrupts. Note, these | ||
29 | * are not in the same order as the S3C24XX series! */ | ||
30 | |||
31 | #define IRQ_S3CUART_BASE0 (16) | ||
32 | #define IRQ_S3CUART_BASE1 (20) | ||
33 | #define IRQ_S3CUART_BASE2 (24) | ||
34 | #define IRQ_S3CUART_BASE3 (28) | ||
35 | |||
36 | #define UART_IRQ_RXD (0) | ||
37 | #define UART_IRQ_ERR (1) | ||
38 | #define UART_IRQ_TXD (2) | ||
39 | #define UART_IRQ_MODEM (3) | ||
40 | |||
41 | #define IRQ_S3CUART_RX0 (IRQ_S3CUART_BASE0 + UART_IRQ_RXD) | ||
42 | #define IRQ_S3CUART_TX0 (IRQ_S3CUART_BASE0 + UART_IRQ_TXD) | ||
43 | #define IRQ_S3CUART_ERR0 (IRQ_S3CUART_BASE0 + UART_IRQ_ERR) | ||
44 | |||
45 | #define IRQ_S3CUART_RX1 (IRQ_S3CUART_BASE1 + UART_IRQ_RXD) | ||
46 | #define IRQ_S3CUART_TX1 (IRQ_S3CUART_BASE1 + UART_IRQ_TXD) | ||
47 | #define IRQ_S3CUART_ERR1 (IRQ_S3CUART_BASE1 + UART_IRQ_ERR) | ||
48 | |||
49 | #define IRQ_S3CUART_RX2 (IRQ_S3CUART_BASE2 + UART_IRQ_RXD) | ||
50 | #define IRQ_S3CUART_TX2 (IRQ_S3CUART_BASE2 + UART_IRQ_TXD) | ||
51 | #define IRQ_S3CUART_ERR2 (IRQ_S3CUART_BASE2 + UART_IRQ_ERR) | ||
52 | |||
53 | #define IRQ_S3CUART_RX3 (IRQ_S3CUART_BASE3 + UART_IRQ_RXD) | ||
54 | #define IRQ_S3CUART_TX3 (IRQ_S3CUART_BASE3 + UART_IRQ_TXD) | ||
55 | #define IRQ_S3CUART_ERR3 (IRQ_S3CUART_BASE3 + UART_IRQ_ERR) | ||
56 | |||
24 | /* Since the IRQ_EINT(x) are a linear mapping on current s3c64xx series | 57 | /* Since the IRQ_EINT(x) are a linear mapping on current s3c64xx series |
25 | * we just defined them as an IRQ_EINT(x) macro from S3C_IRQ_EINT_BASE | 58 | * we just defined them as an IRQ_EINT(x) macro from S3C_IRQ_EINT_BASE |
26 | * which we place after the pair of VICs. */ | 59 | * which we place after the pair of VICs. */ |