aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boards
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2006-09-27 02:41:24 -0400
committerPaul Mundt <lethal@linux-sh.org>2006-09-27 02:41:24 -0400
commit373e68b5472d421cbd2703e7a77caf053f78c005 (patch)
tree6fed51fdf1b89f80a1ec9ea4aab285c1af649945 /arch/sh/boards
parentf647d33f879d258de4ab2559975bd6eebda2033e (diff)
sh: Board updates for I/O routine rework.
This updates the various boards for some of the recent I/O routine updates. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/boards')
-rw-r--r--arch/sh/boards/renesas/hs7751rvoip/io.c159
-rw-r--r--arch/sh/boards/renesas/hs7751rvoip/setup.c5
-rw-r--r--arch/sh/boards/renesas/systemh/io.c96
-rw-r--r--arch/sh/boards/renesas/systemh/irq.c2
-rw-r--r--arch/sh/boards/renesas/systemh/setup.c14
-rw-r--r--arch/sh/boards/se/7300/io.c8
-rw-r--r--arch/sh/boards/se/7300/irq.c2
-rw-r--r--arch/sh/boards/se/7300/led.c18
-rw-r--r--arch/sh/boards/se/7300/setup.c3
-rw-r--r--arch/sh/boards/se/73180/setup.c3
-rw-r--r--arch/sh/boards/se/770x/io.c52
-rw-r--r--arch/sh/boards/se/770x/irq.c2
-rw-r--r--arch/sh/boards/se/770x/led.c2
-rw-r--r--arch/sh/boards/se/770x/mach.c7
-rw-r--r--arch/sh/boards/se/770x/setup.c2
-rw-r--r--arch/sh/boards/se/7751/io.c26
-rw-r--r--arch/sh/boards/se/7751/irq.c2
-rw-r--r--arch/sh/boards/se/7751/led.c3
-rw-r--r--arch/sh/boards/se/7751/mach.c8
-rw-r--r--arch/sh/boards/se/7751/setup.c6
-rw-r--r--arch/sh/boards/sh03/setup.c25
-rw-r--r--arch/sh/boards/snapgear/io.c63
-rw-r--r--arch/sh/boards/snapgear/rtc.c3
-rw-r--r--arch/sh/boards/snapgear/setup.c97
-rw-r--r--arch/sh/boards/titan/io.c4
25 files changed, 163 insertions, 449 deletions
diff --git a/arch/sh/boards/renesas/hs7751rvoip/io.c b/arch/sh/boards/renesas/hs7751rvoip/io.c
index edecf107fc13..ecdce7ef6a34 100644
--- a/arch/sh/boards/renesas/hs7751rvoip/io.c
+++ b/arch/sh/boards/renesas/hs7751rvoip/io.c
@@ -21,10 +21,8 @@
21#include <linux/pci.h> 21#include <linux/pci.h>
22#include "../../../drivers/pci/pci-sh7751.h" 22#include "../../../drivers/pci/pci-sh7751.h"
23 23
24extern void *area5_io8_base; /* Area 5 8bit I/O Base address */
25extern void *area6_io8_base; /* Area 6 8bit I/O Base address */ 24extern void *area6_io8_base; /* Area 6 8bit I/O Base address */
26extern void *area5_io16_base; /* Area 5 16bit I/O Base address */ 25extern void *area5_io16_base; /* Area 5 16bit I/O Base address */
27extern void *area6_io16_base; /* Area 6 16bit I/O Base address */
28 26
29/* 27/*
30 * The 7751R HS7751RVoIP uses the built-in PCI controller (PCIC) 28 * The 7751R HS7751RVoIP uses the built-in PCI controller (PCIC)
@@ -37,16 +35,10 @@ extern void *area6_io16_base; /* Area 6 16bit I/O Base address */
37#define PCIMBR (volatile long *)PCI_REG(SH7751_PCIMBR) 35#define PCIMBR (volatile long *)PCI_REG(SH7751_PCIMBR)
38#define PCI_IO_AREA SH7751_PCI_IO_BASE 36#define PCI_IO_AREA SH7751_PCI_IO_BASE
39#define PCI_MEM_AREA SH7751_PCI_CONFIG_BASE 37#define PCI_MEM_AREA SH7751_PCI_CONFIG_BASE
40
41#define PCI_IOMAP(adr) (PCI_IO_AREA + (adr & ~SH7751_PCIIOBR_MASK)) 38#define PCI_IOMAP(adr) (PCI_IO_AREA + (adr & ~SH7751_PCIIOBR_MASK))
42 39
43#if defined(CONFIG_HS7751RVOIP_CODEC)
44#define CODEC_IO_BASE 0x1000 40#define CODEC_IO_BASE 0x1000
45#endif 41#define CODEC_IOMAP(a) ((unsigned long)area6_io8_base + ((a) - CODEC_IO_BASE))
46
47#define maybebadio(name,port) \
48 printk("bad PC-like io %s for port 0x%lx at 0x%08x\n", \
49 #name, (port), (__u32) __builtin_return_address(0))
50 42
51static inline void delay(void) 43static inline void delay(void)
52{ 44{
@@ -61,7 +53,7 @@ static inline unsigned long port2adr(unsigned int port)
61 else 53 else
62 return ((unsigned long)area5_io16_base + 0x800 + ((port-0x1f0) << 1)); 54 return ((unsigned long)area5_io16_base + 0x800 + ((port-0x1f0) << 1));
63 else 55 else
64 maybebadio(port2adr, (unsigned long)port); 56 maybebadio((unsigned long)port);
65 return port; 57 return port;
66} 58}
67 59
@@ -109,15 +101,15 @@ codec_port(unsigned long port)
109unsigned char hs7751rvoip_inb(unsigned long port) 101unsigned char hs7751rvoip_inb(unsigned long port)
110{ 102{
111 if (PXSEG(port)) 103 if (PXSEG(port))
112 return *(volatile unsigned char *)port; 104 return ctrl_inb(port);
113#if defined(CONFIG_HS7751RVOIP_CODEC) 105#if defined(CONFIG_HS7751RVOIP_CODEC)
114 else if (codec_port(port)) 106 else if (codec_port(port))
115 return *(volatile unsigned char *)((unsigned long)area6_io8_base+(port-CODEC_IO_BASE)); 107 return ctrl_inb(CODEC_IOMAP(port));
116#endif 108#endif
117 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) 109 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port))
118 return *(volatile unsigned char *)PCI_IOMAP(port); 110 return ctrl_inb(PCI_IOMAP(port));
119 else 111 else
120 return (*(volatile unsigned short *)port2adr(port) & 0xff); 112 return ctrl_inw(port2adr(port)) & 0xff;
121} 113}
122 114
123unsigned char hs7751rvoip_inb_p(unsigned long port) 115unsigned char hs7751rvoip_inb_p(unsigned long port)
@@ -125,15 +117,15 @@ unsigned char hs7751rvoip_inb_p(unsigned long port)
125 unsigned char v; 117 unsigned char v;
126 118
127 if (PXSEG(port)) 119 if (PXSEG(port))
128 v = *(volatile unsigned char *)port; 120 v = ctrl_inb(port);
129#if defined(CONFIG_HS7751RVOIP_CODEC) 121#if defined(CONFIG_HS7751RVOIP_CODEC)
130 else if (codec_port(port)) 122 else if (codec_port(port))
131 v = *(volatile unsigned char *)((unsigned long)area6_io8_base+(port-CODEC_IO_BASE)); 123 v = ctrl_inb(CODEC_IOMAP(port));
132#endif 124#endif
133 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) 125 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port))
134 v = *(volatile unsigned char *)PCI_IOMAP(port); 126 v = ctrl_inb(PCI_IOMAP(port));
135 else 127 else
136 v = (*(volatile unsigned short *)port2adr(port) & 0xff); 128 v = ctrl_inw(port2adr(port)) & 0xff;
137 delay(); 129 delay();
138 return v; 130 return v;
139} 131}
@@ -141,22 +133,22 @@ unsigned char hs7751rvoip_inb_p(unsigned long port)
141unsigned short hs7751rvoip_inw(unsigned long port) 133unsigned short hs7751rvoip_inw(unsigned long port)
142{ 134{
143 if (PXSEG(port)) 135 if (PXSEG(port))
144 return *(volatile unsigned short *)port; 136 return ctrl_inw(port);
145 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) 137 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port))
146 return *(volatile unsigned short *)PCI_IOMAP(port); 138 return ctrl_inw(PCI_IOMAP(port));
147 else 139 else
148 maybebadio(inw, port); 140 maybebadio(port);
149 return 0; 141 return 0;
150} 142}
151 143
152unsigned int hs7751rvoip_inl(unsigned long port) 144unsigned int hs7751rvoip_inl(unsigned long port)
153{ 145{
154 if (PXSEG(port)) 146 if (PXSEG(port))
155 return *(volatile unsigned long *)port; 147 return ctrl_inl(port);
156 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) 148 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port))
157 return *(volatile unsigned long *)PCI_IOMAP(port); 149 return ctrl_inl(PCI_IOMAP(port));
158 else 150 else
159 maybebadio(inl, port); 151 maybebadio(port);
160 return 0; 152 return 0;
161} 153}
162 154
@@ -164,137 +156,168 @@ void hs7751rvoip_outb(unsigned char value, unsigned long port)
164{ 156{
165 157
166 if (PXSEG(port)) 158 if (PXSEG(port))
167 *(volatile unsigned char *)port = value; 159 ctrl_outb(value, port);
168#if defined(CONFIG_HS7751RVOIP_CODEC) 160#if defined(CONFIG_HS7751RVOIP_CODEC)
169 else if (codec_port(port)) 161 else if (codec_port(port))
170 *(volatile unsigned char *)((unsigned long)area6_io8_base+(port-CODEC_IO_BASE)) = value; 162 ctrl_outb(value, CODEC_IOMAP(port));
171#endif 163#endif
172 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) 164 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port))
173 *(unsigned char *)PCI_IOMAP(port) = value; 165 ctrl_outb(value, PCI_IOMAP(port));
174 else 166 else
175 *(volatile unsigned short *)port2adr(port) = value; 167 ctrl_outb(value, port2adr(port));
176} 168}
177 169
178void hs7751rvoip_outb_p(unsigned char value, unsigned long port) 170void hs7751rvoip_outb_p(unsigned char value, unsigned long port)
179{ 171{
180 if (PXSEG(port)) 172 if (PXSEG(port))
181 *(volatile unsigned char *)port = value; 173 ctrl_outb(value, port);
182#if defined(CONFIG_HS7751RVOIP_CODEC) 174#if defined(CONFIG_HS7751RVOIP_CODEC)
183 else if (codec_port(port)) 175 else if (codec_port(port))
184 *(volatile unsigned char *)((unsigned long)area6_io8_base+(port-CODEC_IO_BASE)) = value; 176 ctrl_outb(value, CODEC_IOMAP(port));
185#endif 177#endif
186 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) 178 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port))
187 *(unsigned char *)PCI_IOMAP(port) = value; 179 ctrl_outb(value, PCI_IOMAP(port));
188 else 180 else
189 *(volatile unsigned short *)port2adr(port) = value; 181 ctrl_outw(value, port2adr(port));
182
190 delay(); 183 delay();
191} 184}
192 185
193void hs7751rvoip_outw(unsigned short value, unsigned long port) 186void hs7751rvoip_outw(unsigned short value, unsigned long port)
194{ 187{
195 if (PXSEG(port)) 188 if (PXSEG(port))
196 *(volatile unsigned short *)port = value; 189 ctrl_outw(value, port);
197 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) 190 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port))
198 *(unsigned short *)PCI_IOMAP(port) = value; 191 ctrl_outw(value, PCI_IOMAP(port));
199 else 192 else
200 maybebadio(outw, port); 193 maybebadio(port);
201} 194}
202 195
203void hs7751rvoip_outl(unsigned int value, unsigned long port) 196void hs7751rvoip_outl(unsigned int value, unsigned long port)
204{ 197{
205 if (PXSEG(port)) 198 if (PXSEG(port))
206 *(volatile unsigned long *)port = value; 199 ctrl_outl(value, port);
207 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) 200 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port))
208 *((unsigned long *)PCI_IOMAP(port)) = value; 201 ctrl_outl(value, PCI_IOMAP(port));
209 else 202 else
210 maybebadio(outl, port); 203 maybebadio(port);
211} 204}
212 205
213void hs7751rvoip_insb(unsigned long port, void *addr, unsigned long count) 206void hs7751rvoip_insb(unsigned long port, void *addr, unsigned long count)
214{ 207{
208 u8 *buf = addr;
209
215 if (PXSEG(port)) 210 if (PXSEG(port))
216 while (count--) *((unsigned char *) addr)++ = *(volatile unsigned char *)port; 211 while (count--)
212 *buf++ = ctrl_inb(port);
217#if defined(CONFIG_HS7751RVOIP_CODEC) 213#if defined(CONFIG_HS7751RVOIP_CODEC)
218 else if (codec_port(port)) 214 else if (codec_port(port))
219 while (count--) *((unsigned char *) addr)++ = *(volatile unsigned char *)((unsigned long)area6_io8_base+(port-CODEC_IO_BASE)); 215 while (count--)
216 *buf++ = ctrl_inb(CODEC_IOMAP(port));
220#endif 217#endif
221 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) { 218 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) {
222 volatile __u8 *bp = (__u8 *)PCI_IOMAP(port); 219 volatile u8 *bp = (volatile u8 *)PCI_IOMAP(port);
223 220
224 while (count--) *((volatile unsigned char *) addr)++ = *bp; 221 while (count--)
222 *buf++ = *bp;
225 } else { 223 } else {
226 volatile __u16 *p = (volatile unsigned short *)port2adr(port); 224 volatile u16 *p = (volatile u16 *)port2adr(port);
227 225
228 while (count--) *((unsigned char *) addr)++ = *p & 0xff; 226 while (count--)
227 *buf++ = *p & 0xff;
229 } 228 }
230} 229}
231 230
232void hs7751rvoip_insw(unsigned long port, void *addr, unsigned long count) 231void hs7751rvoip_insw(unsigned long port, void *addr, unsigned long count)
233{ 232{
234 volatile __u16 *p; 233 volatile u16 *p;
234 u16 *buf = addr;
235 235
236 if (PXSEG(port)) 236 if (PXSEG(port))
237 p = (volatile unsigned short *)port; 237 p = (volatile u16 *)port;
238 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) 238 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port))
239 p = (volatile unsigned short *)PCI_IOMAP(port); 239 p = (volatile u16 *)PCI_IOMAP(port);
240 else 240 else
241 p = (volatile unsigned short *)port2adr(port); 241 p = (volatile u16 *)port2adr(port);
242 while (count--) *((__u16 *) addr)++ = *p; 242 while (count--)
243 *buf++ = *p;
243} 244}
244 245
245void hs7751rvoip_insl(unsigned long port, void *addr, unsigned long count) 246void hs7751rvoip_insl(unsigned long port, void *addr, unsigned long count)
246{ 247{
248
247 if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) { 249 if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) {
248 volatile __u32 *p = (__u32 *)PCI_IOMAP(port); 250 volatile u32 *p = (volatile u32 *)PCI_IOMAP(port);
251 u32 *buf = addr;
249 252
250 while (count--) *((__u32 *) addr)++ = *p; 253 while (count--)
254 *buf++ = *p;
251 } else 255 } else
252 maybebadio(insl, port); 256 maybebadio(port);
253} 257}
254 258
255void hs7751rvoip_outsb(unsigned long port, const void *addr, unsigned long count) 259void hs7751rvoip_outsb(unsigned long port, const void *addr, unsigned long count)
256{ 260{
261 const u8 *buf = addr;
262
257 if (PXSEG(port)) 263 if (PXSEG(port))
258 while (count--) *(volatile unsigned char *)port = *((unsigned char *) addr)++; 264 while (count--)
265 ctrl_outb(*buf++, port);
259#if defined(CONFIG_HS7751RVOIP_CODEC) 266#if defined(CONFIG_HS7751RVOIP_CODEC)
260 else if (codec_port(port)) 267 else if (codec_port(port))
261 while (count--) *(volatile unsigned char *)((unsigned long)area6_io8_base+(port-CODEC_IO_BASE)) = *((unsigned char *) addr)++; 268 while (count--)
269 ctrl_outb(*buf++, CODEC_IOMAP(port));
262#endif 270#endif
263 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) { 271 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) {
264 volatile __u8 *bp = (__u8 *)PCI_IOMAP(port); 272 volatile u8 *bp = (volatile u8 *)PCI_IOMAP(port);
265 273
266 while (count--) *bp = *((volatile unsigned char *) addr)++; 274 while (count--)
275 *bp = *buf++;
267 } else { 276 } else {
268 volatile __u16 *p = (volatile unsigned short *)port2adr(port); 277 volatile u16 *p = (volatile u16 *)port2adr(port);
269 278
270 while (count--) *p = *((unsigned char *) addr)++; 279 while (count--)
280 *p = *buf++;
271 } 281 }
272} 282}
273 283
274void hs7751rvoip_outsw(unsigned long port, const void *addr, unsigned long count) 284void hs7751rvoip_outsw(unsigned long port, const void *addr, unsigned long count)
275{ 285{
276 volatile __u16 *p; 286 volatile u16 *p;
287 const u16 *buf = addr;
277 288
278 if (PXSEG(port)) 289 if (PXSEG(port))
279 p = (volatile unsigned short *)port; 290 p = (volatile u16 *)port;
280 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) 291 else if (CHECK_SH7751_PCIIO(port) || shifted_port(port))
281 p = (volatile unsigned short *)PCI_IOMAP(port); 292 p = (volatile u16 *)PCI_IOMAP(port);
282 else 293 else
283 p = (volatile unsigned short *)port2adr(port); 294 p = (volatile u16 *)port2adr(port);
284 while (count--) *p = *((__u16 *) addr)++; 295
296 while (count--)
297 *p = *buf++;
285} 298}
286 299
287void hs7751rvoip_outsl(unsigned long port, const void *addr, unsigned long count) 300void hs7751rvoip_outsl(unsigned long port, const void *addr, unsigned long count)
288{ 301{
302 const u32 *buf = addr;
303
289 if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) { 304 if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) {
290 volatile __u32 *p = (__u32 *)PCI_IOMAP(port); 305 volatile u32 *p = (volatile u32 *)PCI_IOMAP(port);
291 306
292 while (count--) *p = *((__u32 *) addr)++; 307 while (count--)
308 *p = *buf++;
293 } else 309 } else
294 maybebadio(outsl, port); 310 maybebadio(port);
295} 311}
296 312
297unsigned long hs7751rvoip_isa_port2addr(unsigned long offset) 313void __iomem *hs7751rvoip_ioport_map(unsigned long port, unsigned int size)
298{ 314{
299 return port2adr(offset); 315 if (PXSEG(port))
316 return (void __iomem *)port;
317 else if (unlikely(codec_port(port) && (size == 1)))
318 return (void __iomem *)CODEC_IOMAP(port);
319 else if (CHECK_SH7751_PCIIO(port))
320 return (void __iomem *)PCI_IOMAP(port);
321
322 return (void __iomem *)port2adr(port);
300} 323}
diff --git a/arch/sh/boards/renesas/hs7751rvoip/setup.c b/arch/sh/boards/renesas/hs7751rvoip/setup.c
index aa51bda931f6..a2cbcc5d530f 100644
--- a/arch/sh/boards/renesas/hs7751rvoip/setup.c
+++ b/arch/sh/boards/renesas/hs7751rvoip/setup.c
@@ -17,9 +17,8 @@
17#include <linux/hdreg.h> 17#include <linux/hdreg.h>
18#include <linux/ide.h> 18#include <linux/ide.h>
19#include <linux/pm.h> 19#include <linux/pm.h>
20#include <asm/hs7751rvoip/hs7751rvoip.h>
21#include <asm/hs7751rvoip/io.h>
22#include <asm/io.h> 20#include <asm/io.h>
21#include <asm/hs7751rvoip/hs7751rvoip.h>
23#include <asm/machvec.h> 22#include <asm/machvec.h>
24#include <asm/rtc.h> 23#include <asm/rtc.h>
25#include <asm/irq.h> 24#include <asm/irq.h>
@@ -60,8 +59,8 @@ struct sh_machine_vector mv_hs7751rvoip __initmv = {
60 .mv_outsw = hs7751rvoip_outsw, 59 .mv_outsw = hs7751rvoip_outsw,
61 .mv_outsl = hs7751rvoip_outsl, 60 .mv_outsl = hs7751rvoip_outsl,
62 61
63 .mv_isa_port2addr = hs7751rvoip_isa_port2addr,
64 .mv_init_irq = hs7751rvoip_init_irq, 62 .mv_init_irq = hs7751rvoip_init_irq,
63 .mv_ioport_map = hs7751rvoip_ioport_map,
65}; 64};
66ALIAS_MV(hs7751rvoip) 65ALIAS_MV(hs7751rvoip)
67 66
diff --git a/arch/sh/boards/renesas/systemh/io.c b/arch/sh/boards/renesas/systemh/io.c
index 85511576d414..0befd4f9894c 100644
--- a/arch/sh/boards/renesas/systemh/io.c
+++ b/arch/sh/boards/renesas/systemh/io.c
@@ -10,11 +10,10 @@
10 10
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/types.h> 12#include <linux/types.h>
13#include <asm/systemh/7751systemh.h> 13#include <linux/pci.h>
14#include <asm/systemh7751.h>
14#include <asm/addrspace.h> 15#include <asm/addrspace.h>
15#include <asm/io.h> 16#include <asm/io.h>
16
17#include <linux/pci.h>
18#include "../../../drivers/pci/pci-sh7751.h" 17#include "../../../drivers/pci/pci-sh7751.h"
19 18
20/* 19/*
@@ -31,11 +30,6 @@
31#define PCI_IOMAP(adr) (PCI_IO_AREA + (adr & ~SH7751_PCIIOBR_MASK)) 30#define PCI_IOMAP(adr) (PCI_IO_AREA + (adr & ~SH7751_PCIIOBR_MASK))
32#define ETHER_IOMAP(adr) (0xB3000000 + (adr)) /*map to 16bits access area 31#define ETHER_IOMAP(adr) (0xB3000000 + (adr)) /*map to 16bits access area
33 of smc lan chip*/ 32 of smc lan chip*/
34
35#define maybebadio(name,port) \
36 printk("bad PC-like io %s for port 0x%lx at 0x%08x\n", \
37 #name, (port), (__u32) __builtin_return_address(0))
38
39static inline void delay(void) 33static inline void delay(void)
40{ 34{
41 ctrl_inw(0xa0000000); 35 ctrl_inw(0xa0000000);
@@ -46,11 +40,7 @@ port2adr(unsigned int port)
46{ 40{
47 if (port >= 0x2000) 41 if (port >= 0x2000)
48 return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000)); 42 return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000));
49#if 0 43 maybebadio((unsigned long)port);
50 else
51 return (volatile __u16 *) (PA_SUPERIO + (port << 1));
52#endif
53 maybebadio(name,(unsigned long)port);
54 return (volatile __u16*)port; 44 return (volatile __u16*)port;
55} 45}
56 46
@@ -111,7 +101,7 @@ unsigned short sh7751systemh_inw(unsigned long port)
111 else if (port <= 0x3F1) 101 else if (port <= 0x3F1)
112 return *(volatile unsigned int *)ETHER_IOMAP(port); 102 return *(volatile unsigned int *)ETHER_IOMAP(port);
113 else 103 else
114 maybebadio(inw, port); 104 maybebadio(port);
115 return 0; 105 return 0;
116} 106}
117 107
@@ -126,7 +116,7 @@ unsigned int sh7751systemh_inl(unsigned long port)
126 else if (port <= 0x3F1) 116 else if (port <= 0x3F1)
127 return *(volatile unsigned int *)ETHER_IOMAP(port); 117 return *(volatile unsigned int *)ETHER_IOMAP(port);
128 else 118 else
129 maybebadio(inl, port); 119 maybebadio(port);
130 return 0; 120 return 0;
131} 121}
132 122
@@ -167,7 +157,7 @@ void sh7751systemh_outw(unsigned short value, unsigned long port)
167 else if (port <= 0x3F1) 157 else if (port <= 0x3F1)
168 *(volatile unsigned short *)ETHER_IOMAP(port) = value; 158 *(volatile unsigned short *)ETHER_IOMAP(port) = value;
169 else 159 else
170 maybebadio(outw, port); 160 maybebadio(port);
171} 161}
172 162
173void sh7751systemh_outl(unsigned int value, unsigned long port) 163void sh7751systemh_outl(unsigned int value, unsigned long port)
@@ -177,7 +167,7 @@ void sh7751systemh_outl(unsigned int value, unsigned long port)
177 else if (CHECK_SH7751_PCIIO(port)) 167 else if (CHECK_SH7751_PCIIO(port))
178 *((unsigned long*)PCI_IOMAP(port)) = value; 168 *((unsigned long*)PCI_IOMAP(port)) = value;
179 else 169 else
180 maybebadio(outl, port); 170 maybebadio(port);
181} 171}
182 172
183void sh7751systemh_insb(unsigned long port, void *addr, unsigned long count) 173void sh7751systemh_insb(unsigned long port, void *addr, unsigned long count)
@@ -194,7 +184,7 @@ void sh7751systemh_insw(unsigned long port, void *addr, unsigned long count)
194 184
195void sh7751systemh_insl(unsigned long port, void *addr, unsigned long count) 185void sh7751systemh_insl(unsigned long port, void *addr, unsigned long count)
196{ 186{
197 maybebadio(insl, port); 187 maybebadio(port);
198} 188}
199 189
200void sh7751systemh_outsb(unsigned long port, const void *addr, unsigned long count) 190void sh7751systemh_outsb(unsigned long port, const void *addr, unsigned long count)
@@ -211,73 +201,5 @@ void sh7751systemh_outsw(unsigned long port, const void *addr, unsigned long cou
211 201
212void sh7751systemh_outsl(unsigned long port, const void *addr, unsigned long count) 202void sh7751systemh_outsl(unsigned long port, const void *addr, unsigned long count)
213{ 203{
214 maybebadio(outsw, port); 204 maybebadio(port);
215}
216
217/* For read/write calls, just copy generic (pass-thru); PCIMBR is */
218/* already set up. For a larger memory space, these would need to */
219/* reset PCIMBR as needed on a per-call basis... */
220
221unsigned char sh7751systemh_readb(unsigned long addr)
222{
223 return *(volatile unsigned char*)addr;
224}
225
226unsigned short sh7751systemh_readw(unsigned long addr)
227{
228 return *(volatile unsigned short*)addr;
229}
230
231unsigned int sh7751systemh_readl(unsigned long addr)
232{
233 return *(volatile unsigned long*)addr;
234}
235
236void sh7751systemh_writeb(unsigned char b, unsigned long addr)
237{
238 *(volatile unsigned char*)addr = b;
239}
240
241void sh7751systemh_writew(unsigned short b, unsigned long addr)
242{
243 *(volatile unsigned short*)addr = b;
244}
245
246void sh7751systemh_writel(unsigned int b, unsigned long addr)
247{
248 *(volatile unsigned long*)addr = b;
249}
250
251
252
253/* Map ISA bus address to the real address. Only for PCMCIA. */
254
255/* ISA page descriptor. */
256static __u32 sh_isa_memmap[256];
257
258#if 0
259static int
260sh_isa_mmap(__u32 start, __u32 length, __u32 offset)
261{
262 int idx;
263
264 if (start >= 0x100000 || (start & 0xfff) || (length != 0x1000))
265 return -1;
266
267 idx = start >> 12;
268 sh_isa_memmap[idx] = 0xb8000000 + (offset &~ 0xfff);
269 printk("sh_isa_mmap: start %x len %x offset %x (idx %x paddr %x)\n",
270 start, length, offset, idx, sh_isa_memmap[idx]);
271 return 0;
272}
273#endif
274
275unsigned long
276sh7751systemh_isa_port2addr(unsigned long offset)
277{
278 int idx;
279
280 idx = (offset >> 12) & 0xff;
281 offset &= 0xfff;
282 return sh_isa_memmap[idx] + offset;
283} 205}
diff --git a/arch/sh/boards/renesas/systemh/irq.c b/arch/sh/boards/renesas/systemh/irq.c
index 8372d967f601..53731a0abb8f 100644
--- a/arch/sh/boards/renesas/systemh/irq.c
+++ b/arch/sh/boards/renesas/systemh/irq.c
@@ -15,7 +15,7 @@
15#include <linux/hdreg.h> 15#include <linux/hdreg.h>
16#include <linux/ide.h> 16#include <linux/ide.h>
17#include <asm/io.h> 17#include <asm/io.h>
18#include <asm/mach/7751systemh.h> 18#include <asm/systemh7751.h>
19#include <asm/smc37c93x.h> 19#include <asm/smc37c93x.h>
20 20
21/* address of external interrupt mask register 21/* address of external interrupt mask register
diff --git a/arch/sh/boards/renesas/systemh/setup.c b/arch/sh/boards/renesas/systemh/setup.c
index 826fa3d7669c..433c7c3f35e2 100644
--- a/arch/sh/boards/renesas/systemh/setup.c
+++ b/arch/sh/boards/renesas/systemh/setup.c
@@ -15,9 +15,8 @@
15 * for more details. 15 * for more details.
16 */ 16 */
17#include <linux/init.h> 17#include <linux/init.h>
18#include <asm/mach/7751systemh.h>
19#include <asm/mach/io.h>
20#include <asm/machvec.h> 18#include <asm/machvec.h>
19#include <asm/systemh7751.h>
21 20
22extern void make_systemh_irq(unsigned int irq); 21extern void make_systemh_irq(unsigned int irq);
23 22
@@ -31,8 +30,6 @@ const char *get_system_type(void)
31 */ 30 */
32void __init init_7751systemh_IRQ(void) 31void __init init_7751systemh_IRQ(void)
33{ 32{
34/* make_ipr_irq(10, BCR_ILCRD, 1, 0x0f-10); LAN */
35/* make_ipr_irq(14, BCR_ILCRA, 2, 0x0f-4); */
36 make_systemh_irq(0xb); /* Ethernet interrupt */ 33 make_systemh_irq(0xb); /* Ethernet interrupt */
37} 34}
38 35
@@ -60,15 +57,6 @@ struct sh_machine_vector mv_7751systemh __initmv = {
60 .mv_outsw = sh7751systemh_outsw, 57 .mv_outsw = sh7751systemh_outsw,
61 .mv_outsl = sh7751systemh_outsl, 58 .mv_outsl = sh7751systemh_outsl,
62 59
63 .mv_readb = sh7751systemh_readb,
64 .mv_readw = sh7751systemh_readw,
65 .mv_readl = sh7751systemh_readl,
66 .mv_writeb = sh7751systemh_writeb,
67 .mv_writew = sh7751systemh_writew,
68 .mv_writel = sh7751systemh_writel,
69
70 .mv_isa_port2addr = sh7751systemh_isa_port2addr,
71
72 .mv_init_irq = init_7751systemh_IRQ, 60 .mv_init_irq = init_7751systemh_IRQ,
73}; 61};
74ALIAS_MV(7751systemh) 62ALIAS_MV(7751systemh)
diff --git a/arch/sh/boards/se/7300/io.c b/arch/sh/boards/se/7300/io.c
index f449a94ddffd..8a03d7a52a7c 100644
--- a/arch/sh/boards/se/7300/io.c
+++ b/arch/sh/boards/se/7300/io.c
@@ -9,8 +9,8 @@
9 */ 9 */
10 10
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <asm/mach/se7300.h>
13#include <asm/io.h> 12#include <asm/io.h>
13#include <asm/se7300.h>
14 14
15#define badio(fn, a) panic("bad i/o operation %s for %08lx.", #fn, a) 15#define badio(fn, a) panic("bad i/o operation %s for %08lx.", #fn, a)
16 16
@@ -99,6 +99,7 @@ bad_outb(struct iop *p, unsigned char value, unsigned long port)
99 badio(inw, port); 99 badio(inw, port);
100} 100}
101 101
102#ifdef CONFIG_SMC91X
102/* MSTLANEX01 LAN at 0xb400:0000 */ 103/* MSTLANEX01 LAN at 0xb400:0000 */
103static struct iop laniop = { 104static struct iop laniop = {
104 .start = 0x300, 105 .start = 0x300,
@@ -110,6 +111,7 @@ static struct iop laniop = {
110 .outb = simple_outb, 111 .outb = simple_outb,
111 .outw = simple_outw, 112 .outw = simple_outw,
112}; 113};
114#endif
113 115
114/* NE2000 pc card NIC */ 116/* NE2000 pc card NIC */
115static struct iop neiop = { 117static struct iop neiop = {
@@ -123,6 +125,7 @@ static struct iop neiop = {
123 .outw = simple_outw, 125 .outw = simple_outw,
124}; 126};
125 127
128#ifdef CONFIG_IDE
126/* CF in CF slot */ 129/* CF in CF slot */
127static struct iop cfiop = { 130static struct iop cfiop = {
128 .base = 0xb0600000, 131 .base = 0xb0600000,
@@ -132,12 +135,13 @@ static struct iop cfiop = {
132 .outb = pcc_outb, 135 .outb = pcc_outb,
133 .outw = simple_outw, 136 .outw = simple_outw,
134}; 137};
138#endif
135 139
136static __inline__ struct iop * 140static __inline__ struct iop *
137port2iop(unsigned long port) 141port2iop(unsigned long port)
138{ 142{
139 if (0) ; 143 if (0) ;
140#if defined(CONFIG_SMC91111) 144#if defined(CONFIG_SMC91X)
141 else if (laniop.check(&laniop, port)) 145 else if (laniop.check(&laniop, port))
142 return &laniop; 146 return &laniop;
143#endif 147#endif
diff --git a/arch/sh/boards/se/7300/irq.c b/arch/sh/boards/se/7300/irq.c
index 216a78d1a108..ad1034f98a29 100644
--- a/arch/sh/boards/se/7300/irq.c
+++ b/arch/sh/boards/se/7300/irq.c
@@ -11,7 +11,7 @@
11#include <linux/irq.h> 11#include <linux/irq.h>
12#include <asm/irq.h> 12#include <asm/irq.h>
13#include <asm/io.h> 13#include <asm/io.h>
14#include <asm/mach/se7300.h> 14#include <asm/se7300.h>
15 15
16/* 16/*
17 * Initialize IRQ setting 17 * Initialize IRQ setting
diff --git a/arch/sh/boards/se/7300/led.c b/arch/sh/boards/se/7300/led.c
index ad51f0a9c1e3..4d03bb7774be 100644
--- a/arch/sh/boards/se/7300/led.c
+++ b/arch/sh/boards/se/7300/led.c
@@ -12,24 +12,10 @@
12 */ 12 */
13 13
14#include <linux/sched.h> 14#include <linux/sched.h>
15#include <asm/mach/se7300.h> 15#include <asm/se7300.h>
16
17static void
18mach_led(int position, int value)
19{
20 volatile unsigned short *p = (volatile unsigned short *) PA_LED;
21
22 if (value) {
23 *p |= (1 << 8);
24 } else {
25 *p &= ~(1 << 8);
26 }
27}
28
29 16
30/* Cycle the LED's in the clasic Knightrider/Sun pattern */ 17/* Cycle the LED's in the clasic Knightrider/Sun pattern */
31void 18void heartbeat_7300se(void)
32heartbeat_7300se(void)
33{ 19{
34 static unsigned int cnt = 0, period = 0; 20 static unsigned int cnt = 0, period = 0;
35 volatile unsigned short *p = (volatile unsigned short *) PA_LED; 21 volatile unsigned short *p = (volatile unsigned short *) PA_LED;
diff --git a/arch/sh/boards/se/7300/setup.c b/arch/sh/boards/se/7300/setup.c
index ebcd98d4c081..bb7e1a189be8 100644
--- a/arch/sh/boards/se/7300/setup.c
+++ b/arch/sh/boards/se/7300/setup.c
@@ -9,8 +9,7 @@
9 9
10#include <linux/init.h> 10#include <linux/init.h>
11#include <asm/machvec.h> 11#include <asm/machvec.h>
12#include <asm/machvec_init.h> 12#include <asm/se7300.h>
13#include <asm/mach/io.h>
14 13
15void heartbeat_7300se(void); 14void heartbeat_7300se(void);
16void init_7300se_IRQ(void); 15void init_7300se_IRQ(void);
diff --git a/arch/sh/boards/se/73180/setup.c b/arch/sh/boards/se/73180/setup.c
index cdb7b5f8d942..cddc7a2b858f 100644
--- a/arch/sh/boards/se/73180/setup.c
+++ b/arch/sh/boards/se/73180/setup.c
@@ -11,8 +11,7 @@
11 11
12#include <linux/init.h> 12#include <linux/init.h>
13#include <asm/machvec.h> 13#include <asm/machvec.h>
14#include <asm/machvec_init.h> 14#include <asm/se73180.h>
15#include <asm/mach/io.h>
16 15
17void heartbeat_73180se(void); 16void heartbeat_73180se(void);
18void init_73180se_IRQ(void); 17void init_73180se_IRQ(void);
diff --git a/arch/sh/boards/se/770x/io.c b/arch/sh/boards/se/770x/io.c
index 9a39ee963143..5102201c97ab 100644
--- a/arch/sh/boards/se/770x/io.c
+++ b/arch/sh/boards/se/770x/io.c
@@ -1,4 +1,4 @@
1/* $Id: io.c,v 1.5 2004/02/22 23:08:43 kkojima Exp $ 1/* $Id: io.c,v 1.6 2006/01/04 17:53:54 lethal Exp $
2 * 2 *
3 * linux/arch/sh/kernel/io_se.c 3 * linux/arch/sh/kernel/io_se.c
4 * 4 *
@@ -11,7 +11,7 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/types.h> 12#include <linux/types.h>
13#include <asm/io.h> 13#include <asm/io.h>
14#include <asm/se/se.h> 14#include <asm/se.h>
15 15
16/* SH pcmcia io window base, start and end. */ 16/* SH pcmcia io window base, start and end. */
17int sh_pcic_io_wbase = 0xb8400000; 17int sh_pcic_io_wbase = 0xb8400000;
@@ -52,10 +52,6 @@ shifted_port(unsigned long port)
52 return 1; 52 return 1;
53} 53}
54 54
55#define maybebadio(name,port) \
56 printk("bad PC-like io %s for port 0x%lx at 0x%08x\n", \
57 #name, (port), (__u32) __builtin_return_address(0))
58
59unsigned char se_inb(unsigned long port) 55unsigned char se_inb(unsigned long port)
60{ 56{
61 if (sh_pcic_io_start <= port && port <= sh_pcic_io_stop) 57 if (sh_pcic_io_start <= port && port <= sh_pcic_io_stop)
@@ -86,13 +82,13 @@ unsigned short se_inw(unsigned long port)
86 (sh_pcic_io_start <= port && port <= sh_pcic_io_stop)) 82 (sh_pcic_io_start <= port && port <= sh_pcic_io_stop))
87 return *port2adr(port); 83 return *port2adr(port);
88 else 84 else
89 maybebadio(inw, port); 85 maybebadio(port);
90 return 0; 86 return 0;
91} 87}
92 88
93unsigned int se_inl(unsigned long port) 89unsigned int se_inl(unsigned long port)
94{ 90{
95 maybebadio(inl, port); 91 maybebadio(port);
96 return 0; 92 return 0;
97} 93}
98 94
@@ -123,12 +119,12 @@ void se_outw(unsigned short value, unsigned long port)
123 (sh_pcic_io_start <= port && port <= sh_pcic_io_stop)) 119 (sh_pcic_io_start <= port && port <= sh_pcic_io_stop))
124 *port2adr(port) = value; 120 *port2adr(port) = value;
125 else 121 else
126 maybebadio(outw, port); 122 maybebadio(port);
127} 123}
128 124
129void se_outl(unsigned int value, unsigned long port) 125void se_outl(unsigned int value, unsigned long port)
130{ 126{
131 maybebadio(outl, port); 127 maybebadio(port);
132} 128}
133 129
134void se_insb(unsigned long port, void *addr, unsigned long count) 130void se_insb(unsigned long port, void *addr, unsigned long count)
@@ -159,7 +155,7 @@ void se_insw(unsigned long port, void *addr, unsigned long count)
159 155
160void se_insl(unsigned long port, void *addr, unsigned long count) 156void se_insl(unsigned long port, void *addr, unsigned long count)
161{ 157{
162 maybebadio(insl, port); 158 maybebadio(port);
163} 159}
164 160
165void se_outsb(unsigned long port, const void *addr, unsigned long count) 161void se_outsb(unsigned long port, const void *addr, unsigned long count)
@@ -190,37 +186,5 @@ void se_outsw(unsigned long port, const void *addr, unsigned long count)
190 186
191void se_outsl(unsigned long port, const void *addr, unsigned long count) 187void se_outsl(unsigned long port, const void *addr, unsigned long count)
192{ 188{
193 maybebadio(outsw, port); 189 maybebadio(port);
194}
195
196/* Map ISA bus address to the real address. Only for PCMCIA. */
197
198/* ISA page descriptor. */
199static __u32 sh_isa_memmap[256];
200
201static int
202sh_isa_mmap(__u32 start, __u32 length, __u32 offset)
203{
204 int idx;
205
206 if (start >= 0x100000 || (start & 0xfff) || (length != 0x1000))
207 return -1;
208
209 idx = start >> 12;
210 sh_isa_memmap[idx] = 0xb8000000 + (offset &~ 0xfff);
211#if 0
212 printk("sh_isa_mmap: start %x len %x offset %x (idx %x paddr %x)\n",
213 start, length, offset, idx, sh_isa_memmap[idx]);
214#endif
215 return 0;
216}
217
218unsigned long
219se_isa_port2addr(unsigned long offset)
220{
221 int idx;
222
223 idx = (offset >> 12) & 0xff;
224 offset &= 0xfff;
225 return sh_isa_memmap[idx] + offset;
226} 190}
diff --git a/arch/sh/boards/se/770x/irq.c b/arch/sh/boards/se/770x/irq.c
index 3e558716ce10..cff6700bbafd 100644
--- a/arch/sh/boards/se/770x/irq.c
+++ b/arch/sh/boards/se/770x/irq.c
@@ -11,7 +11,7 @@
11#include <linux/irq.h> 11#include <linux/irq.h>
12#include <asm/irq.h> 12#include <asm/irq.h>
13#include <asm/io.h> 13#include <asm/io.h>
14#include <asm/se/se.h> 14#include <asm/se.h>
15 15
16/* 16/*
17 * Initialize IRQ setting 17 * Initialize IRQ setting
diff --git a/arch/sh/boards/se/770x/led.c b/arch/sh/boards/se/770x/led.c
index 73e9848387ea..daf7b1ee786a 100644
--- a/arch/sh/boards/se/770x/led.c
+++ b/arch/sh/boards/se/770x/led.c
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12#include <linux/sched.h> 12#include <linux/sched.h>
13#include <asm/se/se.h> 13#include <asm/se.h>
14 14
15/* Cycle the LED's in the clasic Knightrider/Sun pattern */ 15/* Cycle the LED's in the clasic Knightrider/Sun pattern */
16void heartbeat_se(void) 16void heartbeat_se(void)
diff --git a/arch/sh/boards/se/770x/mach.c b/arch/sh/boards/se/770x/mach.c
index 6ec07bd3dcf1..e8968b71c353 100644
--- a/arch/sh/boards/se/770x/mach.c
+++ b/arch/sh/boards/se/770x/mach.c
@@ -13,12 +13,9 @@
13 13
14#include <asm/machvec.h> 14#include <asm/machvec.h>
15#include <asm/rtc.h> 15#include <asm/rtc.h>
16#include <asm/machvec_init.h> 16#include <asm/se.h>
17
18#include <asm/se/io.h>
19 17
20void heartbeat_se(void); 18void heartbeat_se(void);
21void setup_se(void);
22void init_se_IRQ(void); 19void init_se_IRQ(void);
23 20
24/* 21/*
@@ -57,8 +54,6 @@ struct sh_machine_vector mv_se __initmv = {
57 .mv_outsw = se_outsw, 54 .mv_outsw = se_outsw,
58 .mv_outsl = se_outsl, 55 .mv_outsl = se_outsl,
59 56
60 .mv_isa_port2addr = se_isa_port2addr,
61
62 .mv_init_irq = init_se_IRQ, 57 .mv_init_irq = init_se_IRQ,
63#ifdef CONFIG_HEARTBEAT 58#ifdef CONFIG_HEARTBEAT
64 .mv_heartbeat = heartbeat_se, 59 .mv_heartbeat = heartbeat_se,
diff --git a/arch/sh/boards/se/770x/setup.c b/arch/sh/boards/se/770x/setup.c
index b6730ea57502..c9f75272e751 100644
--- a/arch/sh/boards/se/770x/setup.c
+++ b/arch/sh/boards/se/770x/setup.c
@@ -14,7 +14,7 @@
14#include <linux/hdreg.h> 14#include <linux/hdreg.h>
15#include <linux/ide.h> 15#include <linux/ide.h>
16#include <asm/io.h> 16#include <asm/io.h>
17#include <asm/se/se.h> 17#include <asm/se.h>
18#include <asm/smc37c93x.h> 18#include <asm/smc37c93x.h>
19 19
20/* 20/*
diff --git a/arch/sh/boards/se/7751/io.c b/arch/sh/boards/se/7751/io.c
index 99041b269261..0e8a3ba48316 100644
--- a/arch/sh/boards/se/7751/io.c
+++ b/arch/sh/boards/se/7751/io.c
@@ -1,4 +1,4 @@
1/* 1/*
2 * linux/arch/sh/kernel/io_7751se.c 2 * linux/arch/sh/kernel/io_7751se.c
3 * 3 *
4 * Copyright (C) 2001 Ian da Silva, Jeremy Siegel 4 * Copyright (C) 2001 Ian da Silva, Jeremy Siegel
@@ -14,7 +14,7 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/types.h> 15#include <linux/types.h>
16#include <asm/io.h> 16#include <asm/io.h>
17#include <asm/se7751/se7751.h> 17#include <asm/se7751.h>
18#include <asm/addrspace.h> 18#include <asm/addrspace.h>
19 19
20#include <linux/pci.h> 20#include <linux/pci.h>
@@ -52,10 +52,6 @@ int sh_pcic_io_dummy;
52 52
53#define PCI_IOMAP(adr) (PCI_IO_AREA + (adr & ~SH7751_PCIIOBR_MASK)) 53#define PCI_IOMAP(adr) (PCI_IO_AREA + (adr & ~SH7751_PCIIOBR_MASK))
54 54
55#define maybebadio(name,port) \
56 printk("bad PC-like io %s for port 0x%lx at 0x%08x\n", \
57 #name, (port), (__u32) __builtin_return_address(0))
58
59static inline void delay(void) 55static inline void delay(void)
60{ 56{
61 ctrl_inw(0xa0000000); 57 ctrl_inw(0xa0000000);
@@ -66,11 +62,7 @@ port2adr(unsigned int port)
66{ 62{
67 if (port >= 0x2000) 63 if (port >= 0x2000)
68 return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000)); 64 return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000));
69#if 0 65 maybebadio((unsigned long)port);
70 else
71 return (volatile __u16 *) (PA_SUPERIO + (port << 1));
72#endif
73 maybebadio(name,(unsigned long)port);
74 return (volatile __u16*)port; 66 return (volatile __u16*)port;
75} 67}
76 68
@@ -140,7 +132,7 @@ unsigned short sh7751se_inw(unsigned long port)
140 else if (port >= 0x2000) 132 else if (port >= 0x2000)
141 return *port2adr(port); 133 return *port2adr(port);
142 else 134 else
143 maybebadio(inw, port); 135 maybebadio(port);
144 return 0; 136 return 0;
145} 137}
146 138
@@ -153,7 +145,7 @@ unsigned int sh7751se_inl(unsigned long port)
153 else if (port >= 0x2000) 145 else if (port >= 0x2000)
154 return *port2adr(port); 146 return *port2adr(port);
155 else 147 else
156 maybebadio(inl, port); 148 maybebadio(port);
157 return 0; 149 return 0;
158} 150}
159 151
@@ -188,7 +180,7 @@ void sh7751se_outw(unsigned short value, unsigned long port)
188 else if (port >= 0x2000) 180 else if (port >= 0x2000)
189 *port2adr(port) = value; 181 *port2adr(port) = value;
190 else 182 else
191 maybebadio(outw, port); 183 maybebadio(port);
192} 184}
193 185
194void sh7751se_outl(unsigned int value, unsigned long port) 186void sh7751se_outl(unsigned int value, unsigned long port)
@@ -198,17 +190,17 @@ void sh7751se_outl(unsigned int value, unsigned long port)
198 else if (CHECK_SH7751_PCIIO(port)) 190 else if (CHECK_SH7751_PCIIO(port))
199 *((unsigned long*)PCI_IOMAP(port)) = value; 191 *((unsigned long*)PCI_IOMAP(port)) = value;
200 else 192 else
201 maybebadio(outl, port); 193 maybebadio(port);
202} 194}
203 195
204void sh7751se_insl(unsigned long port, void *addr, unsigned long count) 196void sh7751se_insl(unsigned long port, void *addr, unsigned long count)
205{ 197{
206 maybebadio(insl, port); 198 maybebadio(port);
207} 199}
208 200
209void sh7751se_outsl(unsigned long port, const void *addr, unsigned long count) 201void sh7751se_outsl(unsigned long port, const void *addr, unsigned long count)
210{ 202{
211 maybebadio(outsw, port); 203 maybebadio(port);
212} 204}
213 205
214/* Map ISA bus address to the real address. Only for PCMCIA. */ 206/* Map ISA bus address to the real address. Only for PCMCIA. */
diff --git a/arch/sh/boards/se/7751/irq.c b/arch/sh/boards/se/7751/irq.c
index bf6c023615df..c607b0a48479 100644
--- a/arch/sh/boards/se/7751/irq.c
+++ b/arch/sh/boards/se/7751/irq.c
@@ -12,7 +12,7 @@
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/irq.h> 13#include <linux/irq.h>
14#include <asm/irq.h> 14#include <asm/irq.h>
15#include <asm/se7751/se7751.h> 15#include <asm/se7751.h>
16 16
17/* 17/*
18 * Initialize IRQ setting 18 * Initialize IRQ setting
diff --git a/arch/sh/boards/se/7751/led.c b/arch/sh/boards/se/7751/led.c
index 4405e26cf866..ff0355dea81b 100644
--- a/arch/sh/boards/se/7751/led.c
+++ b/arch/sh/boards/se/7751/led.c
@@ -8,9 +8,8 @@
8 * 8 *
9 * This file contains Solution Engine specific LED code. 9 * This file contains Solution Engine specific LED code.
10 */ 10 */
11
12#include <asm/se7751/se7751.h>
13#include <linux/sched.h> 11#include <linux/sched.h>
12#include <asm/se7751.h>
14 13
15/* Cycle the LED's in the clasic Knightrider/Sun pattern */ 14/* Cycle the LED's in the clasic Knightrider/Sun pattern */
16void heartbeat_7751se(void) 15void heartbeat_7751se(void)
diff --git a/arch/sh/boards/se/7751/mach.c b/arch/sh/boards/se/7751/mach.c
index 62d8d3e62590..1bb9047d863b 100644
--- a/arch/sh/boards/se/7751/mach.c
+++ b/arch/sh/boards/se/7751/mach.c
@@ -10,12 +10,8 @@
10 */ 10 */
11 11
12#include <linux/init.h> 12#include <linux/init.h>
13
14#include <asm/machvec.h> 13#include <asm/machvec.h>
15#include <asm/rtc.h> 14#include <asm/se7751.h>
16#include <asm/machvec_init.h>
17
18#include <asm/se7751/io.h>
19 15
20void heartbeat_7751se(void); 16void heartbeat_7751se(void);
21void init_7751se_IRQ(void); 17void init_7751se_IRQ(void);
@@ -44,8 +40,6 @@ struct sh_machine_vector mv_7751se __initmv = {
44 .mv_insl = sh7751se_insl, 40 .mv_insl = sh7751se_insl,
45 .mv_outsl = sh7751se_outsl, 41 .mv_outsl = sh7751se_outsl,
46 42
47 .mv_isa_port2addr = sh7751se_isa_port2addr,
48
49 .mv_init_irq = init_7751se_IRQ, 43 .mv_init_irq = init_7751se_IRQ,
50#ifdef CONFIG_HEARTBEAT 44#ifdef CONFIG_HEARTBEAT
51 .mv_heartbeat = heartbeat_7751se, 45 .mv_heartbeat = heartbeat_7751se,
diff --git a/arch/sh/boards/se/7751/setup.c b/arch/sh/boards/se/7751/setup.c
index 48dc5aee67d4..8b693105893c 100644
--- a/arch/sh/boards/se/7751/setup.c
+++ b/arch/sh/boards/se/7751/setup.c
@@ -1,4 +1,4 @@
1/* 1/*
2 * linux/arch/sh/kernel/setup_7751se.c 2 * linux/arch/sh/kernel/setup_7751se.c
3 * 3 *
4 * Copyright (C) 2000 Kazumoto Kojima 4 * Copyright (C) 2000 Kazumoto Kojima
@@ -11,11 +11,9 @@
11 11
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/irq.h> 13#include <linux/irq.h>
14
15#include <linux/hdreg.h>
16#include <linux/ide.h> 14#include <linux/ide.h>
17#include <asm/io.h> 15#include <asm/io.h>
18#include <asm/se7751/se7751.h> 16#include <asm/se7751.h>
19 17
20#ifdef CONFIG_SH_KGDB 18#ifdef CONFIG_SH_KGDB
21#include <asm/kgdb.h> 19#include <asm/kgdb.h>
diff --git a/arch/sh/boards/sh03/setup.c b/arch/sh/boards/sh03/setup.c
index 60290f8f289c..dab742a00c6f 100644
--- a/arch/sh/boards/sh03/setup.c
+++ b/arch/sh/boards/sh03/setup.c
@@ -7,22 +7,19 @@
7 7
8#include <linux/init.h> 8#include <linux/init.h>
9#include <linux/irq.h> 9#include <linux/irq.h>
10#include <linux/hdreg.h>
11#include <linux/ide.h>
12#include <asm/io.h> 10#include <asm/io.h>
11#include <asm/rtc.h>
13#include <asm/sh03/io.h> 12#include <asm/sh03/io.h>
14#include <asm/sh03/sh03.h> 13#include <asm/sh03/sh03.h>
15#include <asm/addrspace.h> 14#include <asm/addrspace.h>
16#include "../../drivers/pci/pci-sh7751.h" 15#include "../../drivers/pci/pci-sh7751.h"
17 16
18extern void (*board_time_init)(void);
19
20const char *get_system_type(void) 17const char *get_system_type(void)
21{ 18{
22 return "Interface CTP/PCI-SH03)"; 19 return "Interface CTP/PCI-SH03)";
23} 20}
24 21
25void init_sh03_IRQ(void) 22static void init_sh03_IRQ(void)
26{ 23{
27 ctrl_outw(ctrl_inw(INTC_ICR) | INTC_ICR_IRLM, INTC_ICR); 24 ctrl_outw(ctrl_inw(INTC_ICR) | INTC_ICR_IRLM, INTC_ICR);
28 25
@@ -34,24 +31,20 @@ void init_sh03_IRQ(void)
34 31
35extern void *cf_io_base; 32extern void *cf_io_base;
36 33
37unsigned long sh03_isa_port2addr(unsigned long port) 34static void __iomem *sh03_ioport_map(unsigned long port, unsigned int size)
38{ 35{
39 if (PXSEG(port)) 36 if (PXSEG(port))
40 return port; 37 return (void __iomem *)port;
41 /* CompactFlash (IDE) */ 38 /* CompactFlash (IDE) */
42 if (((port >= 0x1f0) && (port <= 0x1f7)) || (port == 0x3f6)) { 39 if (((port >= 0x1f0) && (port <= 0x1f7)) || (port == 0x3f6))
43 return (unsigned long)cf_io_base + port; 40 return (void __iomem *)((unsigned long)cf_io_base + port);
44 }
45 return port + SH7751_PCI_IO_BASE;
46}
47 41
48/* 42 return (void __iomem *)(port + SH7751_PCI_IO_BASE);
49 * The Machine Vector 43}
50 */
51 44
52struct sh_machine_vector mv_sh03 __initmv = { 45struct sh_machine_vector mv_sh03 __initmv = {
53 .mv_nr_irqs = 48, 46 .mv_nr_irqs = 48,
54 .mv_isa_port2addr = sh03_isa_port2addr, 47 .mv_ioport_map = sh03_ioport_map,
55 .mv_init_irq = init_sh03_IRQ, 48 .mv_init_irq = init_sh03_IRQ,
56 49
57#ifdef CONFIG_HEARTBEAT 50#ifdef CONFIG_HEARTBEAT
diff --git a/arch/sh/boards/snapgear/io.c b/arch/sh/boards/snapgear/io.c
index e2eb78fc381d..9f700b8392bb 100644
--- a/arch/sh/boards/snapgear/io.c
+++ b/arch/sh/boards/snapgear/io.c
@@ -28,39 +28,26 @@ unsigned short secureedge5410_ioport;
28/* 28/*
29 * The SnapGear uses the built-in PCI controller (PCIC) 29 * The SnapGear uses the built-in PCI controller (PCIC)
30 * of the 7751 processor 30 * of the 7751 processor
31 */ 31 */
32 32
33#define PCIIOBR (volatile long *)PCI_REG(SH7751_PCIIOBR) 33#define PCIIOBR (volatile long *)PCI_REG(SH7751_PCIIOBR)
34#define PCIMBR (volatile long *)PCI_REG(SH7751_PCIMBR) 34#define PCIMBR (volatile long *)PCI_REG(SH7751_PCIMBR)
35#define PCI_IO_AREA SH7751_PCI_IO_BASE 35#define PCI_IO_AREA SH7751_PCI_IO_BASE
36#define PCI_MEM_AREA SH7751_PCI_CONFIG_BASE 36#define PCI_MEM_AREA SH7751_PCI_CONFIG_BASE
37 37
38
39#define PCI_IOMAP(adr) (PCI_IO_AREA + (adr & ~SH7751_PCIIOBR_MASK)) 38#define PCI_IOMAP(adr) (PCI_IO_AREA + (adr & ~SH7751_PCIIOBR_MASK))
40 39
41
42#define maybebadio(name,port) \
43 printk("bad PC-like io %s for port 0x%lx at 0x%08x\n", \
44 #name, (port), (__u32) __builtin_return_address(0))
45
46
47static inline void delay(void) 40static inline void delay(void)
48{ 41{
49 ctrl_inw(0xa0000000); 42 ctrl_inw(0xa0000000);
50} 43}
51 44
52
53static inline volatile __u16 *port2adr(unsigned int port) 45static inline volatile __u16 *port2adr(unsigned int port)
54{ 46{
55#if 0 47 maybebadio((unsigned long)port);
56 if (port >= 0x2000)
57 return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000));
58#endif
59 maybebadio(name,(unsigned long)port);
60 return (volatile __u16*)port; 48 return (volatile __u16*)port;
61} 49}
62 50
63
64/* In case someone configures the kernel w/o PCI support: in that */ 51/* In case someone configures the kernel w/o PCI support: in that */
65/* scenario, don't ever bother to check for PCI-window addresses */ 52/* scenario, don't ever bother to check for PCI-window addresses */
66 53
@@ -115,7 +102,7 @@ unsigned short snapgear_inw(unsigned long port)
115 else if (port >= 0x2000) 102 else if (port >= 0x2000)
116 return *port2adr(port); 103 return *port2adr(port);
117 else 104 else
118 maybebadio(inw, port); 105 maybebadio(port);
119 return 0; 106 return 0;
120} 107}
121 108
@@ -129,7 +116,7 @@ unsigned int snapgear_inl(unsigned long port)
129 else if (port >= 0x2000) 116 else if (port >= 0x2000)
130 return *port2adr(port); 117 return *port2adr(port);
131 else 118 else
132 maybebadio(inl, port); 119 maybebadio(port);
133 return 0; 120 return 0;
134} 121}
135 122
@@ -167,7 +154,7 @@ void snapgear_outw(unsigned short value, unsigned long port)
167 else if (port >= 0x2000) 154 else if (port >= 0x2000)
168 *port2adr(port) = value; 155 *port2adr(port) = value;
169 else 156 else
170 maybebadio(outw, port); 157 maybebadio(port);
171} 158}
172 159
173 160
@@ -178,49 +165,15 @@ void snapgear_outl(unsigned int value, unsigned long port)
178 else if (CHECK_SH7751_PCIIO(port)) 165 else if (CHECK_SH7751_PCIIO(port))
179 *((unsigned long*)PCI_IOMAP(port)) = value; 166 *((unsigned long*)PCI_IOMAP(port)) = value;
180 else 167 else
181 maybebadio(outl, port); 168 maybebadio(port);
182} 169}
183 170
184void snapgear_insl(unsigned long port, void *addr, unsigned long count) 171void snapgear_insl(unsigned long port, void *addr, unsigned long count)
185{ 172{
186 maybebadio(insl, port); 173 maybebadio(port);
187} 174}
188 175
189void snapgear_outsl(unsigned long port, const void *addr, unsigned long count) 176void snapgear_outsl(unsigned long port, const void *addr, unsigned long count)
190{ 177{
191 maybebadio(outsw, port); 178 maybebadio(port);
192}
193
194/* Map ISA bus address to the real address. Only for PCMCIA. */
195
196
197/* ISA page descriptor. */
198static __u32 sh_isa_memmap[256];
199
200
201#if 0
202static int sh_isa_mmap(__u32 start, __u32 length, __u32 offset)
203{
204 int idx;
205
206 if (start >= 0x100000 || (start & 0xfff) || (length != 0x1000))
207 return -1;
208
209 idx = start >> 12;
210 sh_isa_memmap[idx] = 0xb8000000 + (offset &~ 0xfff);
211#if 0
212 printk("sh_isa_mmap: start %x len %x offset %x (idx %x paddr %x)\n",
213 start, length, offset, idx, sh_isa_memmap[idx]);
214#endif
215 return 0;
216}
217#endif
218
219unsigned long snapgear_isa_port2addr(unsigned long offset)
220{
221 int idx;
222
223 idx = (offset >> 12) & 0xff;
224 offset &= 0xfff;
225 return sh_isa_memmap[idx] + offset;
226} 179}
diff --git a/arch/sh/boards/snapgear/rtc.c b/arch/sh/boards/snapgear/rtc.c
index b71e009da35c..287bc4ed3ac7 100644
--- a/arch/sh/boards/snapgear/rtc.c
+++ b/arch/sh/boards/snapgear/rtc.c
@@ -17,10 +17,7 @@
17#include <linux/time.h> 17#include <linux/time.h>
18#include <linux/rtc.h> 18#include <linux/rtc.h>
19#include <linux/mc146818rtc.h> 19#include <linux/mc146818rtc.h>
20
21#include <asm/io.h> 20#include <asm/io.h>
22#include <asm/rtc.h>
23#include <asm/mc146818rtc.h>
24 21
25/****************************************************************************/ 22/****************************************************************************/
26 23
diff --git a/arch/sh/boards/snapgear/setup.c b/arch/sh/boards/snapgear/setup.c
index f1f7c70c9402..66ce32f8b13c 100644
--- a/arch/sh/boards/snapgear/setup.c
+++ b/arch/sh/boards/snapgear/setup.c
@@ -1,5 +1,4 @@
1/****************************************************************************/ 1/*
2/*
3 * linux/arch/sh/boards/snapgear/setup.c 2 * linux/arch/sh/boards/snapgear/setup.c
4 * 3 *
5 * Copyright (C) 2002 David McCullough <davidm@snapgear.com> 4 * Copyright (C) 2002 David McCullough <davidm@snapgear.com>
@@ -12,8 +11,6 @@
12 * Modified for 7751 Solution Engine by 11 * Modified for 7751 Solution Engine by
13 * Ian da Silva and Jeremy Siegel, 2001. 12 * Ian da Silva and Jeremy Siegel, 2001.
14 */ 13 */
15/****************************************************************************/
16
17#include <linux/init.h> 14#include <linux/init.h>
18#include <linux/irq.h> 15#include <linux/irq.h>
19#include <linux/interrupt.h> 16#include <linux/interrupt.h>
@@ -21,14 +18,13 @@
21#include <linux/delay.h> 18#include <linux/delay.h>
22#include <linux/module.h> 19#include <linux/module.h>
23#include <linux/sched.h> 20#include <linux/sched.h>
24
25#include <asm/machvec.h> 21#include <asm/machvec.h>
26#include <asm/mach/io.h> 22#include <asm/snapgear.h>
27#include <asm/irq.h> 23#include <asm/irq.h>
28#include <asm/io.h> 24#include <asm/io.h>
25#include <asm/rtc.h>
29#include <asm/cpu/timer.h> 26#include <asm/cpu/timer.h>
30 27
31extern void (*board_time_init)(void);
32extern void secureedge5410_rtc_init(void); 28extern void secureedge5410_rtc_init(void);
33extern void pcibios_init(void); 29extern void pcibios_init(void);
34 30
@@ -85,91 +81,6 @@ static void __init init_snapgear_IRQ(void)
85 make_ipr_irq(IRL3_IRQ, IRL3_IPR_ADDR, IRL3_IPR_POS, IRL3_PRIORITY); 81 make_ipr_irq(IRL3_IRQ, IRL3_IPR_ADDR, IRL3_IPR_POS, IRL3_PRIORITY);
86} 82}
87 83
88/****************************************************************************/
89/*
90 * Fast poll interrupt simulator.
91 */
92
93/*
94 * Leave all of the fast timer/fast poll stuff commented out for now, since
95 * it's not clear whether it actually works or not. Since it wasn't being used
96 * at all in 2.4, we'll assume it's not sane for 2.6 either.. -- PFM
97 */
98#if 0
99#define FAST_POLL 1000
100//#define FAST_POLL_INTR
101
102#define FASTTIMER_IRQ 17
103#define FASTTIMER_IPR_ADDR INTC_IPRA
104#define FASTTIMER_IPR_POS 2
105#define FASTTIMER_PRIORITY 3
106
107#ifdef FAST_POLL_INTR
108#define TMU1_TCR_INIT 0x0020
109#else
110#define TMU1_TCR_INIT 0
111#endif
112#define TMU_TSTR_INIT 1
113#define TMU1_TCR_CALIB 0x0000
114
115
116#ifdef FAST_POLL_INTR
117static void fast_timer_irq(int irq, void *dev_instance, struct pt_regs *regs)
118{
119 unsigned long timer_status;
120 timer_status = ctrl_inw(TMU1_TCR);
121 timer_status &= ~0x100;
122 ctrl_outw(timer_status, TMU1_TCR);
123}
124#endif
125
126/*
127 * return the current ticks on the fast timer
128 */
129
130unsigned long fast_timer_count(void)
131{
132 return(ctrl_inl(TMU1_TCNT));
133}
134
135/*
136 * setup a fast timer for profiling etc etc
137 */
138
139static void setup_fast_timer()
140{
141 unsigned long interval;
142
143#ifdef FAST_POLL_INTR
144 interval = (current_cpu_data.module_clock/4 + FAST_POLL/2) / FAST_POLL;
145
146 make_ipr_irq(FASTTIMER_IRQ, FASTTIMER_IPR_ADDR, FASTTIMER_IPR_POS,
147 FASTTIMER_PRIORITY);
148
149 printk("SnapGear: %dHz fast timer on IRQ %d\n",FAST_POLL,FASTTIMER_IRQ);
150
151 if (request_irq(FASTTIMER_IRQ, fast_timer_irq, 0, "SnapGear fast timer",
152 NULL) != 0)
153 printk("%s(%d): request_irq() failed?\n", __FILE__, __LINE__);
154#else
155 printk("SnapGear: fast timer running\n",FAST_POLL,FASTTIMER_IRQ);
156 interval = 0xffffffff;
157#endif
158
159 ctrl_outb(ctrl_inb(TMU_TSTR) & ~0x2, TMU_TSTR); /* disable timer 1 */
160 ctrl_outw(TMU1_TCR_INIT, TMU1_TCR);
161 ctrl_outl(interval, TMU1_TCOR);
162 ctrl_outl(interval, TMU1_TCNT);
163 ctrl_outb(ctrl_inb(TMU_TSTR) | 0x2, TMU_TSTR); /* enable timer 1 */
164
165 printk("Timer count 1 = 0x%x\n", fast_timer_count());
166 udelay(1000);
167 printk("Timer count 2 = 0x%x\n", fast_timer_count());
168}
169#endif
170
171/****************************************************************************/
172
173const char *get_system_type(void) 84const char *get_system_type(void)
174{ 85{
175 return "SnapGear SecureEdge5410"; 86 return "SnapGear SecureEdge5410";
@@ -196,8 +107,6 @@ struct sh_machine_vector mv_snapgear __initmv = {
196 .mv_outw_p = snapgear_outw, 107 .mv_outw_p = snapgear_outw,
197 .mv_outl_p = snapgear_outl, 108 .mv_outl_p = snapgear_outl,
198 109
199 .mv_isa_port2addr = snapgear_isa_port2addr,
200
201 .mv_init_irq = init_snapgear_IRQ, 110 .mv_init_irq = init_snapgear_IRQ,
202}; 111};
203ALIAS_MV(snapgear) 112ALIAS_MV(snapgear)
diff --git a/arch/sh/boards/titan/io.c b/arch/sh/boards/titan/io.c
index b886fd233a66..48f3494f55b1 100644
--- a/arch/sh/boards/titan/io.c
+++ b/arch/sh/boards/titan/io.c
@@ -30,10 +30,10 @@ static inline void delay(void)
30 ctrl_inw(0xa0000000); 30 ctrl_inw(0xa0000000);
31} 31}
32 32
33static inline volatile u16 *port2adr(unsigned int port) 33static inline unsigned int port2adr(unsigned int port)
34{ 34{
35 maybebadio((unsigned long)port); 35 maybebadio((unsigned long)port);
36 return (volatile u16*)port; 36 return port;
37} 37}
38 38
39u8 titan_inb(unsigned long port) 39u8 titan_inb(unsigned long port)