diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/sh/boards/renesas/rts7751r2d |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'arch/sh/boards/renesas/rts7751r2d')
-rw-r--r-- | arch/sh/boards/renesas/rts7751r2d/Makefile | 10 | ||||
-rw-r--r-- | arch/sh/boards/renesas/rts7751r2d/io.c | 319 | ||||
-rw-r--r-- | arch/sh/boards/renesas/rts7751r2d/irq.c | 135 | ||||
-rw-r--r-- | arch/sh/boards/renesas/rts7751r2d/led.c | 67 | ||||
-rw-r--r-- | arch/sh/boards/renesas/rts7751r2d/mach.c | 70 | ||||
-rw-r--r-- | arch/sh/boards/renesas/rts7751r2d/setup.c | 31 |
6 files changed, 632 insertions, 0 deletions
diff --git a/arch/sh/boards/renesas/rts7751r2d/Makefile b/arch/sh/boards/renesas/rts7751r2d/Makefile new file mode 100644 index 000000000000..daa53334bdc3 --- /dev/null +++ b/arch/sh/boards/renesas/rts7751r2d/Makefile | |||
@@ -0,0 +1,10 @@ | |||
1 | # | ||
2 | # Makefile for the RTS7751R2D specific parts of the kernel | ||
3 | # | ||
4 | # Note! Dependencies are done automagically by 'make dep', which also | ||
5 | # removes any old dependencies. DON'T put your own dependencies here | ||
6 | # unless it's something special (ie not a .c file). | ||
7 | # | ||
8 | |||
9 | obj-y := mach.o setup.o io.o irq.o led.o | ||
10 | |||
diff --git a/arch/sh/boards/renesas/rts7751r2d/io.c b/arch/sh/boards/renesas/rts7751r2d/io.c new file mode 100644 index 000000000000..c46f9154cfd5 --- /dev/null +++ b/arch/sh/boards/renesas/rts7751r2d/io.c | |||
@@ -0,0 +1,319 @@ | |||
1 | /* | ||
2 | * linux/arch/sh/kernel/io_rts7751r2d.c | ||
3 | * | ||
4 | * Copyright (C) 2001 Ian da Silva, Jeremy Siegel | ||
5 | * Based largely on io_se.c. | ||
6 | * | ||
7 | * I/O routine for Renesas Technology sales RTS7751R2D. | ||
8 | * | ||
9 | * Initial version only to support LAN access; some | ||
10 | * placeholder code from io_rts7751r2d.c left in with the | ||
11 | * expectation of later SuperIO and PCMCIA access. | ||
12 | */ | ||
13 | |||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/types.h> | ||
16 | #include <asm/io.h> | ||
17 | #include <asm/rts7751r2d/rts7751r2d.h> | ||
18 | #include <asm/addrspace.h> | ||
19 | |||
20 | #include <linux/module.h> | ||
21 | #include <linux/pci.h> | ||
22 | #include "../../../drivers/pci/pci-sh7751.h" | ||
23 | |||
24 | /* | ||
25 | * The 7751R RTS7751R2D uses the built-in PCI controller (PCIC) | ||
26 | * of the 7751R processor, and has a SuperIO accessible via the PCI. | ||
27 | * The board also includes a PCMCIA controller on its memory bus, | ||
28 | * like the other Solution Engine boards. | ||
29 | */ | ||
30 | |||
31 | #define PCIIOBR (volatile long *)PCI_REG(SH7751_PCIIOBR) | ||
32 | #define PCIMBR (volatile long *)PCI_REG(SH7751_PCIMBR) | ||
33 | #define PCI_IO_AREA SH7751_PCI_IO_BASE | ||
34 | #define PCI_MEM_AREA SH7751_PCI_CONFIG_BASE | ||
35 | |||
36 | #define PCI_IOMAP(adr) (PCI_IO_AREA + (adr & ~SH7751_PCIIOBR_MASK)) | ||
37 | |||
38 | #define maybebadio(name,port) \ | ||
39 | printk("bad PC-like io %s for port 0x%lx at 0x%08x\n", \ | ||
40 | #name, (port), (__u32) __builtin_return_address(0)) | ||
41 | |||
42 | static inline void delay(void) | ||
43 | { | ||
44 | ctrl_inw(0xa0000000); | ||
45 | } | ||
46 | |||
47 | static inline unsigned long port2adr(unsigned int port) | ||
48 | { | ||
49 | if ((0x1f0 <= port && port < 0x1f8) || port == 0x3f6) | ||
50 | if (port == 0x3f6) | ||
51 | return (PA_AREA5_IO + 0x80c); | ||
52 | else | ||
53 | return (PA_AREA5_IO + 0x1000 + ((port-0x1f0) << 1)); | ||
54 | else | ||
55 | maybebadio(port2adr, (unsigned long)port); | ||
56 | |||
57 | return port; | ||
58 | } | ||
59 | |||
60 | static inline unsigned long port88796l(unsigned int port, int flag) | ||
61 | { | ||
62 | unsigned long addr; | ||
63 | |||
64 | if (flag) | ||
65 | addr = PA_AX88796L + ((port - AX88796L_IO_BASE) << 1); | ||
66 | else | ||
67 | addr = PA_AX88796L + ((port - AX88796L_IO_BASE) << 1) + 0x1000; | ||
68 | |||
69 | return addr; | ||
70 | } | ||
71 | |||
72 | /* The 7751R RTS7751R2D seems to have everything hooked */ | ||
73 | /* up pretty normally (nothing on high-bytes only...) so this */ | ||
74 | /* shouldn't be needed */ | ||
75 | static inline int shifted_port(unsigned long port) | ||
76 | { | ||
77 | /* For IDE registers, value is not shifted */ | ||
78 | if ((0x1f0 <= port && port < 0x1f8) || port == 0x3f6) | ||
79 | return 0; | ||
80 | else | ||
81 | return 1; | ||
82 | } | ||
83 | |||
84 | /* In case someone configures the kernel w/o PCI support: in that */ | ||
85 | /* scenario, don't ever bother to check for PCI-window addresses */ | ||
86 | |||
87 | /* NOTE: WINDOW CHECK MAY BE A BIT OFF, HIGH PCIBIOS_MIN_IO WRAPS? */ | ||
88 | #if defined(CONFIG_PCI) | ||
89 | #define CHECK_SH7751_PCIIO(port) \ | ||
90 | ((port >= PCIBIOS_MIN_IO) && (port < (PCIBIOS_MIN_IO + SH7751_PCI_IO_SIZE))) | ||
91 | #else | ||
92 | #define CHECK_SH7751_PCIIO(port) (0) | ||
93 | #endif | ||
94 | |||
95 | #if defined(CONFIG_NE2000) || defined(CONFIG_NE2000_MODULE) | ||
96 | #define CHECK_AX88796L_PORT(port) \ | ||
97 | ((port >= AX88796L_IO_BASE) && (port < (AX88796L_IO_BASE+0x20))) | ||
98 | #else | ||
99 | #define CHECK_AX88796L_PORT(port) (0) | ||
100 | #endif | ||
101 | |||
102 | /* | ||
103 | * General outline: remap really low stuff [eventually] to SuperIO, | ||
104 | * stuff in PCI IO space (at or above window at pci.h:PCIBIOS_MIN_IO) | ||
105 | * is mapped through the PCI IO window. Stuff with high bits (PXSEG) | ||
106 | * should be way beyond the window, and is used w/o translation for | ||
107 | * compatibility. | ||
108 | */ | ||
109 | unsigned char rts7751r2d_inb(unsigned long port) | ||
110 | { | ||
111 | if (CHECK_AX88796L_PORT(port)) | ||
112 | return (*(volatile unsigned short *)port88796l(port, 0)) & 0xff; | ||
113 | else if (PXSEG(port)) | ||
114 | return *(volatile unsigned char *)port; | ||
115 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) | ||
116 | return *(volatile unsigned char *)PCI_IOMAP(port); | ||
117 | else | ||
118 | return (*(volatile unsigned short *)port2adr(port) & 0xff); | ||
119 | } | ||
120 | |||
121 | unsigned char rts7751r2d_inb_p(unsigned long port) | ||
122 | { | ||
123 | unsigned char v; | ||
124 | |||
125 | if (CHECK_AX88796L_PORT(port)) | ||
126 | v = (*(volatile unsigned short *)port88796l(port, 0)) & 0xff; | ||
127 | else if (PXSEG(port)) | ||
128 | v = *(volatile unsigned char *)port; | ||
129 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) | ||
130 | v = *(volatile unsigned char *)PCI_IOMAP(port); | ||
131 | else | ||
132 | v = (*(volatile unsigned short *)port2adr(port) & 0xff); | ||
133 | delay(); | ||
134 | |||
135 | return v; | ||
136 | } | ||
137 | |||
138 | unsigned short rts7751r2d_inw(unsigned long port) | ||
139 | { | ||
140 | if (CHECK_AX88796L_PORT(port)) | ||
141 | maybebadio(inw, port); | ||
142 | else if (PXSEG(port)) | ||
143 | return *(volatile unsigned short *)port; | ||
144 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) | ||
145 | return *(volatile unsigned short *)PCI_IOMAP(port); | ||
146 | else | ||
147 | maybebadio(inw, port); | ||
148 | |||
149 | return 0; | ||
150 | } | ||
151 | |||
152 | unsigned int rts7751r2d_inl(unsigned long port) | ||
153 | { | ||
154 | if (CHECK_AX88796L_PORT(port)) | ||
155 | maybebadio(inl, port); | ||
156 | else if (PXSEG(port)) | ||
157 | return *(volatile unsigned long *)port; | ||
158 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) | ||
159 | return *(volatile unsigned long *)PCI_IOMAP(port); | ||
160 | else | ||
161 | maybebadio(inl, port); | ||
162 | |||
163 | return 0; | ||
164 | } | ||
165 | |||
166 | void rts7751r2d_outb(unsigned char value, unsigned long port) | ||
167 | { | ||
168 | if (CHECK_AX88796L_PORT(port)) | ||
169 | *((volatile unsigned short *)port88796l(port, 0)) = value; | ||
170 | else if (PXSEG(port)) | ||
171 | *(volatile unsigned char *)port = value; | ||
172 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) | ||
173 | *(volatile unsigned char *)PCI_IOMAP(port) = value; | ||
174 | else | ||
175 | *(volatile unsigned short *)port2adr(port) = value; | ||
176 | } | ||
177 | |||
178 | void rts7751r2d_outb_p(unsigned char value, unsigned long port) | ||
179 | { | ||
180 | if (CHECK_AX88796L_PORT(port)) | ||
181 | *((volatile unsigned short *)port88796l(port, 0)) = value; | ||
182 | else if (PXSEG(port)) | ||
183 | *(volatile unsigned char *)port = value; | ||
184 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) | ||
185 | *(volatile unsigned char *)PCI_IOMAP(port) = value; | ||
186 | else | ||
187 | *(volatile unsigned short *)port2adr(port) = value; | ||
188 | delay(); | ||
189 | } | ||
190 | |||
191 | void rts7751r2d_outw(unsigned short value, unsigned long port) | ||
192 | { | ||
193 | if (CHECK_AX88796L_PORT(port)) | ||
194 | maybebadio(outw, port); | ||
195 | else if (PXSEG(port)) | ||
196 | *(volatile unsigned short *)port = value; | ||
197 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) | ||
198 | *(volatile unsigned short *)PCI_IOMAP(port) = value; | ||
199 | else | ||
200 | maybebadio(outw, port); | ||
201 | } | ||
202 | |||
203 | void rts7751r2d_outl(unsigned int value, unsigned long port) | ||
204 | { | ||
205 | if (CHECK_AX88796L_PORT(port)) | ||
206 | maybebadio(outl, port); | ||
207 | else if (PXSEG(port)) | ||
208 | *(volatile unsigned long *)port = value; | ||
209 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) | ||
210 | *(volatile unsigned long *)PCI_IOMAP(port) = value; | ||
211 | else | ||
212 | maybebadio(outl, port); | ||
213 | } | ||
214 | |||
215 | void rts7751r2d_insb(unsigned long port, void *addr, unsigned long count) | ||
216 | { | ||
217 | volatile __u8 *bp; | ||
218 | volatile __u16 *p; | ||
219 | |||
220 | if (CHECK_AX88796L_PORT(port)) { | ||
221 | p = (volatile unsigned short *)port88796l(port, 0); | ||
222 | while (count--) *((unsigned char *) addr)++ = *p & 0xff; | ||
223 | } else if (PXSEG(port)) | ||
224 | while (count--) *((unsigned char *) addr)++ = *(volatile unsigned char *)port; | ||
225 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) { | ||
226 | bp = (__u8 *)PCI_IOMAP(port); | ||
227 | while (count--) *((volatile unsigned char *) addr)++ = *bp; | ||
228 | } else { | ||
229 | p = (volatile unsigned short *)port2adr(port); | ||
230 | while (count--) *((unsigned char *) addr)++ = *p & 0xff; | ||
231 | } | ||
232 | } | ||
233 | |||
234 | void rts7751r2d_insw(unsigned long port, void *addr, unsigned long count) | ||
235 | { | ||
236 | volatile __u16 *p; | ||
237 | |||
238 | if (CHECK_AX88796L_PORT(port)) | ||
239 | p = (volatile unsigned short *)port88796l(port, 1); | ||
240 | else if (PXSEG(port)) | ||
241 | p = (volatile unsigned short *)port; | ||
242 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) | ||
243 | p = (volatile unsigned short *)PCI_IOMAP(port); | ||
244 | else | ||
245 | p = (volatile unsigned short *)port2adr(port); | ||
246 | while (count--) *((__u16 *) addr)++ = *p; | ||
247 | } | ||
248 | |||
249 | void rts7751r2d_insl(unsigned long port, void *addr, unsigned long count) | ||
250 | { | ||
251 | if (CHECK_AX88796L_PORT(port)) | ||
252 | maybebadio(insl, port); | ||
253 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) { | ||
254 | volatile __u32 *p = (__u32 *)PCI_IOMAP(port); | ||
255 | |||
256 | while (count--) *((__u32 *) addr)++ = *p; | ||
257 | } else | ||
258 | maybebadio(insl, port); | ||
259 | } | ||
260 | |||
261 | void rts7751r2d_outsb(unsigned long port, const void *addr, unsigned long count) | ||
262 | { | ||
263 | volatile __u8 *bp; | ||
264 | volatile __u16 *p; | ||
265 | |||
266 | if (CHECK_AX88796L_PORT(port)) { | ||
267 | p = (volatile unsigned short *)port88796l(port, 0); | ||
268 | while (count--) *p = *((unsigned char *) addr)++; | ||
269 | } else if (PXSEG(port)) | ||
270 | while (count--) *(volatile unsigned char *)port = *((unsigned char *) addr)++; | ||
271 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) { | ||
272 | bp = (__u8 *)PCI_IOMAP(port); | ||
273 | while (count--) *bp = *((volatile unsigned char *) addr)++; | ||
274 | } else { | ||
275 | p = (volatile unsigned short *)port2adr(port); | ||
276 | while (count--) *p = *((unsigned char *) addr)++; | ||
277 | } | ||
278 | } | ||
279 | |||
280 | void rts7751r2d_outsw(unsigned long port, const void *addr, unsigned long count) | ||
281 | { | ||
282 | volatile __u16 *p; | ||
283 | |||
284 | if (CHECK_AX88796L_PORT(port)) | ||
285 | p = (volatile unsigned short *)port88796l(port, 1); | ||
286 | else if (PXSEG(port)) | ||
287 | p = (volatile unsigned short *)port; | ||
288 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) | ||
289 | p = (volatile unsigned short *)PCI_IOMAP(port); | ||
290 | else | ||
291 | p = (volatile unsigned short *)port2adr(port); | ||
292 | while (count--) *p = *((__u16 *) addr)++; | ||
293 | } | ||
294 | |||
295 | void rts7751r2d_outsl(unsigned long port, const void *addr, unsigned long count) | ||
296 | { | ||
297 | if (CHECK_AX88796L_PORT(port)) | ||
298 | maybebadio(outsl, port); | ||
299 | else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) { | ||
300 | volatile __u32 *p = (__u32 *)PCI_IOMAP(port); | ||
301 | |||
302 | while (count--) *p = *((__u32 *) addr)++; | ||
303 | } else | ||
304 | maybebadio(outsl, port); | ||
305 | } | ||
306 | |||
307 | void *rts7751r2d_ioremap(unsigned long offset, unsigned long size) | ||
308 | { | ||
309 | if (offset >= 0xfd000000) | ||
310 | return (void *)offset; | ||
311 | else | ||
312 | return (void *)P2SEGADDR(offset); | ||
313 | } | ||
314 | EXPORT_SYMBOL(rts7751r2d_ioremap); | ||
315 | |||
316 | unsigned long rts7751r2d_isa_port2addr(unsigned long offset) | ||
317 | { | ||
318 | return port2adr(offset); | ||
319 | } | ||
diff --git a/arch/sh/boards/renesas/rts7751r2d/irq.c b/arch/sh/boards/renesas/rts7751r2d/irq.c new file mode 100644 index 000000000000..95717f4f1e2d --- /dev/null +++ b/arch/sh/boards/renesas/rts7751r2d/irq.c | |||
@@ -0,0 +1,135 @@ | |||
1 | /* | ||
2 | * linux/arch/sh/boards/renesas/rts7751r2d/irq.c | ||
3 | * | ||
4 | * Copyright (C) 2000 Kazumoto Kojima | ||
5 | * | ||
6 | * Renesas Technology Sales RTS7751R2D Support. | ||
7 | * | ||
8 | * Modified for RTS7751R2D by | ||
9 | * Atom Create Engineering Co., Ltd. 2002. | ||
10 | */ | ||
11 | |||
12 | #include <linux/config.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/irq.h> | ||
15 | #include <asm/io.h> | ||
16 | #include <asm/irq.h> | ||
17 | #include <asm/rts7751r2d/rts7751r2d.h> | ||
18 | |||
19 | #if defined(CONFIG_RTS7751R2D_REV11) | ||
20 | static int mask_pos[] = {11, 9, 8, 12, 10, 6, 5, 4, 7, 14, 13, 0, 0, 0, 0}; | ||
21 | #else | ||
22 | static int mask_pos[] = {6, 11, 9, 8, 12, 10, 5, 4, 7, 14, 13, 0, 0, 0, 0}; | ||
23 | #endif | ||
24 | |||
25 | extern int voyagergx_irq_demux(int irq); | ||
26 | extern void setup_voyagergx_irq(void); | ||
27 | |||
28 | static void enable_rts7751r2d_irq(unsigned int irq); | ||
29 | static void disable_rts7751r2d_irq(unsigned int irq); | ||
30 | |||
31 | /* shutdown is same as "disable" */ | ||
32 | #define shutdown_rts7751r2d_irq disable_rts7751r2d_irq | ||
33 | |||
34 | static void ack_rts7751r2d_irq(unsigned int irq); | ||
35 | static void end_rts7751r2d_irq(unsigned int irq); | ||
36 | |||
37 | static unsigned int startup_rts7751r2d_irq(unsigned int irq) | ||
38 | { | ||
39 | enable_rts7751r2d_irq(irq); | ||
40 | return 0; /* never anything pending */ | ||
41 | } | ||
42 | |||
43 | static void disable_rts7751r2d_irq(unsigned int irq) | ||
44 | { | ||
45 | unsigned long flags; | ||
46 | unsigned short val; | ||
47 | unsigned short mask = 0xffff ^ (0x0001 << mask_pos[irq]); | ||
48 | |||
49 | /* Set the priority in IPR to 0 */ | ||
50 | local_irq_save(flags); | ||
51 | val = ctrl_inw(IRLCNTR1); | ||
52 | val &= mask; | ||
53 | ctrl_outw(val, IRLCNTR1); | ||
54 | local_irq_restore(flags); | ||
55 | } | ||
56 | |||
57 | static void enable_rts7751r2d_irq(unsigned int irq) | ||
58 | { | ||
59 | unsigned long flags; | ||
60 | unsigned short val; | ||
61 | unsigned short value = (0x0001 << mask_pos[irq]); | ||
62 | |||
63 | /* Set priority in IPR back to original value */ | ||
64 | local_irq_save(flags); | ||
65 | val = ctrl_inw(IRLCNTR1); | ||
66 | val |= value; | ||
67 | ctrl_outw(val, IRLCNTR1); | ||
68 | local_irq_restore(flags); | ||
69 | } | ||
70 | |||
71 | int rts7751r2d_irq_demux(int irq) | ||
72 | { | ||
73 | int demux_irq; | ||
74 | |||
75 | demux_irq = voyagergx_irq_demux(irq); | ||
76 | return demux_irq; | ||
77 | } | ||
78 | |||
79 | static void ack_rts7751r2d_irq(unsigned int irq) | ||
80 | { | ||
81 | disable_rts7751r2d_irq(irq); | ||
82 | } | ||
83 | |||
84 | static void end_rts7751r2d_irq(unsigned int irq) | ||
85 | { | ||
86 | if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) | ||
87 | enable_rts7751r2d_irq(irq); | ||
88 | } | ||
89 | |||
90 | static struct hw_interrupt_type rts7751r2d_irq_type = { | ||
91 | "RTS7751R2D IRQ", | ||
92 | startup_rts7751r2d_irq, | ||
93 | shutdown_rts7751r2d_irq, | ||
94 | enable_rts7751r2d_irq, | ||
95 | disable_rts7751r2d_irq, | ||
96 | ack_rts7751r2d_irq, | ||
97 | end_rts7751r2d_irq, | ||
98 | }; | ||
99 | |||
100 | static void make_rts7751r2d_irq(unsigned int irq) | ||
101 | { | ||
102 | disable_irq_nosync(irq); | ||
103 | irq_desc[irq].handler = &rts7751r2d_irq_type; | ||
104 | disable_rts7751r2d_irq(irq); | ||
105 | } | ||
106 | |||
107 | /* | ||
108 | * Initialize IRQ setting | ||
109 | */ | ||
110 | void __init init_rts7751r2d_IRQ(void) | ||
111 | { | ||
112 | int i; | ||
113 | |||
114 | /* IRL0=KEY Input | ||
115 | * IRL1=Ethernet | ||
116 | * IRL2=CF Card | ||
117 | * IRL3=CF Card Insert | ||
118 | * IRL4=PCMCIA | ||
119 | * IRL5=VOYAGER | ||
120 | * IRL6=RTC Alarm | ||
121 | * IRL7=RTC Timer | ||
122 | * IRL8=SD Card | ||
123 | * IRL9=PCI Slot #1 | ||
124 | * IRL10=PCI Slot #2 | ||
125 | * IRL11=Extention #0 | ||
126 | * IRL12=Extention #1 | ||
127 | * IRL13=Extention #2 | ||
128 | * IRL14=Extention #3 | ||
129 | */ | ||
130 | |||
131 | for (i=0; i<15; i++) | ||
132 | make_rts7751r2d_irq(i); | ||
133 | |||
134 | setup_voyagergx_irq(); | ||
135 | } | ||
diff --git a/arch/sh/boards/renesas/rts7751r2d/led.c b/arch/sh/boards/renesas/rts7751r2d/led.c new file mode 100644 index 000000000000..9993259a894f --- /dev/null +++ b/arch/sh/boards/renesas/rts7751r2d/led.c | |||
@@ -0,0 +1,67 @@ | |||
1 | /* | ||
2 | * linux/arch/sh/kernel/led_rts7751r2d.c | ||
3 | * | ||
4 | * Copyright (C) Atom Create Engineering Co., Ltd. | ||
5 | * | ||
6 | * May be copied or modified under the terms of GNU General Public | ||
7 | * License. See linux/COPYING for more information. | ||
8 | * | ||
9 | * This file contains Renesas Technology Sales RTS7751R2D specific LED code. | ||
10 | */ | ||
11 | |||
12 | #include <linux/config.h> | ||
13 | #include <asm/io.h> | ||
14 | #include <asm/rts7751r2d/rts7751r2d.h> | ||
15 | |||
16 | extern unsigned int debug_counter; | ||
17 | |||
18 | #ifdef CONFIG_HEARTBEAT | ||
19 | |||
20 | #include <linux/sched.h> | ||
21 | |||
22 | /* Cycle the LED's in the clasic Knightriger/Sun pattern */ | ||
23 | void heartbeat_rts7751r2d(void) | ||
24 | { | ||
25 | static unsigned int cnt = 0, period = 0; | ||
26 | volatile unsigned short *p = (volatile unsigned short *)PA_OUTPORT; | ||
27 | static unsigned bit = 0, up = 1; | ||
28 | |||
29 | cnt += 1; | ||
30 | if (cnt < period) | ||
31 | return; | ||
32 | |||
33 | cnt = 0; | ||
34 | |||
35 | /* Go through the points (roughly!): | ||
36 | * f(0)=10, f(1)=16, f(2)=20, f(5)=35, f(int)->110 | ||
37 | */ | ||
38 | period = 110 - ((300 << FSHIFT)/((avenrun[0]/5) + (3<<FSHIFT))); | ||
39 | |||
40 | *p = 1 << bit; | ||
41 | if (up) | ||
42 | if (bit == 7) { | ||
43 | bit--; | ||
44 | up = 0; | ||
45 | } else | ||
46 | bit++; | ||
47 | else if (bit == 0) | ||
48 | up = 1; | ||
49 | else | ||
50 | bit--; | ||
51 | } | ||
52 | #endif /* CONFIG_HEARTBEAT */ | ||
53 | |||
54 | void rts7751r2d_led(unsigned short value) | ||
55 | { | ||
56 | ctrl_outw(value, PA_OUTPORT); | ||
57 | } | ||
58 | |||
59 | void debug_led_disp(void) | ||
60 | { | ||
61 | unsigned short value; | ||
62 | |||
63 | value = (unsigned short)debug_counter++; | ||
64 | rts7751r2d_led(value); | ||
65 | if (value == 0xff) | ||
66 | debug_counter = 0; | ||
67 | } | ||
diff --git a/arch/sh/boards/renesas/rts7751r2d/mach.c b/arch/sh/boards/renesas/rts7751r2d/mach.c new file mode 100644 index 000000000000..1efc18e786d5 --- /dev/null +++ b/arch/sh/boards/renesas/rts7751r2d/mach.c | |||
@@ -0,0 +1,70 @@ | |||
1 | /* | ||
2 | * linux/arch/sh/kernel/mach_rts7751r2d.c | ||
3 | * | ||
4 | * Minor tweak of mach_se.c file to reference rts7751r2d-specific items. | ||
5 | * | ||
6 | * May be copied or modified under the terms of the GNU General Public | ||
7 | * License. See linux/COPYING for more information. | ||
8 | * | ||
9 | * Machine vector for the Renesas Technology sales RTS7751R2D | ||
10 | */ | ||
11 | |||
12 | #include <linux/config.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/types.h> | ||
15 | |||
16 | #include <asm/machvec.h> | ||
17 | #include <asm/rtc.h> | ||
18 | #include <asm/irq.h> | ||
19 | #include <asm/rts7751r2d/io.h> | ||
20 | |||
21 | extern void heartbeat_rts7751r2d(void); | ||
22 | extern void init_rts7751r2d_IRQ(void); | ||
23 | extern void *rts7751r2d_ioremap(unsigned long, unsigned long); | ||
24 | extern int rts7751r2d_irq_demux(int irq); | ||
25 | |||
26 | extern void *voyagergx_consistent_alloc(struct device *, size_t, dma_addr_t *, int); | ||
27 | extern int voyagergx_consistent_free(struct device *, size_t, void *, dma_addr_t); | ||
28 | |||
29 | /* | ||
30 | * The Machine Vector | ||
31 | */ | ||
32 | |||
33 | struct sh_machine_vector mv_rts7751r2d __initmv = { | ||
34 | .mv_nr_irqs = 72, | ||
35 | |||
36 | .mv_inb = rts7751r2d_inb, | ||
37 | .mv_inw = rts7751r2d_inw, | ||
38 | .mv_inl = rts7751r2d_inl, | ||
39 | .mv_outb = rts7751r2d_outb, | ||
40 | .mv_outw = rts7751r2d_outw, | ||
41 | .mv_outl = rts7751r2d_outl, | ||
42 | |||
43 | .mv_inb_p = rts7751r2d_inb_p, | ||
44 | .mv_inw_p = rts7751r2d_inw, | ||
45 | .mv_inl_p = rts7751r2d_inl, | ||
46 | .mv_outb_p = rts7751r2d_outb_p, | ||
47 | .mv_outw_p = rts7751r2d_outw, | ||
48 | .mv_outl_p = rts7751r2d_outl, | ||
49 | |||
50 | .mv_insb = rts7751r2d_insb, | ||
51 | .mv_insw = rts7751r2d_insw, | ||
52 | .mv_insl = rts7751r2d_insl, | ||
53 | .mv_outsb = rts7751r2d_outsb, | ||
54 | .mv_outsw = rts7751r2d_outsw, | ||
55 | .mv_outsl = rts7751r2d_outsl, | ||
56 | |||
57 | .mv_ioremap = rts7751r2d_ioremap, | ||
58 | .mv_isa_port2addr = rts7751r2d_isa_port2addr, | ||
59 | .mv_init_irq = init_rts7751r2d_IRQ, | ||
60 | #ifdef CONFIG_HEARTBEAT | ||
61 | .mv_heartbeat = heartbeat_rts7751r2d, | ||
62 | #endif | ||
63 | .mv_irq_demux = rts7751r2d_irq_demux, | ||
64 | |||
65 | #ifdef CONFIG_USB_OHCI_HCD | ||
66 | .mv_consistent_alloc = voyagergx_consistent_alloc, | ||
67 | .mv_consistent_free = voyagergx_consistent_free, | ||
68 | #endif | ||
69 | }; | ||
70 | ALIAS_MV(rts7751r2d) | ||
diff --git a/arch/sh/boards/renesas/rts7751r2d/setup.c b/arch/sh/boards/renesas/rts7751r2d/setup.c new file mode 100644 index 000000000000..2587fd1a0240 --- /dev/null +++ b/arch/sh/boards/renesas/rts7751r2d/setup.c | |||
@@ -0,0 +1,31 @@ | |||
1 | /* | ||
2 | * linux/arch/sh/kernel/setup_rts7751r2d.c | ||
3 | * | ||
4 | * Copyright (C) 2000 Kazumoto Kojima | ||
5 | * | ||
6 | * Renesas Technology Sales RTS7751R2D Support. | ||
7 | * | ||
8 | * Modified for RTS7751R2D by | ||
9 | * Atom Create Engineering Co., Ltd. 2002. | ||
10 | */ | ||
11 | |||
12 | #include <linux/init.h> | ||
13 | #include <asm/io.h> | ||
14 | #include <asm/rts7751r2d/rts7751r2d.h> | ||
15 | |||
16 | unsigned int debug_counter; | ||
17 | |||
18 | const char *get_system_type(void) | ||
19 | { | ||
20 | return "RTS7751R2D"; | ||
21 | } | ||
22 | |||
23 | /* | ||
24 | * Initialize the board | ||
25 | */ | ||
26 | void __init platform_setup(void) | ||
27 | { | ||
28 | printk(KERN_INFO "Renesas Technology Sales RTS7751R2D support.\n"); | ||
29 | ctrl_outw(0x0000, PA_OUTPORT); | ||
30 | debug_counter = 0; | ||
31 | } | ||