Commit da6b003adc73011fd441a89c30d4f896667e24ba

Authored by Magnus Damm
Committed by Paul Mundt
1 parent 9d4c826259

sh: add writesb(), readsb(), writesw() and readsw() to io.h

This patch adds inline versions of writesb(), readsb(), writesw() and
readsw() to include/asm-sh/io.h. Stolen from include/asm-avr32/io.h.

These functions are needed to compile certain device drivers such as
ax88796.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>

Showing 1 changed file with 26 additions and 0 deletions Side-by-side Diff

... ... @@ -135,6 +135,32 @@
135 135 # define writel(v,a) ({ __raw_writel((v),(a)); mb(); })
136 136 #endif
137 137  
  138 +#define __BUILD_MEMORY_STRING(bwlq, type) \
  139 + \
  140 +static inline void writes##bwlq(volatile void __iomem *mem, \
  141 + const void *addr, unsigned int count) \
  142 +{ \
  143 + const volatile type *__addr = addr; \
  144 + \
  145 + while (count--) { \
  146 + __raw_write##bwlq(*__addr, mem); \
  147 + __addr++; \
  148 + } \
  149 +} \
  150 + \
  151 +static inline void reads##bwlq(volatile void __iomem *mem, void *addr, \
  152 + unsigned int count) \
  153 +{ \
  154 + volatile type *__addr = addr; \
  155 + \
  156 + while (count--) { \
  157 + *__addr = __raw_read##bwlq(mem); \
  158 + __addr++; \
  159 + } \
  160 +}
  161 +
  162 +__BUILD_MEMORY_STRING(b, u8)
  163 +__BUILD_MEMORY_STRING(w, u16)
138 164 #define writesl __raw_writesl
139 165 #define readsl __raw_readsl
140 166