aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/io_generic.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/kernel/io_generic.c')
-rw-r--r--arch/sh/kernel/io_generic.c189
1 files changed, 0 insertions, 189 deletions
diff --git a/arch/sh/kernel/io_generic.c b/arch/sh/kernel/io_generic.c
deleted file mode 100644
index 5a7f554d9ca1..000000000000
--- a/arch/sh/kernel/io_generic.c
+++ /dev/null
@@ -1,189 +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
27unsigned long generic_io_base;
28
29u8 generic_inb(unsigned long port)
30{
31 return __raw_readb(__ioport_map(port, 1));
32}
33
34u16 generic_inw(unsigned long port)
35{
36 return __raw_readw(__ioport_map(port, 2));
37}
38
39u32 generic_inl(unsigned long port)
40{
41 return __raw_readl(__ioport_map(port, 4));
42}
43
44u8 generic_inb_p(unsigned long port)
45{
46 unsigned long v = generic_inb(port);
47
48 ctrl_delay();
49 return v;
50}
51
52u16 generic_inw_p(unsigned long port)
53{
54 unsigned long v = generic_inw(port);
55
56 ctrl_delay();
57 return v;
58}
59
60u32 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
74void generic_insb(unsigned long port, void *dst, unsigned long count)
75{
76 volatile u8 *port_addr;
77 u8 *buf = dst;
78
79 port_addr = (volatile u8 __force *)__ioport_map(port, 1);
80 while (count--)
81 *buf++ = *port_addr;
82}
83
84void generic_insw(unsigned long port, void *dst, unsigned long count)
85{
86 volatile u16 *port_addr;
87 u16 *buf = dst;
88
89 port_addr = (volatile u16 __force *)__ioport_map(port, 2);
90 while (count--)
91 *buf++ = *port_addr;
92
93 dummy_read();
94}
95
96void generic_insl(unsigned long port, void *dst, unsigned long count)
97{
98 volatile u32 *port_addr;
99 u32 *buf = dst;
100
101 port_addr = (volatile u32 __force *)__ioport_map(port, 4);
102 while (count--)
103 *buf++ = *port_addr;
104
105 dummy_read();
106}
107
108void generic_outb(u8 b, unsigned long port)
109{
110 __raw_writeb(b, __ioport_map(port, 1));
111}
112
113void generic_outw(u16 b, unsigned long port)
114{
115 __raw_writew(b, __ioport_map(port, 2));
116}
117
118void generic_outl(u32 b, unsigned long port)
119{
120 __raw_writel(b, __ioport_map(port, 4));
121}
122
123void generic_outb_p(u8 b, unsigned long port)
124{
125 generic_outb(b, port);
126 ctrl_delay();
127}
128
129void generic_outw_p(u16 b, unsigned long port)
130{
131 generic_outw(b, port);
132 ctrl_delay();
133}
134
135void generic_outl_p(u32 b, unsigned long port)
136{
137 generic_outl(b, port);
138 ctrl_delay();
139}
140
141/*
142 * outsb/w/l all write a series of bytes/words/longs to a fixed port
143 * address. However as the port address doesn't change we only need to
144 * convert the port address to real address once.
145 */
146void generic_outsb(unsigned long port, const void *src, unsigned long count)
147{
148 volatile u8 *port_addr;
149 const u8 *buf = src;
150
151 port_addr = (volatile u8 __force *)__ioport_map(port, 1);
152
153 while (count--)
154 *port_addr = *buf++;
155}
156
157void generic_outsw(unsigned long port, const void *src, unsigned long count)
158{
159 volatile u16 *port_addr;
160 const u16 *buf = src;
161
162 port_addr = (volatile u16 __force *)__ioport_map(port, 2);
163
164 while (count--)
165 *port_addr = *buf++;
166
167 dummy_read();
168}
169
170void generic_outsl(unsigned long port, const void *src, unsigned long count)
171{
172 volatile u32 *port_addr;
173 const u32 *buf = src;
174
175 port_addr = (volatile u32 __force *)__ioport_map(port, 4);
176 while (count--)
177 *port_addr = *buf++;
178
179 dummy_read();
180}
181
182void __iomem *generic_ioport_map(unsigned long addr, unsigned int size)
183{
184 return (void __iomem *)(addr + generic_io_base);
185}
186
187void generic_ioport_unmap(void __iomem *addr)
188{
189}