summaryrefslogtreecommitdiff
path: root/arch/csky/kernel
diff options
context:
space:
mode:
authorGuo Ren <ren_guo@c-sky.com>2019-04-08 11:12:25 +0800
committerGuo Ren <ren_guo@c-sky.com>2019-04-22 13:44:57 +0800
commitf62e31623d718a7c20d9da98de48361624d7360a (patch)
tree686ee8d9ea793443c6ad184f36074c2e391c535c /arch/csky/kernel
parentbf241682936293291dcf40fd93cdd0f5e6222902 (diff)
csky: Support dynamic start physical address
Before this patch csky-linux need CONFIG_RAM_BASE to determine start physical address. Now we use phys_offset variable to replace the macro of PHYS_OFFSET and we setup phys_offset with real physical address which is determined during startup in head.S. With this patch we needn't re-compile kernel for different start physical address. ie: 0x0 / 0xc0000000 start physical address could use the same vmlinux, be care different start address must be 512MB aligned. Signed-off-by: Guo Ren <ren_guo@c-sky.com> Cc: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/csky/kernel')
-rw-r--r--arch/csky/kernel/entry.S6
-rw-r--r--arch/csky/kernel/setup.c5
2 files changed, 9 insertions, 2 deletions
diff --git a/arch/csky/kernel/entry.S b/arch/csky/kernel/entry.S
index c0f80736dac6..e5bbd8c184f3 100644
--- a/arch/csky/kernel/entry.S
+++ b/arch/csky/kernel/entry.S
@@ -40,7 +40,8 @@ ENTRY(csky_\name)
WR_MCIR a2
#endif
bclri r6, 0
- lrw a2, PHYS_OFFSET
+ lrw a2, phys_offset
+ ld.w a2, (a2, 0)
subu r6, a2
bseti r6, 31
@@ -50,7 +51,8 @@ ENTRY(csky_\name)
addu r6, a2
ldw r6, (r6)
- lrw a2, PHYS_OFFSET
+ lrw a2, phys_offset
+ ld.w a2, (a2, 0)
subu r6, a2
bseti r6, 31
diff --git a/arch/csky/kernel/setup.c b/arch/csky/kernel/setup.c
index dff8b89444ec..c377194e4b8f 100644
--- a/arch/csky/kernel/setup.c
+++ b/arch/csky/kernel/setup.c
@@ -142,11 +142,16 @@ void __init setup_arch(char **cmdline_p)
#endif
}
+unsigned long phys_offset;
+EXPORT_SYMBOL(phys_offset);
+
asmlinkage __visible void __init csky_start(unsigned int unused, void *param)
{
/* Clean up bss section */
memset(__bss_start, 0, __bss_stop - __bss_start);
+ phys_offset = read_mmu_msa0() & ~(SSEG_SIZE - 1);
+
pre_trap_init();
pre_mmu_init();