]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - arch/h8300/include/asm/io.h
Merge remote-tracking branch 'drm-tegra/drm/tegra/for-next'
[karo-tx-linux.git] / arch / h8300 / include / asm / io.h
1 #ifndef _H8300_IO_H
2 #define _H8300_IO_H
3
4 #ifdef __KERNEL__
5
6 #include <asm-generic/io.h>
7
8 /* H8/300 internal I/O functions */
9 static inline unsigned char ctrl_inb(unsigned long addr)
10 {
11         return *(volatile unsigned char *)addr;
12 }
13
14 static inline unsigned short ctrl_inw(unsigned long addr)
15 {
16         return *(volatile unsigned short *)addr;
17 }
18
19 static inline unsigned long ctrl_inl(unsigned long addr)
20 {
21         return *(volatile unsigned long *)addr;
22 }
23
24 static inline void ctrl_outb(unsigned char b, unsigned long addr)
25 {
26         *(volatile unsigned char *)addr = b;
27 }
28
29 static inline void ctrl_outw(unsigned short b, unsigned long addr)
30 {
31         *(volatile unsigned short *)addr = b;
32 }
33
34 static inline void ctrl_outl(unsigned long b, unsigned long addr)
35 {
36         *(volatile unsigned long *)addr = b;
37 }
38
39 static inline void ctrl_bclr(int b, unsigned char *addr)
40 {
41         if (__builtin_constant_p(b))
42                 __asm__("bclr %1,%0" : "+WU"(*addr): "i"(b));
43         else
44                 __asm__("bclr %w1,%0" : "+WU"(*addr): "r"(b));
45 }
46
47 static inline void ctrl_bset(int b, unsigned char *addr)
48 {
49         if (__builtin_constant_p(b))
50                 __asm__("bset %1,%0" : "+WU"(*addr): "i"(b));
51         else
52                 __asm__("bset %w1,%0" : "+WU"(*addr): "r"(b));
53 }
54
55 #endif /* __KERNEL__ */
56
57 #endif /* _H8300_IO_H */