Staging: heci: fix setting h_is bit in h_csr register
[linux-2.6] / arch / sh / boards / mach-titan / io.c
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>
9
10 static inline unsigned int port2adr(unsigned int port)
11 {
12         maybebadio((unsigned long)port);
13         return port;
14 }
15
16 u8 titan_inb(unsigned long port)
17 {
18         if (PXSEG(port))
19                 return ctrl_inb(port);
20         return ctrl_inw(port2adr(port)) & 0xff;
21 }
22
23 u8 titan_inb_p(unsigned long port)
24 {
25         u8 v;
26
27         if (PXSEG(port))
28                 v = ctrl_inb(port);
29         else
30                 v = ctrl_inw(port2adr(port)) & 0xff;
31         ctrl_delay();
32         return v;
33 }
34
35 u16 titan_inw(unsigned long port)
36 {
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;
44 }
45
46 u32 titan_inl(unsigned long port)
47 {
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;
55 }
56
57 void titan_outb(u8 value, unsigned long port)
58 {
59         if (PXSEG(port))
60                 ctrl_outb(value, port);
61         else
62                 ctrl_outw(value, port2adr(port));
63 }
64
65 void titan_outb_p(u8 value, unsigned long port)
66 {
67         if (PXSEG(port))
68                 ctrl_outb(value, port);
69         else
70                 ctrl_outw(value, port2adr(port));
71         ctrl_delay();
72 }
73
74 void titan_outw(u16 value, unsigned long port)
75 {
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);
82 }
83
84 void titan_outl(u32 value, unsigned long port)
85 {
86         if (PXSEG(port))
87                 ctrl_outl(value, port);
88         else
89                 maybebadio(port);
90 }
91
92 void titan_insl(unsigned long port, void *dst, unsigned long count)
93 {
94         maybebadio(port);
95 }
96
97 void titan_outsl(unsigned long port, const void *src, unsigned long count)
98 {
99         maybebadio(port);
100 }
101
102 void __iomem *titan_ioport_map(unsigned long port, unsigned int size)
103 {
104         if (PXSEG(port))
105                 return (void __iomem *)port;
106
107         return (void __iomem *)port2adr(port);
108 }