Skip to content

Commit 455a503

Browse files
mbizonfreeboxralfbaechle
authored andcommitted
MIPS: BCM63XX: Hook up plat_ioremap to intercept soc registers remapping.
Internal SOC registers can be directly accessed, no need to waste a TLB entry. Signed-off-by: Maxime Bizon <mbizon@freebox.fr> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/2890/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
1 parent 5611cc4 commit 455a503

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#ifndef BCM63XX_IOREMAP_H_
2+
#define BCM63XX_IOREMAP_H_
3+
4+
#include <bcm63xx_cpu.h>
5+
6+
static inline phys_t fixup_bigphys_addr(phys_t phys_addr, phys_t size)
7+
{
8+
return phys_addr;
9+
}
10+
11+
static inline int is_bcm63xx_internal_registers(phys_t offset)
12+
{
13+
switch (bcm63xx_get_cpu_id()) {
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+
}
22+
return 0;
23+
}
24+
25+
static inline void __iomem *plat_ioremap(phys_t offset, unsigned long size,
26+
unsigned long flags)
27+
{
28+
if (is_bcm63xx_internal_registers(offset))
29+
return (void __iomem *)offset;
30+
return NULL;
31+
}
32+
33+
static inline int plat_iounmap(const volatile void __iomem *addr)
34+
{
35+
return is_bcm63xx_internal_registers((unsigned long)addr);
36+
}
37+
38+
#endif /* BCM63XX_IOREMAP_H_ */

0 commit comments

Comments
 (0)