aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boards/renesas/systemh/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/boards/renesas/systemh/io.c')
-rw-r--r--arch/sh/boards/renesas/systemh/io.c96
1 files changed, 9 insertions, 87 deletions
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}