Linux 5.7.6
[linux/fpc-iii.git] / arch / h8300 / include / asm / io.h
blob096d99580db66be5269050c6b407a4839b6a8762
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _H8300_IO_H
3 #define _H8300_IO_H
5 #ifdef __KERNEL__
7 #include <linux/types.h>
9 /* H8/300 internal I/O functions */
11 #define __raw_readb __raw_readb
12 static inline u8 __raw_readb(const volatile void __iomem *addr)
14 return *(volatile u8 *)addr;
17 #define __raw_readw __raw_readw
18 static inline u16 __raw_readw(const volatile void __iomem *addr)
20 return *(volatile u16 *)addr;
23 #define __raw_readl __raw_readl
24 static inline u32 __raw_readl(const volatile void __iomem *addr)
26 return *(volatile u32 *)addr;
29 #define __raw_writeb __raw_writeb
30 static inline void __raw_writeb(u8 b, const volatile void __iomem *addr)
32 *(volatile u8 *)addr = b;
35 #define __raw_writew __raw_writew
36 static inline void __raw_writew(u16 b, const volatile void __iomem *addr)
38 *(volatile u16 *)addr = b;
41 #define __raw_writel __raw_writel
42 static inline void __raw_writel(u32 b, const volatile void __iomem *addr)
44 *(volatile u32 *)addr = b;
47 static inline void ctrl_bclr(int b, void __iomem *addr)
49 if (__builtin_constant_p(b))
50 __asm__("bclr %1,%0" : "+WU"(*(u8 *)addr): "i"(b));
51 else
52 __asm__("bclr %w1,%0" : "+WU"(*(u8 *)addr): "r"(b));
55 static inline void ctrl_bset(int b, void __iomem *addr)
57 if (__builtin_constant_p(b))
58 __asm__("bset %1,%0" : "+WU"(*(u8 *)addr): "i"(b));
59 else
60 __asm__("bset %w1,%0" : "+WU"(*(u8 *)addr): "r"(b));
63 #include <asm-generic/io.h>
65 #endif /* __KERNEL__ */
67 #endif /* _H8300_IO_H */