[53dd6d61] | 1 | /* |
---|
[bcef89f2] | 2 | * Copyright (c) 2013 embedded brains GmbH & Co. KG |
---|
[53dd6d61] | 3 | * |
---|
| 4 | * Copyright (c) 2014 Chris Johns. All rights reserved. |
---|
| 5 | * |
---|
| 6 | * The license and distribution terms for this file may be |
---|
| 7 | * found in the file LICENSE in this distribution or at |
---|
| 8 | * http://www.rtems.org/license/LICENSE. |
---|
| 9 | */ |
---|
| 10 | |
---|
| 11 | #include <bsp.h> |
---|
| 12 | #include <bsp/start.h> |
---|
| 13 | #include <bsp/arm-cp15-start.h> |
---|
| 14 | |
---|
| 15 | #define ARM_SECTIONS 4096 /* all sections needed to describe the |
---|
| 16 | virtual address space */ |
---|
| 17 | #define ARM_SECTION_SIZE (1024 * 1024) /* how much virtual memory is described |
---|
| 18 | by one section */ |
---|
| 19 | |
---|
| 20 | //static uint32_t pagetable[ARM_SECTIONS] __attribute__((aligned (1024*16))); |
---|
| 21 | |
---|
| 22 | BSP_START_DATA_SECTION static const arm_cp15_start_section_config |
---|
| 23 | beagle_mmu_config_table[] = { |
---|
| 24 | ARMV7_CP15_START_DEFAULT_SECTIONS, |
---|
| 25 | { |
---|
| 26 | .begin = 0x40000000U, |
---|
| 27 | .end = 0x4FFFFFFFU, |
---|
| 28 | .flags = ARMV7_MMU_DEVICE |
---|
| 29 | } |
---|
| 30 | }; |
---|
| 31 | |
---|
| 32 | /* |
---|
| 33 | * Make weak and let the user override. |
---|
| 34 | */ |
---|
| 35 | BSP_START_TEXT_SECTION void beagle_setup_mmu_and_cache(void) __attribute__ ((weak)); |
---|
| 36 | |
---|
| 37 | BSP_START_TEXT_SECTION void beagle_setup_mmu_and_cache(void) |
---|
| 38 | { |
---|
| 39 | /* turn mmu off first in case it's on */ |
---|
| 40 | uint32_t ctrl = arm_cp15_start_setup_mmu_and_cache( |
---|
| 41 | ARM_CP15_CTRL_M | ARM_CP15_CTRL_A, /* clear - mmu off */ |
---|
| 42 | ARM_CP15_CTRL_AFE | ARM_CP15_CTRL_Z |
---|
| 43 | ); |
---|
| 44 | |
---|
| 45 | arm_cp15_start_setup_translation_table_and_enable_mmu_and_cache( |
---|
| 46 | ctrl, |
---|
| 47 | (uint32_t *) bsp_translation_table_base, |
---|
| 48 | ARM_MMU_DEFAULT_CLIENT_DOMAIN, |
---|
| 49 | &beagle_mmu_config_table[0], |
---|
| 50 | RTEMS_ARRAY_SIZE(beagle_mmu_config_table) |
---|
| 51 | ); |
---|
| 52 | } |
---|