e7a5bfaffc9bb39b49082560dec7c36786aa3694
[openwrt/staging/jow.git] / target / linux / rtl838x / files-5.4 / arch / mips / include / asm / mach-rtl838x / ioremap.h
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #ifndef RTL838X_IOREMAP_H_
3 #define RTL838X_IOREMAP_H_
4
5 static inline phys_addr_t fixup_bigphys_addr(phys_addr_t phys_addr, phys_addr_t size)
6 {
7 return phys_addr;
8 }
9
10 static inline int is_rtl838x_internal_registers(phys_addr_t offset)
11 {
12 /* IO-Block */
13 if (offset >= 0xb8000000 && offset < 0xb9000000)
14 return 1;
15 /* Switch block */
16 if (offset >= 0xbb000000 && offset < 0xbc000000)
17 return 1;
18 return 0;
19 }
20
21 static inline void __iomem *plat_ioremap(phys_addr_t offset, unsigned long size,
22 unsigned long flags)
23 {
24 if (is_rtl838x_internal_registers(offset))
25 return (void __iomem *)offset;
26 return NULL;
27 }
28
29 static inline int plat_iounmap(const volatile void __iomem *addr)
30 {
31 return is_rtl838x_internal_registers((unsigned long)addr);
32 }
33
34 #endif