diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2013-01-26 00:26:03 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2013-02-04 15:52:41 +0100 |
commit | b7bcba8b65e36eb2f3a29a2f540e1ac30fbeff3d (patch) | |
tree | 9adf2c9040651783c60966a7745768e71ced61a8 /arch/arm/cpu | |
parent | 93ef44fc4e15ee621ef0882c80752590af89188d (diff) | |
download | barebox-b7bcba8b65e36eb2f3a29a2f540e1ac30fbeff3d.tar.gz barebox-b7bcba8b65e36eb2f3a29a2f540e1ac30fbeff3d.tar.xz |
ARM: Enable mmu early
This optionally enabled the MMU in the PBL or during early startup for
the non PBL case. The regular MMU init code will pickup the already enabled
MMU later. This might complicate debugging early code, so this has been
made optional.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/cpu')
-rw-r--r-- | arch/arm/cpu/start-pbl.c | 8 | ||||
-rw-r--r-- | arch/arm/cpu/start.c | 12 |
2 files changed, 19 insertions, 1 deletions
diff --git a/arch/arm/cpu/start-pbl.c b/arch/arm/cpu/start-pbl.c index 0599c57e75..a825e9f090 100644 --- a/arch/arm/cpu/start-pbl.c +++ b/arch/arm/cpu/start-pbl.c @@ -32,7 +32,7 @@ #include <asm/pgtable.h> #include <asm/cache.h> -#include "mmu.h" +#include "mmu-early.h" unsigned long free_mem_ptr; unsigned long free_mem_end_ptr; @@ -83,6 +83,12 @@ static noinline __noreturn void __barebox_arm_entry(uint32_t membase, setup_c(); + if (IS_ENABLED(CONFIG_MMU_EARLY)) { + endmem &= ~0x3fff; + endmem -= SZ_16K; /* ttb */ + mmu_early_enable(membase, memsize, endmem); + } + endmem -= SZ_128K; /* early malloc */ free_mem_ptr = endmem; free_mem_end_ptr = free_mem_ptr + SZ_128K; diff --git a/arch/arm/cpu/start.c b/arch/arm/cpu/start.c index a621161884..d90b244a8a 100644 --- a/arch/arm/cpu/start.c +++ b/arch/arm/cpu/start.c @@ -19,6 +19,7 @@ #include <common.h> #include <init.h> +#include <sizes.h> #include <asm/barebox-arm.h> #include <asm/barebox-arm-head.h> #include <asm-generic/memory_layout.h> @@ -26,6 +27,8 @@ #include <asm/cache.h> #include <memory.h> +#include "mmu-early.h" + unsigned long arm_stack_top; static noinline __noreturn void __start(uint32_t membase, uint32_t memsize, @@ -38,6 +41,15 @@ static noinline __noreturn void __start(uint32_t membase, uint32_t memsize, arm_stack_top = endmem; endmem -= STACK_SIZE; /* Stack */ + if (IS_ENABLED(CONFIG_MMU_EARLY)) { + + endmem &= ~0x3fff; + endmem -= SZ_16K; /* ttb */ + + if (!IS_ENABLED(CONFIG_PBL_IMAGE)) + mmu_early_enable(membase, memsize, endmem); + } + start_barebox(); } |