mm-only debug patch...
[mmotm.git] / arch / sh / boards / mach-titan / io.c
blob0130e9826aca619f086378b92cc59eb205ea7aa1
1 /*
2 * I/O routines for Titan
3 */
4 #include <linux/pci.h>
5 #include <asm/machvec.h>
6 #include <asm/addrspace.h>
7 #include <mach/titan.h>
8 #include <asm/io.h>
10 static inline unsigned int port2adr(unsigned int port)
12 maybebadio((unsigned long)port);
13 return port;
16 u8 titan_inb(unsigned long port)
18 if (PXSEG(port))
19 return ctrl_inb(port);
20 return ctrl_inw(port2adr(port)) & 0xff;
23 u8 titan_inb_p(unsigned long port)
25 u8 v;
27 if (PXSEG(port))
28 v = ctrl_inb(port);
29 else
30 v = ctrl_inw(port2adr(port)) & 0xff;
31 ctrl_delay();
32 return v;
35 u16 titan_inw(unsigned long port)
37 if (PXSEG(port))
38 return ctrl_inw(port);
39 else if (port >= 0x2000)
40 return ctrl_inw(port2adr(port));
41 else
42 maybebadio(port);
43 return 0;
46 u32 titan_inl(unsigned long port)
48 if (PXSEG(port))
49 return ctrl_inl(port);
50 else if (port >= 0x2000)
51 return ctrl_inw(port2adr(port));
52 else
53 maybebadio(port);
54 return 0;
57 void titan_outb(u8 value, unsigned long port)
59 if (PXSEG(port))
60 ctrl_outb(value, port);
61 else
62 ctrl_outw(value, port2adr(port));
65 void titan_outb_p(u8 value, unsigned long port)
67 if (PXSEG(port))
68 ctrl_outb(value, port);
69 else
70 ctrl_outw(value, port2adr(port));
71 ctrl_delay();
74 void titan_outw(u16 value, unsigned long port)
76 if (PXSEG(port))
77 ctrl_outw(value, port);
78 else if (port >= 0x2000)
79 ctrl_outw(value, port2adr(port));
80 else
81 maybebadio(port);
84 void titan_outl(u32 value, unsigned long port)
86 if (PXSEG(port))
87 ctrl_outl(value, port);
88 else
89 maybebadio(port);
92 void titan_insl(unsigned long port, void *dst, unsigned long count)
94 maybebadio(port);
97 void titan_outsl(unsigned long port, const void *src, unsigned long count)
99 maybebadio(port);
102 void __iomem *titan_ioport_map(unsigned long port, unsigned int size)
104 if (PXSEG(port))
105 return (void __iomem *)port;
107 return (void __iomem *)port2adr(port);