2018-05-06 21:58:06 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
2015-05-15 13:05:18 +00:00
|
|
|
|
|
|
|
#ifndef _LINUX_IO_H
|
|
|
|
#define _LINUX_IO_H
|
|
|
|
|
2016-06-28 01:48:42 +00:00
|
|
|
#include <linux/compiler.h>
|
|
|
|
#include <linux/types.h>
|
2015-05-15 13:05:18 +00:00
|
|
|
#include <asm/io.h>
|
|
|
|
|
2018-10-15 09:21:15 +00:00
|
|
|
#ifndef CONFIG_HAVE_ARCH_IOMAP
|
2017-08-25 16:02:39 +00:00
|
|
|
static inline u8 ioread8(const volatile void __iomem *addr)
|
|
|
|
{
|
|
|
|
return readb(addr);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline u16 ioread16(const volatile void __iomem *addr)
|
|
|
|
{
|
|
|
|
return readw(addr);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline u32 ioread32(const volatile void __iomem *addr)
|
|
|
|
{
|
|
|
|
return readl(addr);
|
|
|
|
}
|
2018-10-15 09:21:15 +00:00
|
|
|
#endif /* !CONFIG_HAVE_ARCH_IOMAP */
|
2017-08-25 16:02:39 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_64BIT
|
|
|
|
static inline u64 ioread64(const volatile void __iomem *addr)
|
|
|
|
{
|
|
|
|
return readq(addr);
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_64BIT */
|
|
|
|
|
2018-10-15 09:21:15 +00:00
|
|
|
#ifndef CONFIG_HAVE_ARCH_IOMAP
|
2017-08-25 16:02:39 +00:00
|
|
|
static inline void iowrite8(u8 value, volatile void __iomem *addr)
|
|
|
|
{
|
|
|
|
writeb(value, addr);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void iowrite16(u16 value, volatile void __iomem *addr)
|
|
|
|
{
|
|
|
|
writew(value, addr);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void iowrite32(u32 value, volatile void __iomem *addr)
|
|
|
|
{
|
|
|
|
writel(value, addr);
|
|
|
|
}
|
2018-10-15 09:21:15 +00:00
|
|
|
#endif /* !CONFIG_HAVE_ARCH_IOMAP */
|
2017-08-25 16:02:39 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_64BIT
|
|
|
|
static inline void iowrite64(u64 value, volatile void __iomem *addr)
|
|
|
|
{
|
|
|
|
writeq(value, addr);
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_64BIT */
|
|
|
|
|
2016-06-28 01:48:42 +00:00
|
|
|
#ifndef CONFIG_HAVE_ARCH_IOREMAP
|
|
|
|
static inline void __iomem *ioremap(resource_size_t offset,
|
|
|
|
resource_size_t size)
|
|
|
|
{
|
|
|
|
return (void __iomem *)(unsigned long)offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void iounmap(void __iomem *addr)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
#define devm_ioremap(dev, offset, size) ioremap(offset, size)
|
|
|
|
#endif
|
|
|
|
|
2015-05-15 13:05:18 +00:00
|
|
|
#endif /* _LINUX_IO_H */
|