]>
Commit | Line | Data |
---|---|---|
d2a5f499 YS |
1 | #ifndef _H8300_IO_H |
2 | #define _H8300_IO_H | |
3 | ||
4 | #ifdef __KERNEL__ | |
5 | ||
d2a5f499 | 6 | /* H8/300 internal I/O functions */ |
75160515 DL |
7 | |
8 | #define __raw_readb __raw_readb | |
9 | static inline u8 __raw_readb(const volatile void __iomem *addr) | |
d2a5f499 | 10 | { |
75160515 | 11 | return *(volatile u8 *)addr; |
d2a5f499 YS |
12 | } |
13 | ||
75160515 DL |
14 | #define __raw_readw __raw_readw |
15 | static inline u16 __raw_readw(const volatile void __iomem *addr) | |
d2a5f499 | 16 | { |
75160515 | 17 | return *(volatile u16 *)addr; |
d2a5f499 YS |
18 | } |
19 | ||
75160515 DL |
20 | #define __raw_readl __raw_readl |
21 | static inline u32 __raw_readl(const volatile void __iomem *addr) | |
d2a5f499 | 22 | { |
75160515 | 23 | return *(volatile u32 *)addr; |
d2a5f499 YS |
24 | } |
25 | ||
75160515 DL |
26 | #define __raw_writeb __raw_writeb |
27 | static inline void __raw_writeb(u8 b, const volatile void __iomem *addr) | |
d2a5f499 | 28 | { |
75160515 | 29 | *(volatile u8 *)addr = b; |
d2a5f499 YS |
30 | } |
31 | ||
75160515 DL |
32 | #define __raw_writew __raw_writew |
33 | static inline void __raw_writew(u16 b, const volatile void __iomem *addr) | |
d2a5f499 | 34 | { |
75160515 | 35 | *(volatile u16 *)addr = b; |
d2a5f499 YS |
36 | } |
37 | ||
75160515 DL |
38 | #define __raw_writel __raw_writel |
39 | static inline void __raw_writel(u32 b, const volatile void __iomem *addr) | |
d2a5f499 | 40 | { |
75160515 | 41 | *(volatile u32 *)addr = b; |
d2a5f499 YS |
42 | } |
43 | ||
75160515 | 44 | static inline void ctrl_bclr(int b, void __iomem *addr) |
d2a5f499 YS |
45 | { |
46 | if (__builtin_constant_p(b)) | |
a795239b | 47 | __asm__("bclr %1,%0" : "+WU"(*addr): "i"(b)); |
d2a5f499 | 48 | else |
a795239b | 49 | __asm__("bclr %w1,%0" : "+WU"(*addr): "r"(b)); |
d2a5f499 YS |
50 | } |
51 | ||
75160515 | 52 | static inline void ctrl_bset(int b, void __iomem *addr) |
d2a5f499 YS |
53 | { |
54 | if (__builtin_constant_p(b)) | |
a795239b | 55 | __asm__("bset %1,%0" : "+WU"(*addr): "i"(b)); |
d2a5f499 | 56 | else |
a795239b | 57 | __asm__("bset %w1,%0" : "+WU"(*addr): "r"(b)); |
d2a5f499 YS |
58 | } |
59 | ||
75160515 DL |
60 | #include <asm-generic/io.h> |
61 | ||
d2a5f499 YS |
62 | #endif /* __KERNEL__ */ |
63 | ||
64 | #endif /* _H8300_IO_H */ |