| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
#include <assert.h> |
| 9 |
|
| 10 |
|
| 11 |
#include <common/bl_common.h> |
| 12 |
#include <common/debug.h> |
| 13 |
#include <common/desc_image_load.h> |
| 14 |
#include <drivers/generic_delay_timer.h> |
| 15 |
#include <drivers/ti/uart/uart_16550.h> |
| 16 |
#include <lib/coreboot.h> |
| 17 |
|
| 18 |
|
| 19 |
#include <devapc/devapc.h> |
| 20 |
#include <emi_mpu/emi_mpu.h> |
| 21 |
#include <gpio/mtgpio.h> |
| 22 |
#include <mt_gic_v3.h> |
| 23 |
#include <mt_spm.h> |
| 24 |
#include <mt_timer.h> |
| 25 |
#include <mtk_dcm.h> |
| 26 |
#include <plat_params.h> |
| 27 |
#include <plat_private.h> |
| 28 |
|
| 29 |
static entry_point_info_t bl32_ep_info; |
| 30 |
static entry_point_info_t bl33_ep_info; |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
entry_point_info_t *bl31_plat_get_next_image_ep_info(uint32_t type) |
| 39 |
{ |
| 40 |
entry_point_info_t *next_image_info; |
| 41 |
|
| 42 |
next_image_info = (type == NON_SECURE) ? &bl33_ep_info : &bl32_ep_info; |
| 43 |
assert(next_image_info->h.type == PARAM_EP); |
| 44 |
|
| 45 |
|
| 46 |
if (next_image_info->pc) { |
| 47 |
return next_image_info; |
| 48 |
} else { |
| 49 |
return NULL; |
| 50 |
} |
| 51 |
} |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1, |
| 62 |
u_register_t arg2, u_register_t arg3) |
| 63 |
{ |
| 64 |
static console_t console; |
| 65 |
|
| 66 |
params_early_setup(arg1); |
| 67 |
|
| 68 |
#if COREBOOT |
| 69 |
if (coreboot_serial.type) { |
| 70 |
console_16550_register(coreboot_serial.baseaddr, |
| 71 |
coreboot_serial.input_hertz, |
| 72 |
coreboot_serial.baud, |
| 73 |
&console); |
| 74 |
} |
| 75 |
#else |
| 76 |
console_16550_register(UART0_BASE, UART_CLOCK, UART_BAUDRATE, &console); |
| 77 |
#endif |
| 78 |
|
| 79 |
NOTICE("MT8192 bl31_setup\n"); |
| 80 |
|
| 81 |
bl31_params_parse_helper(arg0, &bl32_ep_info, &bl33_ep_info); |
| 82 |
} |
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
void bl31_platform_setup(void) |
| 89 |
{ |
| 90 |
|
| 91 |
if (!dcm_set_default()) { |
| 92 |
ERROR("Failed to set default dcm on!!\n"); |
| 93 |
} |
| 94 |
|
| 95 |
|
| 96 |
emi_mpu_init(); |
| 97 |
|
| 98 |
|
| 99 |
devapc_init(); |
| 100 |
|
| 101 |
|
| 102 |
mt_gic_driver_init(); |
| 103 |
mt_gic_init(); |
| 104 |
|
| 105 |
mt_gpio_init(); |
| 106 |
mt_systimer_init(); |
| 107 |
generic_delay_timer_init(); |
| 108 |
spm_boot_init(); |
| 109 |
} |
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
void bl31_plat_arch_setup(void) |
| 116 |
{ |
| 117 |
plat_configure_mmu_el3(BL31_START, |
| 118 |
BL31_END - BL31_START, |
| 119 |
BL_CODE_BASE, |
| 120 |
BL_CODE_END); |
| 121 |
} |