mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-11 07:34:31 +00:00
2895c4b7d6
Introduce a new Kconfig option for architecture codes to control whether it provides io{read,write}{8,16,32} I/O accessor functions. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
72 lines
1.4 KiB
C
72 lines
1.4 KiB
C
/* SPDX-License-Identifier: GPL-2.0+ */
|
|
|
|
#ifndef _LINUX_IO_H
|
|
#define _LINUX_IO_H
|
|
|
|
#include <linux/compiler.h>
|
|
#include <linux/types.h>
|
|
#include <asm/io.h>
|
|
|
|
#ifndef CONFIG_HAVE_ARCH_IOMAP
|
|
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);
|
|
}
|
|
#endif /* !CONFIG_HAVE_ARCH_IOMAP */
|
|
|
|
#ifdef CONFIG_64BIT
|
|
static inline u64 ioread64(const volatile void __iomem *addr)
|
|
{
|
|
return readq(addr);
|
|
}
|
|
#endif /* CONFIG_64BIT */
|
|
|
|
#ifndef CONFIG_HAVE_ARCH_IOMAP
|
|
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);
|
|
}
|
|
#endif /* !CONFIG_HAVE_ARCH_IOMAP */
|
|
|
|
#ifdef CONFIG_64BIT
|
|
static inline void iowrite64(u64 value, volatile void __iomem *addr)
|
|
{
|
|
writeq(value, addr);
|
|
}
|
|
#endif /* CONFIG_64BIT */
|
|
|
|
#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
|
|
|
|
#endif /* _LINUX_IO_H */
|