aboutsummaryrefslogtreecommitdiff
path: root/arch/arm/mach-uniphier/sg-regs.h
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2019-07-10 20:07:42 +0900
committerMasahiro Yamada <yamada.masahiro@socionext.com>2019-07-10 22:42:03 +0900
commit34ded875067306961a684186cf23227b58802b28 (patch)
tree401ab1652c9f5a4df1ffe5756345d923110e720c /arch/arm/mach-uniphier/sg-regs.h
parent739ba41d5a0964a9bc0d5705055ddb706d7e070d (diff)
downloadu-boot-34ded875067306961a684186cf23227b58802b28.zip
u-boot-34ded875067306961a684186cf23227b58802b28.tar.gz
u-boot-34ded875067306961a684186cf23227b58802b28.tar.bz2
ARM: uniphier: detect register base addresses run-time
Until the last SoC, the register addresses have been hard-coded because they are always constant. For a planned new SoC, the register bases will be completely changed. I insist on supporting multiple SoCs/boards by a single defconfig (uniphier_v8_defconfig) since duplicating similar defconfig files is a maintenance burden. The base addresses must be fixed-up at run-time somehow. Previously, the board init code identified the SoC by reading out the SG_REVISION register. This is much easier than parsing DT. You cannot do it any more because the base address of SG will be changed. The SG_REVISION register exists to read out the SoC ID, but you never know its address before identifying the SoC. Oh well. So, the possible solution is to parse the DT, and find out the node with "*-soc-glue" compatible string. Then, sg_base is set to the value of the "reg" property. The sc_base is set up likewise. It is worth noting a pit-fall. Having sc_base and sg_base in the global scope will make the life easier, but the global variables are poorly supported before the relocation. In fact, the .bss section overwraps with DT. Allocating them in the .bss section would break DT. So, I gave dummy initializers to assign them in the .data section. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'arch/arm/mach-uniphier/sg-regs.h')
-rw-r--r--arch/arm/mach-uniphier/sg-regs.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/arm/mach-uniphier/sg-regs.h b/arch/arm/mach-uniphier/sg-regs.h
index cba02d1..f47d101 100644
--- a/arch/arm/mach-uniphier/sg-regs.h
+++ b/arch/arm/mach-uniphier/sg-regs.h
@@ -12,8 +12,12 @@
#ifndef __ASSEMBLY__
#include <linux/compiler.h>
+#ifdef CONFIG_ARCH_UNIPHIER_V8_MULTI
+extern void __iomem *sg_base;
+#else
#define sg_base ((void __iomem *)SG_BASE)
#endif
+#endif /* __ASSEMBLY__ */
/* Base Address */
#define SG_BASE 0x5f800000