diff options
Diffstat (limited to 'arch/sh/kernel/io_generic.c')
-rw-r--r-- | arch/sh/kernel/io_generic.c | 180 |
1 files changed, 0 insertions, 180 deletions
diff --git a/arch/sh/kernel/io_generic.c b/arch/sh/kernel/io_generic.c deleted file mode 100644 index 447d78f666f9..000000000000 --- a/arch/sh/kernel/io_generic.c +++ /dev/null | |||
@@ -1,180 +0,0 @@ | |||
1 | /* | ||
2 | * arch/sh/kernel/io_generic.c | ||
3 | * | ||
4 | * Copyright (C) 2000 Niibe Yutaka | ||
5 | * Copyright (C) 2005 - 2007 Paul Mundt | ||
6 | * | ||
7 | * Generic I/O routine. These can be used where a machine specific version | ||
8 | * is not required. | ||
9 | * | ||
10 | * This file is subject to the terms and conditions of the GNU General Public | ||
11 | * License. See the file "COPYING" in the main directory of this archive | ||
12 | * for more details. | ||
13 | */ | ||
14 | #include <linux/module.h> | ||
15 | #include <linux/io.h> | ||
16 | #include <asm/machvec.h> | ||
17 | |||
18 | #ifdef CONFIG_CPU_SH3 | ||
19 | /* SH3 has a PCMCIA bug that needs a dummy read from area 6 for a | ||
20 | * workaround. */ | ||
21 | /* I'm not sure SH7709 has this kind of bug */ | ||
22 | #define dummy_read() __raw_readb(0xba000000) | ||
23 | #else | ||
24 | #define dummy_read() | ||
25 | #endif | ||
26 | |||
27 | unsigned long generic_io_base = 0; | ||
28 | |||
29 | u8 generic_inb(unsigned long port) | ||
30 | { | ||
31 | return __raw_readb(__ioport_map(port, 1)); | ||
32 | } | ||
33 | |||
34 | u16 generic_inw(unsigned long port) | ||
35 | { | ||
36 | return __raw_readw(__ioport_map(port, 2)); | ||
37 | } | ||
38 | |||
39 | u32 generic_inl(unsigned long port) | ||
40 | { | ||
41 | return __raw_readl(__ioport_map(port, 4)); | ||
42 | } | ||
43 | |||
44 | u8 generic_inb_p(unsigned long port) | ||
45 | { | ||
46 | unsigned long v = generic_inb(port); | ||
47 | |||
48 | ctrl_delay(); | ||
49 | return v; | ||
50 | } | ||
51 | |||
52 | u16 generic_inw_p(unsigned long port) | ||
53 | { | ||
54 | unsigned long v = generic_inw(port); | ||
55 | |||
56 | ctrl_delay(); | ||
57 | return v; | ||
58 | } | ||
59 | |||
60 | u32 generic_inl_p(unsigned long port) | ||
61 | { | ||
62 | unsigned long v = generic_inl(port); | ||
63 | |||
64 | ctrl_delay(); | ||
65 | return v; | ||
66 | } | ||
67 | |||
68 | /* | ||
69 | * insb/w/l all read a series of bytes/words/longs from a fixed port | ||
70 | * address. However as the port address doesn't change we only need to | ||
71 | * convert the port address to real address once. | ||
72 | */ | ||
73 | |||
74 | void generic_insb(unsigned long port, void *dst, unsigned long count) | ||
75 | { | ||
76 | __raw_readsb(__ioport_map(port, 1), dst, count); | ||
77 | dummy_read(); | ||
78 | } | ||
79 | |||
80 | void generic_insw(unsigned long port, void *dst, unsigned long count) | ||
81 | { | ||
82 | __raw_readsw(__ioport_map(port, 2), dst, count); | ||
83 | dummy_read(); | ||
84 | } | ||
85 | |||
86 | void generic_insl(unsigned long port, void *dst, unsigned long count) | ||
87 | { | ||
88 | __raw_readsl(__ioport_map(port, 4), dst, count); | ||
89 | dummy_read(); | ||
90 | } | ||
91 | |||
92 | void generic_outb(u8 b, unsigned long port) | ||
93 | { | ||
94 | __raw_writeb(b, __ioport_map(port, 1)); | ||
95 | } | ||
96 | |||
97 | void generic_outw(u16 b, unsigned long port) | ||
98 | { | ||
99 | __raw_writew(b, __ioport_map(port, 2)); | ||
100 | } | ||
101 | |||
102 | void generic_outl(u32 b, unsigned long port) | ||
103 | { | ||
104 | __raw_writel(b, __ioport_map(port, 4)); | ||
105 | } | ||
106 | |||
107 | void generic_outb_p(u8 b, unsigned long port) | ||
108 | { | ||
109 | generic_outb(b, port); | ||
110 | ctrl_delay(); | ||
111 | } | ||
112 | |||
113 | void generic_outw_p(u16 b, unsigned long port) | ||
114 | { | ||
115 | generic_outw(b, port); | ||
116 | ctrl_delay(); | ||
117 | } | ||
118 | |||
119 | void generic_outl_p(u32 b, unsigned long port) | ||
120 | { | ||
121 | generic_outl(b, port); | ||
122 | ctrl_delay(); | ||
123 | } | ||
124 | |||
125 | /* | ||
126 | * outsb/w/l all write a series of bytes/words/longs to a fixed port | ||
127 | * address. However as the port address doesn't change we only need to | ||
128 | * convert the port address to real address once. | ||
129 | */ | ||
130 | void generic_outsb(unsigned long port, const void *src, unsigned long count) | ||
131 | { | ||
132 | __raw_writesb(__ioport_map(port, 1), src, count); | ||
133 | dummy_read(); | ||
134 | } | ||
135 | |||
136 | void generic_outsw(unsigned long port, const void *src, unsigned long count) | ||
137 | { | ||
138 | __raw_writesw(__ioport_map(port, 2), src, count); | ||
139 | dummy_read(); | ||
140 | } | ||
141 | |||
142 | void generic_outsl(unsigned long port, const void *src, unsigned long count) | ||
143 | { | ||
144 | __raw_writesl(__ioport_map(port, 4), src, count); | ||
145 | dummy_read(); | ||
146 | } | ||
147 | |||
148 | void __iomem *generic_ioport_map(unsigned long addr, unsigned int size) | ||
149 | { | ||
150 | #ifdef P1SEG | ||
151 | if (PXSEG(addr) >= P1SEG) | ||
152 | return (void __iomem *)addr; | ||
153 | #endif | ||
154 | |||
155 | return (void __iomem *)(addr + generic_io_base); | ||
156 | } | ||
157 | |||
158 | void generic_ioport_unmap(void __iomem *addr) | ||
159 | { | ||
160 | } | ||
161 | |||
162 | #ifndef CONFIG_GENERIC_IOMAP | ||
163 | void __iomem *ioport_map(unsigned long port, unsigned int nr) | ||
164 | { | ||
165 | void __iomem *ret; | ||
166 | |||
167 | ret = __ioport_map_trapped(port, nr); | ||
168 | if (ret) | ||
169 | return ret; | ||
170 | |||
171 | return __ioport_map(port, nr); | ||
172 | } | ||
173 | EXPORT_SYMBOL(ioport_map); | ||
174 | |||
175 | void ioport_unmap(void __iomem *addr) | ||
176 | { | ||
177 | sh_mv.mv_ioport_unmap(addr); | ||
178 | } | ||
179 | EXPORT_SYMBOL(ioport_unmap); | ||
180 | #endif /* CONFIG_GENERIC_IOMAP */ | ||