[PATCH] GSoC: Cache configurations Raspberry Pi 2 support

Rohini Kulkarni krohini1593 at gmail.com
Mon Jun 22 20:59:50 UTC 2015


---
 .../arm/raspberrypi/startup/mm_config_table.c      |   18 +++++++--------
 c/src/lib/libbsp/arm/shared/mminit.c               |   23
++++++++++++++++++++
 2 files changed, 32 insertions(+), 9 deletions(-)

diff --git a/c/src/lib/libbsp/arm/raspberrypi/startup/mm_config_table.c
b/c/src/lib/libbsp/arm/raspberrypi/startup/mm_config_table.c
index 8a6d37a..dd1941e 100644
--- a/c/src/lib/libbsp/arm/raspberrypi/startup/mm_config_table.c
+++ b/c/src/lib/libbsp/arm/raspberrypi/startup/mm_config_table.c
@@ -31,39 +31,39 @@ const arm_cp15_start_section_config
arm_cp15_start_mmu_config_table[] = {
   }, {
     .begin = (uint32_t) bsp_section_fast_data_begin,
     .end = (uint32_t) bsp_section_fast_data_end,
-    .flags = ARMV7_MMU_DATA_READ_WRITE_CACHED
+    .flags = ARMV7_MMU_DATA_READ_WRITE_CACHED
   }, {
     .begin = (uint32_t) bsp_section_start_begin,
     .end = (uint32_t) bsp_section_start_end,
-    .flags = ARMV7_MMU_CODE_CACHED
+    .flags = ARMV7_MMU_CODE_CACHED
   }, {
     .begin = (uint32_t) bsp_section_vector_begin,
     .end = (uint32_t) bsp_section_vector_end,
-    .flags = ARMV7_MMU_DATA_READ_WRITE_CACHED
+    .flags = ARMV7_MMU_DATA_READ_WRITE_CACHED
   }, {
     .begin = (uint32_t) bsp_section_text_begin,
     .end = (uint32_t) bsp_section_text_end,
-    .flags = ARMV7_MMU_READ_WRITE
+    .flags = ARMV7_MMU_READ_WRITE | ARM_MMU_SECT_C | ARM_MMU_SECT_B
   }, {
     .begin = (uint32_t) bsp_section_rodata_begin,
     .end = (uint32_t) bsp_section_rodata_end,
-    .flags = ARMV7_MMU_DATA_READ_ONLY_CACHED
+    .flags = ARMV7_MMU_DATA_READ_ONLY_CACHED
   }, {
     .begin = (uint32_t) bsp_section_data_begin,
     .end = (uint32_t) bsp_section_data_end,
-    .flags = ARMV7_MMU_DATA_READ_WRITE_CACHED
+    .flags = ARMV7_MMU_DATA_READ_WRITE_CACHED
   }, {
     .begin = (uint32_t) bsp_section_bss_begin,
     .end = (uint32_t) bsp_section_bss_end,
-    .flags = ARMV7_MMU_DATA_READ_WRITE_CACHED
+    .flags = ARMV7_MMU_DATA_READ_WRITE_CACHED
   }, {
     .begin = (uint32_t) bsp_section_work_begin,
     .end = (uint32_t) bsp_section_work_end,
-    .flags = ARMV7_MMU_DATA_READ_WRITE_CACHED
+    .flags = ARMV7_MMU_DATA_READ_WRITE_CACHED
   }, {
     .begin = (uint32_t) bsp_section_stack_begin,
     .end = (uint32_t) bsp_section_stack_end,
-    .flags = ARMV7_MMU_DATA_READ_WRITE_CACHED
+    .flags = ARMV7_MMU_DATA_READ_WRITE_CACHED
   }, {
     .begin = RPI_PERIPHERAL_BASE,
     .end =   RPI_PERIPHERAL_BASE + RPI_PERIPHERAL_SIZE,
diff --git a/c/src/lib/libbsp/arm/shared/mminit.c
b/c/src/lib/libbsp/arm/shared/mminit.c
index acfbfc0..96ca1ec 100644
--- a/c/src/lib/libbsp/arm/shared/mminit.c
+++ b/c/src/lib/libbsp/arm/shared/mminit.c
@@ -13,6 +13,28 @@
 #include <bsp/linker-symbols.h>
 #include <bsp/mm.h>

+#if (BSP_IS_RPI2 == 1)
+BSP_START_TEXT_SECTION void bsp_memory_management_initialize(void)
+{
+  /* Enable SMP in auxiliary control */
+  uint32_t actlr = arm_cp15_get_auxiliary_control();
+  actlr |= ARM_CORTEX_A9_ACTL_SMP;
+  arm_cp15_set_auxiliary_control(actlr);
+
+  uint32_t ctrl = arm_cp15_start_setup_mmu_and_cache(
+    ARM_CP15_CTRL_A,
+    ARM_CP15_CTRL_AFE| ARM_CP15_CTRL_Z
+  );
+
+  arm_cp15_start_setup_translation_table_and_enable_mmu_and_cache(
+    ctrl,
+    (uint32_t *) bsp_translation_table_base,
+    ARM_MMU_DEFAULT_CLIENT_DOMAIN,
+    &arm_cp15_start_mmu_config_table[0],
+    arm_cp15_start_mmu_config_table_size
+  );
+}
+#else
 BSP_START_TEXT_SECTION void bsp_memory_management_initialize(void)
 {
   uint32_t ctrl = arm_cp15_get_control();
@@ -27,3 +49,4 @@ BSP_START_TEXT_SECTION void
bsp_memory_management_initialize(void)
     arm_cp15_start_mmu_config_table_size
   );
 }
+#endif
\ No newline at end of file
-- 
1.7.9.5

-- 
Rohini Kulkarni
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20150623/b0db404d/attachment.html>


More information about the devel mailing list