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