diff options
author | Paul Mundt <lethal@linux-sh.org> | 2007-02-15 04:20:52 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2007-02-15 04:20:52 -0500 |
commit | 9c57548f17806ffd8e4dc4f7973ce78bbfbc2079 (patch) | |
tree | b42b80e40e1f84fcea23ceb76fa697022df6ed9b /arch/sh/boards | |
parent | e65fa9f59e9230b72ac298d445b4a18a4eefeb34 (diff) |
sh: rts7751r2d board updates.
This tidies up some of the rts7751r2d mess and gets it booting
again. Update the defconfig, too.
Signed-off-by: Masayuki Hosokawa <hosokawa@ace-jp.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/boards')
-rw-r--r-- | arch/sh/boards/renesas/rts7751r2d/Makefile | 2 | ||||
-rw-r--r-- | arch/sh/boards/renesas/rts7751r2d/io.c | 302 | ||||
-rw-r--r-- | arch/sh/boards/renesas/rts7751r2d/irq.c | 80 | ||||
-rw-r--r-- | arch/sh/boards/renesas/rts7751r2d/setup.c | 123 |
4 files changed, 87 insertions, 420 deletions
diff --git a/arch/sh/boards/renesas/rts7751r2d/Makefile b/arch/sh/boards/renesas/rts7751r2d/Makefile index 833de1eac0e8..0d4c75a72be0 100644 --- a/arch/sh/boards/renesas/rts7751r2d/Makefile +++ b/arch/sh/boards/renesas/rts7751r2d/Makefile | |||
@@ -2,4 +2,4 @@ | |||
2 | # Makefile for the RTS7751R2D specific parts of the kernel | 2 | # Makefile for the RTS7751R2D specific parts of the kernel |
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := setup.o io.o irq.o | 5 | obj-y := setup.o irq.o |
diff --git a/arch/sh/boards/renesas/rts7751r2d/io.c b/arch/sh/boards/renesas/rts7751r2d/io.c deleted file mode 100644 index f2507a804979..000000000000 --- a/arch/sh/boards/renesas/rts7751r2d/io.c +++ /dev/null | |||
@@ -1,302 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2001 Ian da Silva, Jeremy Siegel | ||
3 | * Based largely on io_se.c. | ||
4 | * | ||
5 | * I/O routine for Renesas Technology sales RTS7751R2D. | ||
6 | * | ||
7 | * Initial version only to support LAN access; some | ||
8 | * placeholder code from io_rts7751r2d.c left in with the | ||
9 | * expectation of later SuperIO and PCMCIA access. | ||
10 | */ | ||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/types.h> | ||
13 | #include <linux/pci.h> | ||
14 | #include <linux/io.h> | ||
15 | #include <asm/rts7751r2d.h> | ||
16 | #include <asm/addrspace.h> | ||
17 | |||
18 | /* | ||
19 | * The 7751R RTS7751R2D uses the built-in PCI controller (PCIC) | ||
20 | * of the 7751R processor, and has a SuperIO accessible via the PCI. | ||
21 | * The board also includes a PCMCIA controller on its memory bus, | ||
22 | * like the other Solution Engine boards. | ||
23 | */ | ||
24 | |||
25 | static inline unsigned long port2adr(unsigned int port) | ||
26 | { | ||
27 | if ((0x1f0 <= port && port < 0x1f8) || port == 0x3f6) | ||
28 | if (port == 0x3f6) | ||
29 | return (PA_AREA5_IO + 0x80c); | ||
30 | else | ||
31 | return (PA_AREA5_IO + 0x1000 + ((port-0x1f0) << 1)); | ||
32 | else | ||
33 | maybebadio((unsigned long)port); | ||
34 | |||
35 | return port; | ||
36 | } | ||
37 | |||
38 | static inline unsigned long port88796l(unsigned int port, int flag) | ||
39 | { | ||
40 | unsigned long addr; | ||
41 | |||
42 | if (flag) | ||
43 | addr = PA_AX88796L + ((port - AX88796L_IO_BASE) << 1); | ||
44 | else | ||
45 | addr = PA_AX88796L + ((port - AX88796L_IO_BASE) << 1) + 0x1000; | ||
46 | |||
47 | return addr; | ||
48 | } | ||
49 | |||
50 | /* The 7751R RTS7751R2D seems to have everything hooked */ | ||
51 | /* up pretty normally (nothing on high-bytes only...) so this */ | ||
52 | /* shouldn't be needed */ | ||
53 | static inline int shifted_port(unsigned long port) | ||
54 | { | ||
55 | /* For IDE registers, value is not shifted */ | ||
56 | if ((0x1f0 <= port && port < 0x1f8) || port == 0x3f6) | ||
57 | return 0; | ||
58 | else | ||
59 | return 1; | ||
60 | } | ||
61 | |||
62 | #if defined(CONFIG_NE2000) || defined(CONFIG_NE2000_MODULE) | ||
63 | #define CHECK_AX88796L_PORT(port) \ | ||
64 | ((port >= AX88796L_IO_BASE) && (port < (AX88796L_IO_BASE+0x20))) | ||
65 | #else | ||
66 | #define CHECK_AX88796L_PORT(port) (0) | ||
67 | #endif | ||
68 | |||
69 | /* | ||
70 | * General outline: remap really low stuff [eventually] to SuperIO, | ||
71 | * stuff in PCI IO space (at or above window at pci.h:PCIBIOS_MIN_IO) | ||
72 | * is mapped through the PCI IO window. Stuff with high bits (PXSEG) | ||
73 | * should be way beyond the window, and is used w/o translation for | ||
74 | * compatibility. | ||
75 | */ | ||
76 | unsigned char rts7751r2d_inb(unsigned long port) | ||
77 | { | ||
78 | if (CHECK_AX88796L_PORT(port)) | ||
79 | return (*(volatile unsigned short *)port88796l(port, 0)) & 0xff; | ||
80 | else if (PXSEG(port)) | ||
81 | return *(volatile unsigned char *)port; | ||
82 | else if (is_pci_ioaddr(port) || shifted_port(port)) | ||
83 | return *(volatile unsigned char *)pci_ioaddr(port); | ||
84 | else | ||
85 | return (*(volatile unsigned short *)port2adr(port) & 0xff); | ||
86 | } | ||
87 | |||
88 | unsigned char rts7751r2d_inb_p(unsigned long port) | ||
89 | { | ||
90 | unsigned char v; | ||
91 | |||
92 | if (CHECK_AX88796L_PORT(port)) | ||
93 | v = (*(volatile unsigned short *)port88796l(port, 0)) & 0xff; | ||
94 | else if (PXSEG(port)) | ||
95 | v = *(volatile unsigned char *)port; | ||
96 | else if (is_pci_ioaddr(port) || shifted_port(port)) | ||
97 | v = *(volatile unsigned char *)pci_ioaddr(port); | ||
98 | else | ||
99 | v = (*(volatile unsigned short *)port2adr(port) & 0xff); | ||
100 | |||
101 | ctrl_delay(); | ||
102 | |||
103 | return v; | ||
104 | } | ||
105 | |||
106 | unsigned short rts7751r2d_inw(unsigned long port) | ||
107 | { | ||
108 | if (CHECK_AX88796L_PORT(port)) | ||
109 | maybebadio(port); | ||
110 | else if (PXSEG(port)) | ||
111 | return *(volatile unsigned short *)port; | ||
112 | else if (is_pci_ioaddr(port) || shifted_port(port)) | ||
113 | return *(volatile unsigned short *)pci_ioaddr(port); | ||
114 | else | ||
115 | maybebadio(port); | ||
116 | |||
117 | return 0; | ||
118 | } | ||
119 | |||
120 | unsigned int rts7751r2d_inl(unsigned long port) | ||
121 | { | ||
122 | if (CHECK_AX88796L_PORT(port)) | ||
123 | maybebadio(port); | ||
124 | else if (PXSEG(port)) | ||
125 | return *(volatile unsigned long *)port; | ||
126 | else if (is_pci_ioaddr(port) || shifted_port(port)) | ||
127 | return *(volatile unsigned long *)pci_ioaddr(port); | ||
128 | else | ||
129 | maybebadio(port); | ||
130 | |||
131 | return 0; | ||
132 | } | ||
133 | |||
134 | void rts7751r2d_outb(unsigned char value, unsigned long port) | ||
135 | { | ||
136 | if (CHECK_AX88796L_PORT(port)) | ||
137 | *((volatile unsigned short *)port88796l(port, 0)) = value; | ||
138 | else if (PXSEG(port)) | ||
139 | *(volatile unsigned char *)port = value; | ||
140 | else if (is_pci_ioaddr(port) || shifted_port(port)) | ||
141 | *(volatile unsigned char *)pci_ioaddr(port) = value; | ||
142 | else | ||
143 | *(volatile unsigned short *)port2adr(port) = value; | ||
144 | } | ||
145 | |||
146 | void rts7751r2d_outb_p(unsigned char value, unsigned long port) | ||
147 | { | ||
148 | if (CHECK_AX88796L_PORT(port)) | ||
149 | *((volatile unsigned short *)port88796l(port, 0)) = value; | ||
150 | else if (PXSEG(port)) | ||
151 | *(volatile unsigned char *)port = value; | ||
152 | else if (is_pci_ioaddr(port) || shifted_port(port)) | ||
153 | *(volatile unsigned char *)pci_ioaddr(port) = value; | ||
154 | else | ||
155 | *(volatile unsigned short *)port2adr(port) = value; | ||
156 | |||
157 | ctrl_delay(); | ||
158 | } | ||
159 | |||
160 | void rts7751r2d_outw(unsigned short value, unsigned long port) | ||
161 | { | ||
162 | if (CHECK_AX88796L_PORT(port)) | ||
163 | maybebadio(port); | ||
164 | else if (PXSEG(port)) | ||
165 | *(volatile unsigned short *)port = value; | ||
166 | else if (is_pci_ioaddr(port) || shifted_port(port)) | ||
167 | *(volatile unsigned short *)pci_ioaddr(port) = value; | ||
168 | else | ||
169 | maybebadio(port); | ||
170 | } | ||
171 | |||
172 | void rts7751r2d_outl(unsigned int value, unsigned long port) | ||
173 | { | ||
174 | if (CHECK_AX88796L_PORT(port)) | ||
175 | maybebadio(port); | ||
176 | else if (PXSEG(port)) | ||
177 | *(volatile unsigned long *)port = value; | ||
178 | else if (is_pci_ioaddr(port) || shifted_port(port)) | ||
179 | *(volatile unsigned long *)pci_ioaddr(port) = value; | ||
180 | else | ||
181 | maybebadio(port); | ||
182 | } | ||
183 | |||
184 | void rts7751r2d_insb(unsigned long port, void *addr, unsigned long count) | ||
185 | { | ||
186 | unsigned long a = (unsigned long)addr; | ||
187 | volatile __u8 *bp; | ||
188 | volatile __u16 *p; | ||
189 | |||
190 | if (CHECK_AX88796L_PORT(port)) { | ||
191 | p = (volatile unsigned short *)port88796l(port, 0); | ||
192 | while (count--) | ||
193 | ctrl_outb(*p & 0xff, a++); | ||
194 | } else if (PXSEG(port)) | ||
195 | while (count--) | ||
196 | ctrl_outb(ctrl_inb(port), a++); | ||
197 | else if (is_pci_ioaddr(port) || shifted_port(port)) { | ||
198 | bp = (__u8 *)pci_ioaddr(port); | ||
199 | while (count--) | ||
200 | ctrl_outb(*bp, a++); | ||
201 | } else { | ||
202 | p = (volatile unsigned short *)port2adr(port); | ||
203 | while (count--) | ||
204 | ctrl_outb(*p & 0xff, a++); | ||
205 | } | ||
206 | } | ||
207 | |||
208 | void rts7751r2d_insw(unsigned long port, void *addr, unsigned long count) | ||
209 | { | ||
210 | unsigned long a = (unsigned long)addr; | ||
211 | volatile __u16 *p; | ||
212 | |||
213 | if (CHECK_AX88796L_PORT(port)) | ||
214 | p = (volatile unsigned short *)port88796l(port, 1); | ||
215 | else if (PXSEG(port)) | ||
216 | p = (volatile unsigned short *)port; | ||
217 | else if (is_pci_ioaddr(port) || shifted_port(port)) | ||
218 | p = (volatile unsigned short *)pci_ioaddr(port); | ||
219 | else | ||
220 | p = (volatile unsigned short *)port2adr(port); | ||
221 | while (count--) | ||
222 | ctrl_outw(*p, a++); | ||
223 | } | ||
224 | |||
225 | void rts7751r2d_insl(unsigned long port, void *addr, unsigned long count) | ||
226 | { | ||
227 | if (CHECK_AX88796L_PORT(port)) | ||
228 | maybebadio(port); | ||
229 | else if (is_pci_ioaddr(port) || shifted_port(port)) { | ||
230 | unsigned long a = (unsigned long)addr; | ||
231 | |||
232 | while (count--) { | ||
233 | ctrl_outl(ctrl_inl(pci_ioaddr(port)), a); | ||
234 | a += 4; | ||
235 | } | ||
236 | } else | ||
237 | maybebadio(port); | ||
238 | } | ||
239 | |||
240 | void rts7751r2d_outsb(unsigned long port, const void *addr, unsigned long count) | ||
241 | { | ||
242 | unsigned long a = (unsigned long)addr; | ||
243 | volatile __u8 *bp; | ||
244 | volatile __u16 *p; | ||
245 | |||
246 | if (CHECK_AX88796L_PORT(port)) { | ||
247 | p = (volatile unsigned short *)port88796l(port, 0); | ||
248 | while (count--) | ||
249 | *p = ctrl_inb(a++); | ||
250 | } else if (PXSEG(port)) | ||
251 | while (count--) | ||
252 | ctrl_outb(a++, port); | ||
253 | else if (is_pci_ioaddr(port) || shifted_port(port)) { | ||
254 | bp = (__u8 *)pci_ioaddr(port); | ||
255 | while (count--) | ||
256 | *bp = ctrl_inb(a++); | ||
257 | } else { | ||
258 | p = (volatile unsigned short *)port2adr(port); | ||
259 | while (count--) | ||
260 | *p = ctrl_inb(a++); | ||
261 | } | ||
262 | } | ||
263 | |||
264 | void rts7751r2d_outsw(unsigned long port, const void *addr, unsigned long count) | ||
265 | { | ||
266 | unsigned long a = (unsigned long)addr; | ||
267 | volatile __u16 *p; | ||
268 | |||
269 | if (CHECK_AX88796L_PORT(port)) | ||
270 | p = (volatile unsigned short *)port88796l(port, 1); | ||
271 | else if (PXSEG(port)) | ||
272 | p = (volatile unsigned short *)port; | ||
273 | else if (is_pci_ioaddr(port) || shifted_port(port)) | ||
274 | p = (volatile unsigned short *)pci_ioaddr(port); | ||
275 | else | ||
276 | p = (volatile unsigned short *)port2adr(port); | ||
277 | |||
278 | while (count--) { | ||
279 | ctrl_outw(*p, a); | ||
280 | a += 2; | ||
281 | } | ||
282 | } | ||
283 | |||
284 | void rts7751r2d_outsl(unsigned long port, const void *addr, unsigned long count) | ||
285 | { | ||
286 | if (CHECK_AX88796L_PORT(port)) | ||
287 | maybebadio(port); | ||
288 | else if (is_pci_ioaddr(port) || shifted_port(port)) { | ||
289 | unsigned long a = (unsigned long)addr; | ||
290 | |||
291 | while (count--) { | ||
292 | ctrl_outl(ctrl_inl(a), pci_ioaddr(port)); | ||
293 | a += 4; | ||
294 | } | ||
295 | } else | ||
296 | maybebadio(port); | ||
297 | } | ||
298 | |||
299 | unsigned long rts7751r2d_isa_port2addr(unsigned long offset) | ||
300 | { | ||
301 | return port2adr(offset); | ||
302 | } | ||
diff --git a/arch/sh/boards/renesas/rts7751r2d/irq.c b/arch/sh/boards/renesas/rts7751r2d/irq.c index cb0eb20d1b43..0bae9041aceb 100644 --- a/arch/sh/boards/renesas/rts7751r2d/irq.c +++ b/arch/sh/boards/renesas/rts7751r2d/irq.c | |||
@@ -9,7 +9,9 @@ | |||
9 | * Atom Create Engineering Co., Ltd. 2002. | 9 | * Atom Create Engineering Co., Ltd. 2002. |
10 | */ | 10 | */ |
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
12 | #include <linux/interrupt.h> | ||
12 | #include <linux/irq.h> | 13 | #include <linux/irq.h> |
14 | #include <linux/interrupt.h> | ||
13 | #include <linux/io.h> | 15 | #include <linux/io.h> |
14 | #include <asm/rts7751r2d.h> | 16 | #include <asm/rts7751r2d.h> |
15 | 17 | ||
@@ -22,79 +24,31 @@ static int mask_pos[] = {6, 11, 9, 8, 12, 10, 5, 4, 7, 14, 13, 0, 0, 0, 0}; | |||
22 | extern int voyagergx_irq_demux(int irq); | 24 | extern int voyagergx_irq_demux(int irq); |
23 | extern void setup_voyagergx_irq(void); | 25 | extern void setup_voyagergx_irq(void); |
24 | 26 | ||
25 | static void enable_rts7751r2d_irq(unsigned int irq); | 27 | static void enable_rts7751r2d_irq(unsigned int irq) |
26 | static void disable_rts7751r2d_irq(unsigned int irq); | ||
27 | |||
28 | /* shutdown is same as "disable" */ | ||
29 | #define shutdown_rts7751r2d_irq disable_rts7751r2d_irq | ||
30 | |||
31 | static void ack_rts7751r2d_irq(unsigned int irq); | ||
32 | static void end_rts7751r2d_irq(unsigned int irq); | ||
33 | |||
34 | static unsigned int startup_rts7751r2d_irq(unsigned int irq) | ||
35 | { | 28 | { |
36 | enable_rts7751r2d_irq(irq); | 29 | /* Set priority in IPR back to original value */ |
37 | return 0; /* never anything pending */ | 30 | ctrl_outw(ctrl_inw(IRLCNTR1) | (1 << mask_pos[irq]), IRLCNTR1); |
38 | } | 31 | } |
39 | 32 | ||
40 | static void disable_rts7751r2d_irq(unsigned int irq) | 33 | static void disable_rts7751r2d_irq(unsigned int irq) |
41 | { | 34 | { |
42 | unsigned short val; | ||
43 | unsigned short mask = 0xffff ^ (0x0001 << mask_pos[irq]); | ||
44 | |||
45 | /* Set the priority in IPR to 0 */ | 35 | /* Set the priority in IPR to 0 */ |
46 | val = ctrl_inw(IRLCNTR1); | 36 | ctrl_outw(ctrl_inw(IRLCNTR1) & (0xffff ^ (1 << mask_pos[irq])), |
47 | val &= mask; | 37 | IRLCNTR1); |
48 | ctrl_outw(val, IRLCNTR1); | ||
49 | } | ||
50 | |||
51 | static void enable_rts7751r2d_irq(unsigned int irq) | ||
52 | { | ||
53 | unsigned short val; | ||
54 | unsigned short value = (0x0001 << mask_pos[irq]); | ||
55 | |||
56 | /* Set priority in IPR back to original value */ | ||
57 | val = ctrl_inw(IRLCNTR1); | ||
58 | val |= value; | ||
59 | ctrl_outw(val, IRLCNTR1); | ||
60 | } | 38 | } |
61 | 39 | ||
62 | int rts7751r2d_irq_demux(int irq) | 40 | int rts7751r2d_irq_demux(int irq) |
63 | { | 41 | { |
64 | int demux_irq; | 42 | return voyagergx_irq_demux(irq); |
65 | |||
66 | demux_irq = voyagergx_irq_demux(irq); | ||
67 | return demux_irq; | ||
68 | } | ||
69 | |||
70 | static void ack_rts7751r2d_irq(unsigned int irq) | ||
71 | { | ||
72 | disable_rts7751r2d_irq(irq); | ||
73 | } | 43 | } |
74 | 44 | ||
75 | static void end_rts7751r2d_irq(unsigned int irq) | 45 | static struct irq_chip rts7751r2d_irq_chip __read_mostly = { |
76 | { | 46 | .name = "rts7751r2d", |
77 | if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) | 47 | .mask = disable_rts7751r2d_irq, |
78 | enable_rts7751r2d_irq(irq); | 48 | .unmask = enable_rts7751r2d_irq, |
79 | } | 49 | .mask_ack = disable_rts7751r2d_irq, |
80 | |||
81 | static struct hw_interrupt_type rts7751r2d_irq_type = { | ||
82 | .typename = "RTS7751R2D IRQ", | ||
83 | .startup = startup_rts7751r2d_irq, | ||
84 | .shutdown = shutdown_rts7751r2d_irq, | ||
85 | .enable = enable_rts7751r2d_irq, | ||
86 | .disable = disable_rts7751r2d_irq, | ||
87 | .ack = ack_rts7751r2d_irq, | ||
88 | .end = end_rts7751r2d_irq, | ||
89 | }; | 50 | }; |
90 | 51 | ||
91 | static void make_rts7751r2d_irq(unsigned int irq) | ||
92 | { | ||
93 | disable_irq_nosync(irq); | ||
94 | irq_desc[irq].chip = &rts7751r2d_irq_type; | ||
95 | disable_rts7751r2d_irq(irq); | ||
96 | } | ||
97 | |||
98 | /* | 52 | /* |
99 | * Initialize IRQ setting | 53 | * Initialize IRQ setting |
100 | */ | 54 | */ |
@@ -119,8 +73,12 @@ void __init init_rts7751r2d_IRQ(void) | |||
119 | * IRL14=Extention #3 | 73 | * IRL14=Extention #3 |
120 | */ | 74 | */ |
121 | 75 | ||
122 | for (i=0; i<15; i++) | 76 | for (i=0; i<15; i++) { |
123 | make_rts7751r2d_irq(i); | 77 | disable_irq_nosync(i); |
78 | set_irq_chip_and_handler_name(i, &rts7751r2d_irq_chip, | ||
79 | handle_level_irq, "level"); | ||
80 | enable_rts7751r2d_irq(i); | ||
81 | } | ||
124 | 82 | ||
125 | setup_voyagergx_irq(); | 83 | setup_voyagergx_irq(); |
126 | } | 84 | } |
diff --git a/arch/sh/boards/renesas/rts7751r2d/setup.c b/arch/sh/boards/renesas/rts7751r2d/setup.c index d97be1202245..44b42082a0af 100644 --- a/arch/sh/boards/renesas/rts7751r2d/setup.c +++ b/arch/sh/boards/renesas/rts7751r2d/setup.c | |||
@@ -1,8 +1,8 @@ | |||
1 | /* | 1 | /* |
2 | * Renesas Technology Sales RTS7751R2D Support. | 2 | * Renesas Technology Sales RTS7751R2D Support. |
3 | * | 3 | * |
4 | * Copyright (C) 2002 Atom Create Engineering Co., Ltd. | 4 | * Copyright (C) 2002 - 2006 Atom Create Engineering Co., Ltd. |
5 | * Copyright (C) 2004 - 2006 Paul Mundt | 5 | * Copyright (C) 2004 - 2007 Paul Mundt |
6 | * | 6 | * |
7 | * This file is subject to the terms and conditions of the GNU General Public | 7 | * This file is subject to the terms and conditions of the GNU General Public |
8 | * License. See the file "COPYING" in the main directory of this archive | 8 | * License. See the file "COPYING" in the main directory of this archive |
@@ -10,33 +10,13 @@ | |||
10 | */ | 10 | */ |
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
12 | #include <linux/platform_device.h> | 12 | #include <linux/platform_device.h> |
13 | #include <linux/pata_platform.h> | ||
13 | #include <linux/serial_8250.h> | 14 | #include <linux/serial_8250.h> |
14 | #include <linux/pm.h> | 15 | #include <linux/pm.h> |
15 | #include <asm/machvec.h> | 16 | #include <asm/machvec.h> |
16 | #include <asm/mach/rts7751r2d.h> | 17 | #include <asm/rts7751r2d.h> |
17 | #include <asm/io.h> | ||
18 | #include <asm/voyagergx.h> | 18 | #include <asm/voyagergx.h> |
19 | 19 | #include <asm/io.h> | |
20 | extern void heartbeat_rts7751r2d(void); | ||
21 | extern void init_rts7751r2d_IRQ(void); | ||
22 | extern int rts7751r2d_irq_demux(int irq); | ||
23 | |||
24 | extern void *voyagergx_consistent_alloc(struct device *, size_t, dma_addr_t *, gfp_t); | ||
25 | extern int voyagergx_consistent_free(struct device *, size_t, void *, dma_addr_t); | ||
26 | |||
27 | static struct plat_serial8250_port uart_platform_data[] = { | ||
28 | { | ||
29 | .membase = (void *)VOYAGER_UART_BASE, | ||
30 | .mapbase = VOYAGER_UART_BASE, | ||
31 | .iotype = UPIO_MEM, | ||
32 | .irq = VOYAGER_UART0_IRQ, | ||
33 | .flags = UPF_BOOT_AUTOCONF, | ||
34 | .regshift = 2, | ||
35 | .uartclk = (9600 * 16), | ||
36 | }, { | ||
37 | .flags = 0, | ||
38 | }, | ||
39 | }; | ||
40 | 20 | ||
41 | static void __init voyagergx_serial_init(void) | 21 | static void __init voyagergx_serial_init(void) |
42 | { | 22 | { |
@@ -45,25 +25,72 @@ static void __init voyagergx_serial_init(void) | |||
45 | /* | 25 | /* |
46 | * GPIO Control | 26 | * GPIO Control |
47 | */ | 27 | */ |
48 | val = inl(GPIO_MUX_HIGH); | 28 | val = readl((void __iomem *)GPIO_MUX_HIGH); |
49 | val |= 0x00001fe0; | 29 | val |= 0x00001fe0; |
50 | outl(val, GPIO_MUX_HIGH); | 30 | writel(val, (void __iomem *)GPIO_MUX_HIGH); |
51 | 31 | ||
52 | /* | 32 | /* |
53 | * Power Mode Gate | 33 | * Power Mode Gate |
54 | */ | 34 | */ |
55 | val = inl(POWER_MODE0_GATE); | 35 | val = readl((void __iomem *)POWER_MODE0_GATE); |
56 | val |= (POWER_MODE0_GATE_U0 | POWER_MODE0_GATE_U1); | 36 | val |= (POWER_MODE0_GATE_U0 | POWER_MODE0_GATE_U1); |
57 | outl(val, POWER_MODE0_GATE); | 37 | writel(val, (void __iomem *)POWER_MODE0_GATE); |
58 | 38 | ||
59 | val = inl(POWER_MODE1_GATE); | 39 | val = readl((void __iomem *)POWER_MODE1_GATE); |
60 | val |= (POWER_MODE1_GATE_U0 | POWER_MODE1_GATE_U1); | 40 | val |= (POWER_MODE1_GATE_U0 | POWER_MODE1_GATE_U1); |
61 | outl(val, POWER_MODE1_GATE); | 41 | writel(val, (void __iomem *)POWER_MODE1_GATE); |
62 | } | 42 | } |
63 | 43 | ||
44 | static struct resource cf_ide_resources[] = { | ||
45 | [0] = { | ||
46 | .start = PA_AREA5_IO + 0x1000, | ||
47 | .end = PA_AREA5_IO + 0x1000 + 0x08 - 1, | ||
48 | .flags = IORESOURCE_MEM, | ||
49 | }, | ||
50 | [1] = { | ||
51 | .start = PA_AREA5_IO + 0x80c, | ||
52 | .end = PA_AREA5_IO + 0x80c + 0x16 - 1, | ||
53 | .flags = IORESOURCE_MEM, | ||
54 | }, | ||
55 | [2] = { | ||
56 | #ifdef CONFIG_RTS7751R2D_REV11 | ||
57 | .start = 1, | ||
58 | #else | ||
59 | .start = 2, | ||
60 | #endif | ||
61 | .flags = IORESOURCE_IRQ, | ||
62 | }, | ||
63 | }; | ||
64 | |||
65 | static struct pata_platform_info pata_info = { | ||
66 | .ioport_shift = 1, | ||
67 | }; | ||
68 | |||
69 | static struct platform_device cf_ide_device = { | ||
70 | .name = "pata_platform", | ||
71 | .id = -1, | ||
72 | .num_resources = ARRAY_SIZE(cf_ide_resources), | ||
73 | .resource = cf_ide_resources, | ||
74 | .dev = { | ||
75 | .platform_data = &pata_info, | ||
76 | }, | ||
77 | }; | ||
78 | |||
79 | static struct plat_serial8250_port uart_platform_data[] = { | ||
80 | { | ||
81 | .membase = (void __iomem *)VOYAGER_UART_BASE, | ||
82 | .mapbase = VOYAGER_UART_BASE, | ||
83 | .iotype = UPIO_MEM, | ||
84 | .irq = VOYAGER_UART0_IRQ, | ||
85 | .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, | ||
86 | .regshift = 2, | ||
87 | .uartclk = (9600 * 16), | ||
88 | } | ||
89 | }; | ||
90 | |||
64 | static struct platform_device uart_device = { | 91 | static struct platform_device uart_device = { |
65 | .name = "serial8250", | 92 | .name = "serial8250", |
66 | .id = -1, | 93 | .id = PLAT8250_DEV_PLATFORM, |
67 | .dev = { | 94 | .dev = { |
68 | .platform_data = uart_platform_data, | 95 | .platform_data = uart_platform_data, |
69 | }, | 96 | }, |
@@ -87,6 +114,7 @@ static struct platform_device heartbeat_device = { | |||
87 | static struct platform_device *rts7751r2d_devices[] __initdata = { | 114 | static struct platform_device *rts7751r2d_devices[] __initdata = { |
88 | &uart_device, | 115 | &uart_device, |
89 | &heartbeat_device, | 116 | &heartbeat_device, |
117 | &cf_ide_device, | ||
90 | }; | 118 | }; |
91 | 119 | ||
92 | static int __init rts7751r2d_devices_setup(void) | 120 | static int __init rts7751r2d_devices_setup(void) |
@@ -94,6 +122,7 @@ static int __init rts7751r2d_devices_setup(void) | |||
94 | return platform_add_devices(rts7751r2d_devices, | 122 | return platform_add_devices(rts7751r2d_devices, |
95 | ARRAY_SIZE(rts7751r2d_devices)); | 123 | ARRAY_SIZE(rts7751r2d_devices)); |
96 | } | 124 | } |
125 | __initcall(rts7751r2d_devices_setup); | ||
97 | 126 | ||
98 | static void rts7751r2d_power_off(void) | 127 | static void rts7751r2d_power_off(void) |
99 | { | 128 | { |
@@ -105,14 +134,17 @@ static void rts7751r2d_power_off(void) | |||
105 | */ | 134 | */ |
106 | static void __init rts7751r2d_setup(char **cmdline_p) | 135 | static void __init rts7751r2d_setup(char **cmdline_p) |
107 | { | 136 | { |
108 | device_initcall(rts7751r2d_devices_setup); | 137 | u16 ver = ctrl_inw(PA_VERREG); |
138 | |||
139 | printk(KERN_INFO "Renesas Technology Sales RTS7751R2D support.\n"); | ||
140 | |||
141 | printk(KERN_INFO "FPGA version:%d (revision:%d)\n", | ||
142 | (ver >> 4) & 0xf, ver & 0xf); | ||
109 | 143 | ||
110 | ctrl_outw(0x0000, PA_OUTPORT); | 144 | ctrl_outw(0x0000, PA_OUTPORT); |
111 | pm_power_off = rts7751r2d_power_off; | 145 | pm_power_off = rts7751r2d_power_off; |
112 | 146 | ||
113 | voyagergx_serial_init(); | 147 | voyagergx_serial_init(); |
114 | |||
115 | printk(KERN_INFO "Renesas Technology Sales RTS7751R2D support.\n"); | ||
116 | } | 148 | } |
117 | 149 | ||
118 | /* | 150 | /* |
@@ -123,27 +155,6 @@ struct sh_machine_vector mv_rts7751r2d __initmv = { | |||
123 | .mv_setup = rts7751r2d_setup, | 155 | .mv_setup = rts7751r2d_setup, |
124 | .mv_nr_irqs = 72, | 156 | .mv_nr_irqs = 72, |
125 | 157 | ||
126 | .mv_inb = rts7751r2d_inb, | ||
127 | .mv_inw = rts7751r2d_inw, | ||
128 | .mv_inl = rts7751r2d_inl, | ||
129 | .mv_outb = rts7751r2d_outb, | ||
130 | .mv_outw = rts7751r2d_outw, | ||
131 | .mv_outl = rts7751r2d_outl, | ||
132 | |||
133 | .mv_inb_p = rts7751r2d_inb_p, | ||
134 | .mv_inw_p = rts7751r2d_inw, | ||
135 | .mv_inl_p = rts7751r2d_inl, | ||
136 | .mv_outb_p = rts7751r2d_outb_p, | ||
137 | .mv_outw_p = rts7751r2d_outw, | ||
138 | .mv_outl_p = rts7751r2d_outl, | ||
139 | |||
140 | .mv_insb = rts7751r2d_insb, | ||
141 | .mv_insw = rts7751r2d_insw, | ||
142 | .mv_insl = rts7751r2d_insl, | ||
143 | .mv_outsb = rts7751r2d_outsb, | ||
144 | .mv_outsw = rts7751r2d_outsw, | ||
145 | .mv_outsl = rts7751r2d_outsl, | ||
146 | |||
147 | .mv_init_irq = init_rts7751r2d_IRQ, | 158 | .mv_init_irq = init_rts7751r2d_IRQ, |
148 | .mv_irq_demux = rts7751r2d_irq_demux, | 159 | .mv_irq_demux = rts7751r2d_irq_demux, |
149 | 160 | ||