ath25: switch default kernel to 5.15
[openwrt/openwrt.git] / target / linux / realtek / files-5.10 / 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 int is_rtl838x_internal_registers(phys_addr_t offset)
6 {
7 /* IO-Block */
8 if (offset >= 0xb8000000 && offset < 0xb9000000)
9 return 1;
10 /* Switch block */
11 if (offset >= 0xbb000000 && offset < 0xbc000000)
12 return 1;
13 return 0;
14 }
15
16 static inline void __iomem *plat_ioremap(phys_addr_t offset, unsigned long size,
17 unsigned long flags)
18 {
19 if (is_rtl838x_internal_registers(offset))
20 return (void __iomem *)offset;
21 return NULL;
22 }
23
24 static inline int plat_iounmap(const volatile void __iomem *addr)
25 {
26 return is_rtl838x_internal_registers((unsigned long)addr);
27 }
28
29 #endif