mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-08-20 14:01:09 +02:00
The Amlogic Meson S905 is a SoC with a quad core Arm Cortex-A53 running at 1.5Ghz. It also contains a Cortex-M3 used as SCP. This port is a minimal implementation of BL31 capable of booting mainline U-Boot and Linux: - Partial SCPI support. - Basic PSCI support (CPU_ON, SYSTEM_RESET, SYSTEM_OFF). - GICv2 driver set up. - Basic SIP services (read efuse data, enable/disable JTAG). This port has been tested in an ODROID-C2. Change-Id: Ia4bc82d7aca42a69d6b118b947279f82b3f6c6da Tested-by: Amit Singh Tomar <amittomer25@gmail.com> Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
144 lines
3.9 KiB
C
144 lines
3.9 KiB
C
/*
|
|
* Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
#include <assert.h>
|
|
#include <bl_common.h>
|
|
#include <debug.h>
|
|
#include <ep_info.h>
|
|
#include <interrupt_mgmt.h>
|
|
#include <meson_console.h>
|
|
#include <mmio.h>
|
|
#include <platform_def.h>
|
|
#include <stdint.h>
|
|
#include <xlat_tables_v2.h>
|
|
|
|
/*******************************************************************************
|
|
* Platform memory map regions
|
|
******************************************************************************/
|
|
#define MAP_NSDRAM0 MAP_REGION_FLAT(GXBB_NSDRAM0_BASE, \
|
|
GXBB_NSDRAM0_SIZE, \
|
|
MT_MEMORY | MT_RW | MT_NS)
|
|
|
|
#define MAP_NSDRAM1 MAP_REGION_FLAT(GXBB_NSDRAM1_BASE, \
|
|
GXBB_NSDRAM1_SIZE, \
|
|
MT_MEMORY | MT_RW | MT_NS)
|
|
|
|
#define MAP_SEC_DEVICE0 MAP_REGION_FLAT(GXBB_SEC_DEVICE0_BASE, \
|
|
GXBB_SEC_DEVICE0_SIZE, \
|
|
MT_DEVICE | MT_RW | MT_SECURE)
|
|
|
|
#define MAP_SEC_DEVICE1 MAP_REGION_FLAT(GXBB_SEC_DEVICE1_BASE, \
|
|
GXBB_SEC_DEVICE1_SIZE, \
|
|
MT_DEVICE | MT_RW | MT_SECURE)
|
|
|
|
#define MAP_TZRAM MAP_REGION_FLAT(GXBB_TZRAM_BASE, \
|
|
GXBB_TZRAM_SIZE, \
|
|
MT_DEVICE | MT_RW | MT_SECURE)
|
|
|
|
#define MAP_SEC_DEVICE2 MAP_REGION_FLAT(GXBB_SEC_DEVICE2_BASE, \
|
|
GXBB_SEC_DEVICE2_SIZE, \
|
|
MT_DEVICE | MT_RW | MT_SECURE)
|
|
|
|
#define MAP_SEC_DEVICE3 MAP_REGION_FLAT(GXBB_SEC_DEVICE3_BASE, \
|
|
GXBB_SEC_DEVICE3_SIZE, \
|
|
MT_DEVICE | MT_RW | MT_SECURE)
|
|
|
|
static const mmap_region_t gxbb_mmap[] = {
|
|
MAP_NSDRAM0,
|
|
MAP_NSDRAM1,
|
|
MAP_SEC_DEVICE0,
|
|
MAP_SEC_DEVICE1,
|
|
MAP_TZRAM,
|
|
MAP_SEC_DEVICE2,
|
|
MAP_SEC_DEVICE3,
|
|
{0}
|
|
};
|
|
|
|
/*******************************************************************************
|
|
* Per-image regions
|
|
******************************************************************************/
|
|
#define MAP_BL31 MAP_REGION_FLAT(BL31_BASE, \
|
|
BL31_END - BL31_BASE, \
|
|
MT_MEMORY | MT_RW | MT_SECURE)
|
|
|
|
#define MAP_BL_CODE MAP_REGION_FLAT(BL_CODE_BASE, \
|
|
BL_CODE_END - BL_CODE_BASE, \
|
|
MT_CODE | MT_SECURE)
|
|
|
|
#define MAP_BL_RO_DATA MAP_REGION_FLAT(BL_RO_DATA_BASE, \
|
|
BL_RO_DATA_END - BL_RO_DATA_BASE, \
|
|
MT_RO_DATA | MT_SECURE)
|
|
|
|
#define MAP_BL_COHERENT MAP_REGION_FLAT(BL_COHERENT_RAM_BASE, \
|
|
BL_COHERENT_RAM_END - BL_COHERENT_RAM_BASE, \
|
|
MT_DEVICE | MT_RW | MT_SECURE)
|
|
|
|
/*******************************************************************************
|
|
* Function that sets up the translation tables.
|
|
******************************************************************************/
|
|
void gxbb_setup_page_tables(void)
|
|
{
|
|
#if IMAGE_BL31
|
|
const mmap_region_t gxbb_bl_mmap[] = {
|
|
MAP_BL31,
|
|
MAP_BL_CODE,
|
|
MAP_BL_RO_DATA,
|
|
#if USE_COHERENT_MEM
|
|
MAP_BL_COHERENT,
|
|
#endif
|
|
{0}
|
|
};
|
|
#endif
|
|
|
|
mmap_add(gxbb_bl_mmap);
|
|
|
|
mmap_add(gxbb_mmap);
|
|
|
|
init_xlat_tables();
|
|
}
|
|
|
|
/*******************************************************************************
|
|
* Function that sets up the console
|
|
******************************************************************************/
|
|
static console_meson_t gxbb_console;
|
|
|
|
void gxbb_console_init(void)
|
|
{
|
|
int rc = console_meson_register(GXBB_UART0_AO_BASE,
|
|
GXBB_UART0_AO_CLK_IN_HZ,
|
|
GXBB_UART_BAUDRATE,
|
|
&gxbb_console);
|
|
if (rc == 0) {
|
|
/*
|
|
* The crash console doesn't use the multi console API, it uses
|
|
* the core console functions directly. It is safe to call panic
|
|
* and let it print debug information.
|
|
*/
|
|
panic();
|
|
}
|
|
|
|
console_set_scope(&gxbb_console.console,
|
|
CONSOLE_FLAG_BOOT | CONSOLE_FLAG_RUNTIME);
|
|
}
|
|
|
|
/*******************************************************************************
|
|
* Function that returns the system counter frequency
|
|
******************************************************************************/
|
|
unsigned int plat_get_syscnt_freq2(void)
|
|
{
|
|
uint32_t val;
|
|
|
|
val = mmio_read_32(GXBB_SYS_CPU_CFG7);
|
|
val &= 0xFDFFFFFF;
|
|
mmio_write_32(GXBB_SYS_CPU_CFG7, val);
|
|
|
|
val = mmio_read_32(GXBB_AO_TIMESTAMP_CNTL);
|
|
val &= 0xFFFFFE00;
|
|
mmio_write_32(GXBB_AO_TIMESTAMP_CNTL, val);
|
|
|
|
return GXBB_OSC24M_CLK_IN_HZ;
|
|
}
|