source: rtems/c/src/lib/libbsp/arm/raspberrypi/startup/bspstarthooks.c @ 6b5df95

5
Last change on this file since 6b5df95 was 6b5df95, checked in by YANG Qiao <yangqiao0505@…>, on 08/12/15 at 22:06:49

arm/raspberrypi: add fbcons support for rpi bsp

  • Property mode set to 100644
File size: 2.0 KB
RevLine 
[c32b1ef]1/**
2 * @file
3 *
[98eb7e78]4 * @ingroup arm_start
[c32b1ef]5 *
[98eb7e78]6 * @brief Rasberry Pi startup code.
[c32b1ef]7 */
8
9/*
[5ceefe1]10 * Copyright (c) 2013. Hesham AL-Matary
[c32b1ef]11 * Copyright (c) 2013 by Alan Cudmore
12 * based on work by:
13 * Copyright (c) 2009
14 * embedded brains GmbH
15 * Obere Lagerstr. 30
16 * D-82178 Puchheim
17 * Germany
18 * <rtems@embedded-brains.de>
19 *
20 * The license and distribution terms for this file may be
21 * found in the file LICENSE in this distribution or at
[c499856]22 * http://www.rtems.org/license/LICENSE
[c32b1ef]23 */
24
25#include <bspopts.h>
26#include <bsp/start.h>
27#include <bsp/raspberrypi.h>
[5ceefe1]28#include <bsp/mm.h>
[e706a9d]29#include <libcpu/arm-cp15.h>
[6b5df95]30#include <bsp.h>
31
[c32b1ef]32
33void BSP_START_TEXT_SECTION bsp_start_hook_0(void)
34{
[e706a9d]35  uint32_t sctlr_val;
36
37  sctlr_val = arm_cp15_get_control();
38
39  /*
40   * Current U-boot loader seems to start kernel image
41   * with I and D caches on and MMU enabled.
42   * If RTEMS application image finds that cache is on
43   * during startup then disable caches.
44   */
45  if (sctlr_val & (ARM_CP15_CTRL_I | ARM_CP15_CTRL_C | ARM_CP15_CTRL_M)) {
46    if (sctlr_val & (ARM_CP15_CTRL_C | ARM_CP15_CTRL_M)) {
47      /*
48       * If the data cache is on then ensure that it is clean
49       * before switching off to be extra carefull.
50       */
51      arm_cp15_drain_write_buffer();
52      arm_cp15_data_cache_clean_and_invalidate();
53    }
54    arm_cp15_flush_prefetch_buffer();
55    sctlr_val &= ~(ARM_CP15_CTRL_I | ARM_CP15_CTRL_C | ARM_CP15_CTRL_M | ARM_CP15_CTRL_A);
56    arm_cp15_set_control(sctlr_val);
[c32b1ef]57
[e706a9d]58    arm_cp15_tlb_invalidate();
59    arm_cp15_flush_prefetch_buffer();
60    arm_cp15_data_cache_invalidate();
61    arm_cp15_instruction_cache_invalidate();
62  }
63
64  /* Clear Translation Table Base Control Register */
65  arm_cp15_set_translation_table_base_control_register(0);
66
67  /* Clear Secure or Non-secure Vector Base Address Register */
68  arm_cp15_set_vector_base_address(0);
69}
[c32b1ef]70
71void BSP_START_TEXT_SECTION bsp_start_hook_1(void)
72{
[f2e9d0d]73  bsp_start_copy_sections();
[5ceefe1]74  bsp_memory_management_initialize();
[f2e9d0d]75  bsp_start_clear_bss();
[6b5df95]76
77  rpi_video_init();
[c32b1ef]78}
Note: See TracBrowser for help on using the repository browser.