1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * IO definitions for the Hexagon architecture
5 * Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
11 #include <linux/types.h>
13 #include <asm/cacheflush.h>
15 extern int remap_area_pages(unsigned long start, unsigned long phys_addr,
16 unsigned long end, unsigned long flags);
19 * virt_to_phys - map virtual address to physical
20 * @address: address to map
22 static inline unsigned long virt_to_phys(volatile void *address)
28 * phys_to_virt - map physical address to virtual
29 * @address: address to map
31 static inline void *phys_to_virt(unsigned long address)
37 * readb - read byte from memory mapped device
38 * @addr: pointer to memory
41 static inline u8 __raw_readb(const volatile void __iomem *addr)
51 #define __raw_readb __raw_readb
53 static inline u16 __raw_readw(const volatile void __iomem *addr)
63 #define __raw_readw __raw_readw
65 static inline u32 __raw_readl(const volatile void __iomem *addr)
75 #define __raw_readl __raw_readl
78 * writeb - write a byte to a memory location
79 * @data: data to write to
80 * @addr: pointer to memory
83 static inline void __raw_writeb(u8 data, volatile void __iomem *addr)
88 : "r" (addr), "r" (data)
92 #define __raw_writeb __raw_writeb
94 static inline void __raw_writew(u16 data, volatile void __iomem *addr)
99 : "r" (addr), "r" (data)
104 #define __raw_writew __raw_writew
106 static inline void __raw_writel(u32 data, volatile void __iomem *addr)
111 : "r" (addr), "r" (data)
115 #define __raw_writel __raw_writel
118 * I/O memory mapping functions.
120 #define _PAGE_IOREMAP (_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | \
121 (__HEXAGON_C_DEV << 6))
124 * These defines are necessary to use the generic io.h for filling in
125 * the missing parts of the API contract. This is because the platform
126 * uses (inline) functions rather than defines and the generic helper
127 * fills in the undefined.
129 #define virt_to_phys virt_to_phys
130 #define phys_to_virt phys_to_virt
131 #include <asm-generic/io.h>