diff options
author | Mike Frysinger <vapier@gentoo.org> | 2010-10-18 03:09:39 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2010-10-18 03:20:46 -0400 |
commit | 35dbc0e020c6587f78a6c17693beca73aead7b54 (patch) | |
tree | 401ab115c4b5a558b50665c16a1fbf055775062a /include/asm-generic | |
parent | d852a6afd91fc928128f59ebff381838c365e358 (diff) |
asm-generic/io.h: allow people to override individual funcs
For the Blackfin port, we can use much of the asm-generic/io.h header,
but we still need to declare some of our own versions of functions.
Like the __raw_read* and in/out "string" helpers. So let people do
this easily for many of these funcs.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'include/asm-generic')
-rw-r--r-- | include/asm-generic/io.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h index 118601fce92d..3577ca11a0be 100644 --- a/include/asm-generic/io.h +++ b/include/asm-generic/io.h | |||
@@ -19,7 +19,9 @@ | |||
19 | #include <asm-generic/iomap.h> | 19 | #include <asm-generic/iomap.h> |
20 | #endif | 20 | #endif |
21 | 21 | ||
22 | #ifndef mmiowb | ||
22 | #define mmiowb() do {} while (0) | 23 | #define mmiowb() do {} while (0) |
24 | #endif | ||
23 | 25 | ||
24 | /*****************************************************************************/ | 26 | /*****************************************************************************/ |
25 | /* | 27 | /* |
@@ -28,39 +30,51 @@ | |||
28 | * differently. On the simple architectures, we just read/write the | 30 | * differently. On the simple architectures, we just read/write the |
29 | * memory location directly. | 31 | * memory location directly. |
30 | */ | 32 | */ |
33 | #ifndef __raw_readb | ||
31 | static inline u8 __raw_readb(const volatile void __iomem *addr) | 34 | static inline u8 __raw_readb(const volatile void __iomem *addr) |
32 | { | 35 | { |
33 | return *(const volatile u8 __force *) addr; | 36 | return *(const volatile u8 __force *) addr; |
34 | } | 37 | } |
38 | #endif | ||
35 | 39 | ||
40 | #ifndef __raw_readw | ||
36 | static inline u16 __raw_readw(const volatile void __iomem *addr) | 41 | static inline u16 __raw_readw(const volatile void __iomem *addr) |
37 | { | 42 | { |
38 | return *(const volatile u16 __force *) addr; | 43 | return *(const volatile u16 __force *) addr; |
39 | } | 44 | } |
45 | #endif | ||
40 | 46 | ||
47 | #ifndef __raw_readl | ||
41 | static inline u32 __raw_readl(const volatile void __iomem *addr) | 48 | static inline u32 __raw_readl(const volatile void __iomem *addr) |
42 | { | 49 | { |
43 | return *(const volatile u32 __force *) addr; | 50 | return *(const volatile u32 __force *) addr; |
44 | } | 51 | } |
52 | #endif | ||
45 | 53 | ||
46 | #define readb __raw_readb | 54 | #define readb __raw_readb |
47 | #define readw(addr) __le16_to_cpu(__raw_readw(addr)) | 55 | #define readw(addr) __le16_to_cpu(__raw_readw(addr)) |
48 | #define readl(addr) __le32_to_cpu(__raw_readl(addr)) | 56 | #define readl(addr) __le32_to_cpu(__raw_readl(addr)) |
49 | 57 | ||
58 | #ifndef __raw_writeb | ||
50 | static inline void __raw_writeb(u8 b, volatile void __iomem *addr) | 59 | static inline void __raw_writeb(u8 b, volatile void __iomem *addr) |
51 | { | 60 | { |
52 | *(volatile u8 __force *) addr = b; | 61 | *(volatile u8 __force *) addr = b; |
53 | } | 62 | } |
63 | #endif | ||
54 | 64 | ||
65 | #ifndef __raw_writew | ||
55 | static inline void __raw_writew(u16 b, volatile void __iomem *addr) | 66 | static inline void __raw_writew(u16 b, volatile void __iomem *addr) |
56 | { | 67 | { |
57 | *(volatile u16 __force *) addr = b; | 68 | *(volatile u16 __force *) addr = b; |
58 | } | 69 | } |
70 | #endif | ||
59 | 71 | ||
72 | #ifndef __raw_writel | ||
60 | static inline void __raw_writel(u32 b, volatile void __iomem *addr) | 73 | static inline void __raw_writel(u32 b, volatile void __iomem *addr) |
61 | { | 74 | { |
62 | *(volatile u32 __force *) addr = b; | 75 | *(volatile u32 __force *) addr = b; |
63 | } | 76 | } |
77 | #endif | ||
64 | 78 | ||
65 | #define writeb __raw_writeb | 79 | #define writeb __raw_writeb |
66 | #define writew(b,addr) __raw_writew(__cpu_to_le16(b),addr) | 80 | #define writew(b,addr) __raw_writew(__cpu_to_le16(b),addr) |
@@ -122,6 +136,7 @@ static inline void outl(u32 b, unsigned long addr) | |||
122 | #define outw_p(x, addr) outw((x), (addr)) | 136 | #define outw_p(x, addr) outw((x), (addr)) |
123 | #define outl_p(x, addr) outl((x), (addr)) | 137 | #define outl_p(x, addr) outl((x), (addr)) |
124 | 138 | ||
139 | #ifndef insb | ||
125 | static inline void insb(unsigned long addr, void *buffer, int count) | 140 | static inline void insb(unsigned long addr, void *buffer, int count) |
126 | { | 141 | { |
127 | if (count) { | 142 | if (count) { |
@@ -132,7 +147,9 @@ static inline void insb(unsigned long addr, void *buffer, int count) | |||
132 | } while (--count); | 147 | } while (--count); |
133 | } | 148 | } |
134 | } | 149 | } |
150 | #endif | ||
135 | 151 | ||
152 | #ifndef insw | ||
136 | static inline void insw(unsigned long addr, void *buffer, int count) | 153 | static inline void insw(unsigned long addr, void *buffer, int count) |
137 | { | 154 | { |
138 | if (count) { | 155 | if (count) { |
@@ -143,7 +160,9 @@ static inline void insw(unsigned long addr, void *buffer, int count) | |||
143 | } while (--count); | 160 | } while (--count); |
144 | } | 161 | } |
145 | } | 162 | } |
163 | #endif | ||
146 | 164 | ||
165 | #ifndef insl | ||
147 | static inline void insl(unsigned long addr, void *buffer, int count) | 166 | static inline void insl(unsigned long addr, void *buffer, int count) |
148 | { | 167 | { |
149 | if (count) { | 168 | if (count) { |
@@ -154,7 +173,9 @@ static inline void insl(unsigned long addr, void *buffer, int count) | |||
154 | } while (--count); | 173 | } while (--count); |
155 | } | 174 | } |
156 | } | 175 | } |
176 | #endif | ||
157 | 177 | ||
178 | #ifndef outsb | ||
158 | static inline void outsb(unsigned long addr, const void *buffer, int count) | 179 | static inline void outsb(unsigned long addr, const void *buffer, int count) |
159 | { | 180 | { |
160 | if (count) { | 181 | if (count) { |
@@ -164,7 +185,9 @@ static inline void outsb(unsigned long addr, const void *buffer, int count) | |||
164 | } while (--count); | 185 | } while (--count); |
165 | } | 186 | } |
166 | } | 187 | } |
188 | #endif | ||
167 | 189 | ||
190 | #ifndef outsw | ||
168 | static inline void outsw(unsigned long addr, const void *buffer, int count) | 191 | static inline void outsw(unsigned long addr, const void *buffer, int count) |
169 | { | 192 | { |
170 | if (count) { | 193 | if (count) { |
@@ -174,7 +197,9 @@ static inline void outsw(unsigned long addr, const void *buffer, int count) | |||
174 | } while (--count); | 197 | } while (--count); |
175 | } | 198 | } |
176 | } | 199 | } |
200 | #endif | ||
177 | 201 | ||
202 | #ifndef outsl | ||
178 | static inline void outsl(unsigned long addr, const void *buffer, int count) | 203 | static inline void outsl(unsigned long addr, const void *buffer, int count) |
179 | { | 204 | { |
180 | if (count) { | 205 | if (count) { |
@@ -184,6 +209,7 @@ static inline void outsl(unsigned long addr, const void *buffer, int count) | |||
184 | } while (--count); | 209 | } while (--count); |
185 | } | 210 | } |
186 | } | 211 | } |
212 | #endif | ||
187 | 213 | ||
188 | #ifndef CONFIG_GENERIC_IOMAP | 214 | #ifndef CONFIG_GENERIC_IOMAP |
189 | #define ioread8(addr) readb(addr) | 215 | #define ioread8(addr) readb(addr) |