18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef __ASM_MACH_BMIPS_IOREMAP_H
38c2ecf20Sopenharmony_ci#define __ASM_MACH_BMIPS_IOREMAP_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <linux/types.h>
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_cistatic inline int is_bmips_internal_registers(phys_addr_t offset)
88c2ecf20Sopenharmony_ci{
98c2ecf20Sopenharmony_ci	if (offset >= 0xfff80000)
108c2ecf20Sopenharmony_ci		return 1;
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci	return 0;
138c2ecf20Sopenharmony_ci}
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_cistatic inline void __iomem *plat_ioremap(phys_addr_t offset, unsigned long size,
168c2ecf20Sopenharmony_ci					 unsigned long flags)
178c2ecf20Sopenharmony_ci{
188c2ecf20Sopenharmony_ci	if (is_bmips_internal_registers(offset))
198c2ecf20Sopenharmony_ci		return (void __iomem *)offset;
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci	return NULL;
228c2ecf20Sopenharmony_ci}
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_cistatic inline int plat_iounmap(const volatile void __iomem *addr)
258c2ecf20Sopenharmony_ci{
268c2ecf20Sopenharmony_ci	return is_bmips_internal_registers((unsigned long)addr);
278c2ecf20Sopenharmony_ci}
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci#endif /* __ASM_MACH_BMIPS_IOREMAP_H */
30