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>

authored by Mike Frysinger and committed by Arnd Bergmann 35dbc0e0 d852a6af

+26
+26
include/asm-generic/io.h
··· 19 #include <asm-generic/iomap.h> 20 #endif 21 22 #define mmiowb() do {} while (0) 23 24 /*****************************************************************************/ 25 /* ··· 30 * differently. On the simple architectures, we just read/write the 31 * memory location directly. 32 */ 33 static inline u8 __raw_readb(const volatile void __iomem *addr) 34 { 35 return *(const volatile u8 __force *) addr; 36 } 37 38 static inline u16 __raw_readw(const volatile void __iomem *addr) 39 { 40 return *(const volatile u16 __force *) addr; 41 } 42 43 static inline u32 __raw_readl(const volatile void __iomem *addr) 44 { 45 return *(const volatile u32 __force *) addr; 46 } 47 48 #define readb __raw_readb 49 #define readw(addr) __le16_to_cpu(__raw_readw(addr)) 50 #define readl(addr) __le32_to_cpu(__raw_readl(addr)) 51 52 static inline void __raw_writeb(u8 b, volatile void __iomem *addr) 53 { 54 *(volatile u8 __force *) addr = b; 55 } 56 57 static inline void __raw_writew(u16 b, volatile void __iomem *addr) 58 { 59 *(volatile u16 __force *) addr = b; 60 } 61 62 static inline void __raw_writel(u32 b, volatile void __iomem *addr) 63 { 64 *(volatile u32 __force *) addr = b; 65 } 66 67 #define writeb __raw_writeb 68 #define writew(b,addr) __raw_writew(__cpu_to_le16(b),addr) ··· 136 #define outw_p(x, addr) outw((x), (addr)) 137 #define outl_p(x, addr) outl((x), (addr)) 138 139 static inline void insb(unsigned long addr, void *buffer, int count) 140 { 141 if (count) { ··· 147 } while (--count); 148 } 149 } 150 151 static inline void insw(unsigned long addr, void *buffer, int count) 152 { 153 if (count) { ··· 160 } while (--count); 161 } 162 } 163 164 static inline void insl(unsigned long addr, void *buffer, int count) 165 { 166 if (count) { ··· 173 } while (--count); 174 } 175 } 176 177 static inline void outsb(unsigned long addr, const void *buffer, int count) 178 { 179 if (count) { ··· 185 } while (--count); 186 } 187 } 188 189 static inline void outsw(unsigned long addr, const void *buffer, int count) 190 { 191 if (count) { ··· 197 } while (--count); 198 } 199 } 200 201 static inline void outsl(unsigned long addr, const void *buffer, int count) 202 { 203 if (count) { ··· 209 } while (--count); 210 } 211 } 212 213 #ifndef CONFIG_GENERIC_IOMAP 214 #define ioread8(addr) readb(addr)
··· 19 #include <asm-generic/iomap.h> 20 #endif 21 22 + #ifndef mmiowb 23 #define mmiowb() do {} while (0) 24 + #endif 25 26 /*****************************************************************************/ 27 /* ··· 28 * differently. On the simple architectures, we just read/write the 29 * memory location directly. 30 */ 31 + #ifndef __raw_readb 32 static inline u8 __raw_readb(const volatile void __iomem *addr) 33 { 34 return *(const volatile u8 __force *) addr; 35 } 36 + #endif 37 38 + #ifndef __raw_readw 39 static inline u16 __raw_readw(const volatile void __iomem *addr) 40 { 41 return *(const volatile u16 __force *) addr; 42 } 43 + #endif 44 45 + #ifndef __raw_readl 46 static inline u32 __raw_readl(const volatile void __iomem *addr) 47 { 48 return *(const volatile u32 __force *) addr; 49 } 50 + #endif 51 52 #define readb __raw_readb 53 #define readw(addr) __le16_to_cpu(__raw_readw(addr)) 54 #define readl(addr) __le32_to_cpu(__raw_readl(addr)) 55 56 + #ifndef __raw_writeb 57 static inline void __raw_writeb(u8 b, volatile void __iomem *addr) 58 { 59 *(volatile u8 __force *) addr = b; 60 } 61 + #endif 62 63 + #ifndef __raw_writew 64 static inline void __raw_writew(u16 b, volatile void __iomem *addr) 65 { 66 *(volatile u16 __force *) addr = b; 67 } 68 + #endif 69 70 + #ifndef __raw_writel 71 static inline void __raw_writel(u32 b, volatile void __iomem *addr) 72 { 73 *(volatile u32 __force *) addr = b; 74 } 75 + #endif 76 77 #define writeb __raw_writeb 78 #define writew(b,addr) __raw_writew(__cpu_to_le16(b),addr) ··· 122 #define outw_p(x, addr) outw((x), (addr)) 123 #define outl_p(x, addr) outl((x), (addr)) 124 125 + #ifndef insb 126 static inline void insb(unsigned long addr, void *buffer, int count) 127 { 128 if (count) { ··· 132 } while (--count); 133 } 134 } 135 + #endif 136 137 + #ifndef insw 138 static inline void insw(unsigned long addr, void *buffer, int count) 139 { 140 if (count) { ··· 143 } while (--count); 144 } 145 } 146 + #endif 147 148 + #ifndef insl 149 static inline void insl(unsigned long addr, void *buffer, int count) 150 { 151 if (count) { ··· 154 } while (--count); 155 } 156 } 157 + #endif 158 159 + #ifndef outsb 160 static inline void outsb(unsigned long addr, const void *buffer, int count) 161 { 162 if (count) { ··· 164 } while (--count); 165 } 166 } 167 + #endif 168 169 + #ifndef outsw 170 static inline void outsw(unsigned long addr, const void *buffer, int count) 171 { 172 if (count) { ··· 174 } while (--count); 175 } 176 } 177 + #endif 178 179 + #ifndef outsl 180 static inline void outsl(unsigned long addr, const void *buffer, int count) 181 { 182 if (count) { ··· 184 } while (--count); 185 } 186 } 187 + #endif 188 189 #ifndef CONFIG_GENERIC_IOMAP 190 #define ioread8(addr) readb(addr)