Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef BCM63XX_IOREMAP_H_
0003 #define BCM63XX_IOREMAP_H_
0004 
0005 #include <bcm63xx_cpu.h>
0006 
0007 static inline int is_bcm63xx_internal_registers(phys_addr_t offset)
0008 {
0009     switch (bcm63xx_get_cpu_id()) {
0010     case BCM3368_CPU_ID:
0011         if (offset >= 0xfff80000)
0012             return 1;
0013         break;
0014     case BCM6338_CPU_ID:
0015     case BCM6345_CPU_ID:
0016     case BCM6348_CPU_ID:
0017     case BCM6358_CPU_ID:
0018         if (offset >= 0xfff00000)
0019             return 1;
0020         break;
0021     case BCM6328_CPU_ID:
0022     case BCM6362_CPU_ID:
0023     case BCM6368_CPU_ID:
0024         if (offset >= 0xb0000000 && offset < 0xb1000000)
0025             return 1;
0026         break;
0027     }
0028     return 0;
0029 }
0030 
0031 static inline void __iomem *plat_ioremap(phys_addr_t offset, unsigned long size,
0032                      unsigned long flags)
0033 {
0034     if (is_bcm63xx_internal_registers(offset))
0035         return (void __iomem *)offset;
0036     return NULL;
0037 }
0038 
0039 static inline int plat_iounmap(const volatile void __iomem *addr)
0040 {
0041     return is_bcm63xx_internal_registers((unsigned long)addr);
0042 }
0043 
0044 #endif /* BCM63XX_IOREMAP_H_ */