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