ioremap.h (956B)
1/* SPDX-License-Identifier: GPL-2.0 */ 2#ifndef BCM63XX_IOREMAP_H_ 3#define BCM63XX_IOREMAP_H_ 4 5#include <bcm63xx_cpu.h> 6 7static inline int is_bcm63xx_internal_registers(phys_addr_t offset) 8{ 9 switch (bcm63xx_get_cpu_id()) { 10 case BCM3368_CPU_ID: 11 if (offset >= 0xfff80000) 12 return 1; 13 break; 14 case BCM6338_CPU_ID: 15 case BCM6345_CPU_ID: 16 case BCM6348_CPU_ID: 17 case BCM6358_CPU_ID: 18 if (offset >= 0xfff00000) 19 return 1; 20 break; 21 case BCM6328_CPU_ID: 22 case BCM6362_CPU_ID: 23 case BCM6368_CPU_ID: 24 if (offset >= 0xb0000000 && offset < 0xb1000000) 25 return 1; 26 break; 27 } 28 return 0; 29} 30 31static inline void __iomem *plat_ioremap(phys_addr_t offset, unsigned long size, 32 unsigned long flags) 33{ 34 if (is_bcm63xx_internal_registers(offset)) 35 return (void __iomem *)offset; 36 return NULL; 37} 38 39static inline int plat_iounmap(const volatile void __iomem *addr) 40{ 41 return is_bcm63xx_internal_registers((unsigned long)addr); 42} 43 44#endif /* BCM63XX_IOREMAP_H_ */