linux/arch/h8300/include/asm/io.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0 */
   2#ifndef _H8300_IO_H
   3#define _H8300_IO_H
   4
   5#ifdef __KERNEL__
   6
   7#include <linux/types.h>
   8
   9/* H8/300 internal I/O functions */
  10
  11#define __raw_readb __raw_readb
  12static inline u8 __raw_readb(const volatile void __iomem *addr)
  13{
  14        return *(volatile u8 *)addr;
  15}
  16
  17#define __raw_readw __raw_readw
  18static inline u16 __raw_readw(const volatile void __iomem *addr)
  19{
  20        return *(volatile u16 *)addr;
  21}
  22
  23#define __raw_readl __raw_readl
  24static inline u32  __raw_readl(const volatile void __iomem *addr)
  25{
  26        return *(volatile u32 *)addr;
  27}
  28
  29#define __raw_writeb __raw_writeb
  30static inline void __raw_writeb(u8 b, const volatile void __iomem *addr)
  31{
  32        *(volatile u8 *)addr = b;
  33}
  34
  35#define __raw_writew __raw_writew
  36static inline void __raw_writew(u16 b, const volatile void __iomem *addr)
  37{
  38        *(volatile u16 *)addr = b;
  39}
  40
  41#define __raw_writel __raw_writel
  42static inline void __raw_writel(u32 b, const volatile void __iomem *addr)
  43{
  44        *(volatile u32 *)addr = b;
  45}
  46
  47static inline void ctrl_bclr(int b, void __iomem *addr)
  48{
  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));
  53}
  54
  55static inline void ctrl_bset(int b, void __iomem *addr)
  56{
  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));
  61}
  62
  63#include <asm-generic/io.h>
  64
  65#endif /* __KERNEL__ */
  66
  67#endif /* _H8300_IO_H */
  68