diff options
Diffstat (limited to 'include/asm-generic/io.h')
-rw-r--r-- | include/asm-generic/io.h | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h index 33bbbae4ddc6..ac9da00e9f2c 100644 --- a/include/asm-generic/io.h +++ b/include/asm-generic/io.h | |||
@@ -53,8 +53,18 @@ static inline u32 __raw_readl(const volatile void __iomem *addr) | |||
53 | #endif | 53 | #endif |
54 | 54 | ||
55 | #define readb __raw_readb | 55 | #define readb __raw_readb |
56 | #define readw(addr) __le16_to_cpu(__raw_readw(addr)) | 56 | |
57 | #define readl(addr) __le32_to_cpu(__raw_readl(addr)) | 57 | #define readw readw |
58 | static inline u16 readw(const volatile void __iomem *addr) | ||
59 | { | ||
60 | return __le16_to_cpu(__raw_readw(addr)); | ||
61 | } | ||
62 | |||
63 | #define readl readl | ||
64 | static inline u32 readl(const volatile void __iomem *addr) | ||
65 | { | ||
66 | return __le32_to_cpu(__raw_readl(addr)); | ||
67 | } | ||
58 | 68 | ||
59 | #ifndef __raw_writeb | 69 | #ifndef __raw_writeb |
60 | static inline void __raw_writeb(u8 b, volatile void __iomem *addr) | 70 | static inline void __raw_writeb(u8 b, volatile void __iomem *addr) |
@@ -89,7 +99,11 @@ static inline u64 __raw_readq(const volatile void __iomem *addr) | |||
89 | } | 99 | } |
90 | #endif | 100 | #endif |
91 | 101 | ||
92 | #define readq(addr) __le64_to_cpu(__raw_readq(addr)) | 102 | #define readq readq |
103 | static inline u64 readq(const volatile void __iomem *addr) | ||
104 | { | ||
105 | return __le64_to_cpu(__raw_readq(addr)); | ||
106 | } | ||
93 | 107 | ||
94 | #ifndef __raw_writeq | 108 | #ifndef __raw_writeq |
95 | static inline void __raw_writeq(u64 b, volatile void __iomem *addr) | 109 | static inline void __raw_writeq(u64 b, volatile void __iomem *addr) |
@@ -225,15 +239,15 @@ static inline void outsl(unsigned long addr, const void *buffer, int count) | |||
225 | #ifndef CONFIG_GENERIC_IOMAP | 239 | #ifndef CONFIG_GENERIC_IOMAP |
226 | #define ioread8(addr) readb(addr) | 240 | #define ioread8(addr) readb(addr) |
227 | #define ioread16(addr) readw(addr) | 241 | #define ioread16(addr) readw(addr) |
228 | #define ioread16be(addr) be16_to_cpu(ioread16(addr)) | 242 | #define ioread16be(addr) __be16_to_cpu(__raw_readw(addr)) |
229 | #define ioread32(addr) readl(addr) | 243 | #define ioread32(addr) readl(addr) |
230 | #define ioread32be(addr) be32_to_cpu(ioread32(addr)) | 244 | #define ioread32be(addr) __be32_to_cpu(__raw_readl(addr)) |
231 | 245 | ||
232 | #define iowrite8(v, addr) writeb((v), (addr)) | 246 | #define iowrite8(v, addr) writeb((v), (addr)) |
233 | #define iowrite16(v, addr) writew((v), (addr)) | 247 | #define iowrite16(v, addr) writew((v), (addr)) |
234 | #define iowrite16be(v, addr) iowrite16(be16_to_cpu(v), (addr)) | 248 | #define iowrite16be(v, addr) __raw_writew(__cpu_to_be16(v), addr) |
235 | #define iowrite32(v, addr) writel((v), (addr)) | 249 | #define iowrite32(v, addr) writel((v), (addr)) |
236 | #define iowrite32be(v, addr) iowrite32(be32_to_cpu(v), (addr)) | 250 | #define iowrite32be(v, addr) __raw_writel(__cpu_to_be32(v), addr) |
237 | 251 | ||
238 | #define ioread8_rep(p, dst, count) \ | 252 | #define ioread8_rep(p, dst, count) \ |
239 | insb((unsigned long) (p), (dst), (count)) | 253 | insb((unsigned long) (p), (dst), (count)) |
@@ -332,6 +346,7 @@ extern void ioport_unmap(void __iomem *p); | |||
332 | #define xlate_dev_kmem_ptr(p) p | 346 | #define xlate_dev_kmem_ptr(p) p |
333 | #define xlate_dev_mem_ptr(p) __va(p) | 347 | #define xlate_dev_mem_ptr(p) __va(p) |
334 | 348 | ||
349 | #ifdef CONFIG_VIRT_TO_BUS | ||
335 | #ifndef virt_to_bus | 350 | #ifndef virt_to_bus |
336 | static inline unsigned long virt_to_bus(volatile void *address) | 351 | static inline unsigned long virt_to_bus(volatile void *address) |
337 | { | 352 | { |
@@ -343,6 +358,7 @@ static inline void *bus_to_virt(unsigned long address) | |||
343 | return (void *) address; | 358 | return (void *) address; |
344 | } | 359 | } |
345 | #endif | 360 | #endif |
361 | #endif | ||
346 | 362 | ||
347 | #ifndef memset_io | 363 | #ifndef memset_io |
348 | #define memset_io(a, b, c) memset(__io_virt(a), (b), (c)) | 364 | #define memset_io(a, b, c) memset(__io_virt(a), (b), (c)) |