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