xref: /openbmc/linux/arch/mips/include/asm/mach-tx49xx/ioremap.h (revision 4b4193256c8d3bc3a5397b5cd9494c2ad386317d)
1*2874c5fdSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
2384740dcSRalf Baechle /*
3384740dcSRalf Baechle  *	include/asm-mips/mach-tx49xx/ioremap.h
4384740dcSRalf Baechle  */
5384740dcSRalf Baechle #ifndef __ASM_MACH_TX49XX_IOREMAP_H
6384740dcSRalf Baechle #define __ASM_MACH_TX49XX_IOREMAP_H
7384740dcSRalf Baechle 
8384740dcSRalf Baechle #include <linux/types.h>
9384740dcSRalf Baechle 
plat_ioremap(phys_addr_t offset,unsigned long size,unsigned long flags)1015d45cceSRalf Baechle static inline void __iomem *plat_ioremap(phys_addr_t offset, unsigned long size,
11384740dcSRalf Baechle 	unsigned long flags)
12384740dcSRalf Baechle {
13384740dcSRalf Baechle #ifdef CONFIG_64BIT
14384740dcSRalf Baechle #define TXX9_DIRECTMAP_BASE	0xfff000000ul
15384740dcSRalf Baechle #else
16384740dcSRalf Baechle #define TXX9_DIRECTMAP_BASE	0xff000000ul
17384740dcSRalf Baechle #endif
18384740dcSRalf Baechle 	if (offset >= TXX9_DIRECTMAP_BASE &&
19384740dcSRalf Baechle 	    offset < TXX9_DIRECTMAP_BASE + 0x400000)
20384740dcSRalf Baechle 		return (void __iomem *)(unsigned long)(int)offset;
21384740dcSRalf Baechle 	return NULL;
22384740dcSRalf Baechle }
23384740dcSRalf Baechle 
plat_iounmap(const volatile void __iomem * addr)24384740dcSRalf Baechle static inline int plat_iounmap(const volatile void __iomem *addr)
25384740dcSRalf Baechle {
26384740dcSRalf Baechle 	return (unsigned long)addr >=
27384740dcSRalf Baechle 		(unsigned long)(int)(TXX9_DIRECTMAP_BASE & 0xffffffff);
28384740dcSRalf Baechle }
29384740dcSRalf Baechle 
30384740dcSRalf Baechle #endif /* __ASM_MACH_TX49XX_IOREMAP_H */
31