xref: /OK3568_Linux_fs/u-boot/arch/mips/mach-bmips/include/ioremap.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * SPDX-License-Identifier:	GPL-2.0
3*4882a593Smuzhiyun  */
4*4882a593Smuzhiyun #ifndef __ASM_MACH_BMIPS_IOREMAP_H
5*4882a593Smuzhiyun #define __ASM_MACH_BMIPS_IOREMAP_H
6*4882a593Smuzhiyun 
7*4882a593Smuzhiyun #include <linux/types.h>
8*4882a593Smuzhiyun 
9*4882a593Smuzhiyun /*
10*4882a593Smuzhiyun  * Allow physical addresses to be fixed up to help peripherals located
11*4882a593Smuzhiyun  * outside the low 32-bit range -- generic pass-through version.
12*4882a593Smuzhiyun  */
fixup_bigphys_addr(phys_addr_t phys_addr,phys_addr_t size)13*4882a593Smuzhiyun static inline phys_addr_t fixup_bigphys_addr(phys_addr_t phys_addr,
14*4882a593Smuzhiyun 						phys_addr_t size)
15*4882a593Smuzhiyun {
16*4882a593Smuzhiyun 	return phys_addr;
17*4882a593Smuzhiyun }
18*4882a593Smuzhiyun 
is_bmips_internal_registers(phys_addr_t offset)19*4882a593Smuzhiyun static inline int is_bmips_internal_registers(phys_addr_t offset)
20*4882a593Smuzhiyun {
21*4882a593Smuzhiyun #if defined(CONFIG_SOC_BMIPS_BCM6338) || \
22*4882a593Smuzhiyun 	defined(CONFIG_SOC_BMIPS_BCM6348) || \
23*4882a593Smuzhiyun 	defined(CONFIG_SOC_BMIPS_BCM6358)
24*4882a593Smuzhiyun 	if (offset >= 0xfffe0000)
25*4882a593Smuzhiyun 		return 1;
26*4882a593Smuzhiyun #endif
27*4882a593Smuzhiyun 
28*4882a593Smuzhiyun 	return 0;
29*4882a593Smuzhiyun }
30*4882a593Smuzhiyun 
plat_ioremap(phys_addr_t offset,unsigned long size,unsigned long flags)31*4882a593Smuzhiyun static inline void __iomem *plat_ioremap(phys_addr_t offset, unsigned long size,
32*4882a593Smuzhiyun 						unsigned long flags)
33*4882a593Smuzhiyun {
34*4882a593Smuzhiyun 	if (is_bmips_internal_registers(offset))
35*4882a593Smuzhiyun 		return (void __iomem *)offset;
36*4882a593Smuzhiyun 
37*4882a593Smuzhiyun 	return NULL;
38*4882a593Smuzhiyun }
39*4882a593Smuzhiyun 
plat_iounmap(const volatile void __iomem * addr)40*4882a593Smuzhiyun static inline int plat_iounmap(const volatile void __iomem *addr)
41*4882a593Smuzhiyun {
42*4882a593Smuzhiyun 	return is_bmips_internal_registers((unsigned long)addr);
43*4882a593Smuzhiyun }
44*4882a593Smuzhiyun 
45*4882a593Smuzhiyun #define _page_cachable_default	_CACHE_CACHABLE_NONCOHERENT
46*4882a593Smuzhiyun 
47*4882a593Smuzhiyun #endif /* __ASM_MACH_BMIPS_IOREMAP_H */
48