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