Commit 717448d6 authored by Sheetal Tigadoli's avatar Sheetal Tigadoli
Browse files

Add bl2 setup code common across Broadcom platforms

Signed-off-by: default avatarSheetal Tigadoli <sheetal.tigadoli@broadcom.com>
Change-Id: Iabeaee35c22608c93945c8295bf70947b0f6049a
Showing with 2102 additions and 0 deletions
+2102 -0
/*
* Copyright (c) 2018-2020, Broadcom
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef BCM_CONSOLE_H
#define BCM_CONSOLE_H
void bcm_console_boot_init(void);
void bcm_console_boot_end(void);
void bcm_console_runtime_init(void);
void bcm_console_runtime_end(void);
#endif /* BCM_CONSOLE_H */
/*
* Copyright (c) 2016 - 2020, Broadcom
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef BRCM_DEF_H
#define BRCM_DEF_H
#include <arch.h>
#include <common/tbbr/tbbr_img_def.h>
#include <lib/utils_def.h>
#include <lib/xlat_tables/xlat_tables.h>
#include <plat/common/common_def.h>
#include <platform_def.h>
#define PLAT_PHY_ADDR_SPACE_SIZE BIT_64(32)
#define PLAT_VIRT_ADDR_SPACE_SIZE BIT_64(32)
#define BL11_DAUTH_ID 0x796C51ab
#define BL11_DAUTH_BASE BL11_RW_BASE
/* We keep a table at the end of ROM for function pointers */
#define ROM_TABLE_SIZE 32
#define BL1_ROM_TABLE (BL1_RO_LIMIT - ROM_TABLE_SIZE)
/*
* The top 16MB of DRAM1 is configured as secure access only using the TZC
* - SCP TZC DRAM: If present, DRAM reserved for SCP use
* - AP TZC DRAM: The remaining TZC secured DRAM reserved for AP use
*/
#define BRCM_TZC_DRAM1_SIZE ULL(0x01000000)
#define BRCM_SCP_TZC_DRAM1_BASE (BRCM_DRAM1_BASE + \
BRCM_DRAM1_SIZE - \
BRCM_SCP_TZC_DRAM1_SIZE)
#define BRCM_SCP_TZC_DRAM1_SIZE PLAT_BRCM_SCP_TZC_DRAM1_SIZE
#define BRCM_AP_TZC_DRAM1_BASE (BRCM_DRAM1_BASE + \
BRCM_DRAM1_SIZE - \
BRCM_TZC_DRAM1_SIZE)
#define BRCM_AP_TZC_DRAM1_SIZE (BRCM_TZC_DRAM1_SIZE - \
BRCM_SCP_TZC_DRAM1_SIZE)
#define BRCM_NS_DRAM1_BASE BRCM_DRAM1_BASE
#define BRCM_NS_DRAM1_SIZE (BRCM_DRAM1_SIZE - \
BRCM_TZC_DRAM1_SIZE)
#ifdef BRCM_SHARED_DRAM_BASE
#define BRCM_NS_SHARED_DRAM_BASE BRCM_SHARED_DRAM_BASE
#define BRCM_NS_SHARED_DRAM_SIZE BRCM_SHARED_DRAM_SIZE
#endif
#define BRCM_MAP_SHARED_RAM MAP_REGION_FLAT( \
BRCM_SHARED_RAM_BASE, \
BRCM_SHARED_RAM_SIZE, \
MT_DEVICE | MT_RW | MT_SECURE)
#define BRCM_MAP_NS_DRAM1 MAP_REGION_FLAT( \
BRCM_NS_DRAM1_BASE, \
BRCM_NS_DRAM1_SIZE, \
MT_MEMORY | MT_RW | MT_NS)
#ifdef BRCM_SHARED_DRAM_BASE
#define BRCM_MAP_NS_SHARED_DRAM MAP_REGION_FLAT( \
BRCM_NS_SHARED_DRAM_BASE, \
BRCM_NS_SHARED_DRAM_SIZE, \
MT_MEMORY | MT_RW | MT_NS)
#endif
#ifdef BRCM_EXT_SRAM_BASE
#define BRCM_MAP_EXT_SRAM MAP_REGION_FLAT( \
BRCM_EXT_SRAM_BASE, \
BRCM_EXT_SRAM_SIZE, \
MT_DEVICE | MT_RW | MT_SECURE)
#endif
#define BRCM_MAP_NAND_RO MAP_REGION_FLAT(NAND_BASE_ADDR,\
NAND_SIZE, \
MT_MEMORY | MT_RO | MT_SECURE)
#define BRCM_MAP_QSPI_RO MAP_REGION_FLAT(QSPI_BASE_ADDR,\
QSPI_SIZE, \
MT_MEMORY | MT_RO | MT_SECURE)
#define HSLS_REGION MAP_REGION_FLAT(HSLS_BASE_ADDR, \
HSLS_SIZE, \
MT_DEVICE | MT_RW | MT_SECURE)
#define CCN_REGION MAP_REGION_FLAT(PLAT_BRCM_CCN_BASE, \
CCN_SIZE, \
MT_DEVICE | MT_RW | MT_SECURE)
#define GIC500_REGION MAP_REGION_FLAT(GIC500_BASE, \
GIC500_SIZE, \
MT_DEVICE | MT_RW | MT_SECURE)
#ifdef PERIPH0_BASE
#define PERIPH0_REGION MAP_REGION_FLAT(PERIPH0_BASE, \
PERIPH0_SIZE, \
MT_DEVICE | MT_RW | MT_SECURE)
#endif
#ifdef PERIPH1_BASE
#define PERIPH1_REGION MAP_REGION_FLAT(PERIPH1_BASE, \
PERIPH1_SIZE, \
MT_DEVICE | MT_RW | MT_SECURE)
#endif
#ifdef PERIPH2_BASE
#define PERIPH2_REGION MAP_REGION_FLAT(PERIPH2_BASE, \
PERIPH2_SIZE, \
MT_DEVICE | MT_RW | MT_SECURE)
#endif
#if BRCM_BL31_IN_DRAM
#if IMAGE_BL2
#define BRCM_MAP_BL31_SEC_DRAM MAP_REGION_FLAT( \
BL31_BASE, \
PLAT_BRCM_MAX_BL31_SIZE,\
MT_DEVICE | MT_RW | MT_SECURE)
#else
#define BRCM_MAP_BL31_SEC_DRAM MAP_REGION_FLAT( \
BL31_BASE, \
PLAT_BRCM_MAX_BL31_SIZE,\
MT_MEMORY | MT_RW | MT_SECURE)
#endif
#endif
#if defined(USB_BASE) && defined(DRIVER_USB_ENABLE)
#define USB_REGION MAP_REGION_FLAT( \
USB_BASE, \
USB_SIZE, \
MT_DEVICE | MT_RW | MT_SECURE)
#endif
#ifdef USE_CRMU_SRAM
#define CRMU_SRAM_REGION MAP_REGION_FLAT( \
CRMU_SRAM_BASE, \
CRMU_SRAM_SIZE, \
MT_DEVICE | MT_RW | MT_SECURE)
#endif
/*
* The number of regions like RO(code), coherent and data required by
* different BL stages which need to be mapped in the MMU.
*/
#if USE_COHERENT_MEM
#define BRCM_BL_REGIONS 3
#else
#define BRCM_BL_REGIONS 2
#endif
#endif /* BRCM_DEF_H */
/*
* Copyright (c) 2019-2020, Broadcom
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef PLAT_BRCM_H
#define PLAT_BRCM_H
#include <stdint.h>
#include <lib/cassert.h>
#include <lib/utils_def.h>
#include <lib/xlat_tables/xlat_tables.h>
#include <platform_def.h>
struct image_info;
/* Global variables */
extern const mmap_region_t plat_brcm_mmap[];
uint32_t brcm_get_spsr_for_bl32_entry(void);
uint32_t brcm_get_spsr_for_bl33_entry(void);
const mmap_region_t *plat_brcm_get_mmap(void);
int bcm_bl2_handle_scp_bl2(struct image_info *image_info);
void plat_brcm_io_setup(void);
void plat_brcm_process_flags(uint16_t plat_toc_flags);
#endif /* PLAT_BRCM_H */
/*
* Copyright (c) 2018-2020, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <assert.h>
#include <common/debug.h>
#include <drivers/console.h>
#include <drivers/ti/uart/uart_16550.h>
#include <platform_def.h>
/*******************************************************************************
* Functions that set up the console
******************************************************************************/
static console_t bcm_boot_console;
static console_t bcm_runtime_console;
/* Initialize the console to provide early debug support */
void bcm_console_boot_init(void)
{
int rc = console_16550_register(PLAT_BRCM_BOOT_UART_BASE,
PLAT_BRCM_BOOT_UART_CLK_IN_HZ,
BRCM_CONSOLE_BAUDRATE,
&bcm_boot_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(&bcm_boot_console, CONSOLE_FLAG_BOOT);
}
void bcm_console_boot_end(void)
{
(void)console_flush();
(void)console_unregister(&bcm_boot_console);
}
/* Initialize the runtime console */
void bcm_console_runtime_init(void)
{
int rc = console_16550_register(PLAT_BRCM_BL31_RUN_UART_BASE,
PLAT_BRCM_BL31_RUN_UART_CLK_IN_HZ,
BRCM_CONSOLE_BAUDRATE,
&bcm_runtime_console);
if (rc == 0)
panic();
console_set_scope(&bcm_runtime_console, CONSOLE_FLAG_RUNTIME);
}
void bcm_console_runtime_end(void)
{
(void)console_flush();
(void)console_unregister(&bcm_runtime_console);
}
/*
* Copyright (c) 2016 - 2020, Broadcom
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <brcm_def.h>
#include <plat_brcm.h>
#if IMAGE_BL2
const mmap_region_t plat_brcm_mmap[] = {
HSLS_REGION,
BRCM_MAP_SHARED_RAM,
BRCM_MAP_NAND_RO,
BRCM_MAP_QSPI_RO,
#ifdef PERIPH0_REGION
PERIPH0_REGION,
#endif
#ifdef PERIPH1_REGION
PERIPH1_REGION,
#endif
#ifdef USE_DDR
BRCM_MAP_NS_DRAM1,
#if BRCM_BL31_IN_DRAM
BRCM_MAP_BL31_SEC_DRAM,
#endif
#else
#ifdef BRCM_MAP_EXT_SRAM
BRCM_MAP_EXT_SRAM,
#endif
#endif
#if defined(USE_CRMU_SRAM) && defined(CRMU_SRAM_BASE)
CRMU_SRAM_REGION,
#endif
{0}
};
#endif
CASSERT((ARRAY_SIZE(plat_brcm_mmap) - 1) <= PLAT_BRCM_MMAP_ENTRIES,
assert_plat_brcm_mmap_mismatch);
CASSERT((PLAT_BRCM_MMAP_ENTRIES + BRCM_BL_REGIONS) <= MAX_MMAP_REGIONS,
assert_max_mmap_regions);
#
# Copyright (c) 2015 - 2020, Broadcom
#
# SPDX-License-Identifier: BSD-3-Clause
#
PLAT_BL_COMMON_SOURCES += plat/brcm/board/common/board_common.c
# If no board config makefile, do not include it
ifneq (${BOARD_CFG},)
BOARD_CFG_MAKE := $(shell find plat/brcm/board/${PLAT} -name '${BOARD_CFG}.mk')
$(eval $(call add_define,BOARD_CFG))
ifneq (${BOARD_CFG_MAKE},)
$(info Including ${BOARD_CFG_MAKE})
include ${BOARD_CFG_MAKE}
else
$(error Error: File ${BOARD_CFG}.mk not found in plat/brcm/board/${PLAT})
endif
endif
# To compile with highest log level (VERBOSE) set value to 50
LOG_LEVEL := 40
# Use custom generic timer clock
ifneq (${GENTIMER_ACTUAL_CLOCK},)
$(info Using GENTIMER_ACTUAL_CLOCK=$(GENTIMER_ACTUAL_CLOCK))
SYSCNT_FREQ := $(GENTIMER_ACTUAL_CLOCK)
$(eval $(call add_define,SYSCNT_FREQ))
endif
ifeq (${STANDALONE_BL2},yes)
$(eval $(call add_define,MMU_DISABLED))
endif
# BL2 XIP from QSPI
RUN_BL2_FROM_QSPI := 0
ifeq (${RUN_BL2_FROM_QSPI},1)
$(eval $(call add_define,RUN_BL2_FROM_QSPI))
endif
# Use CRMU SRAM from iHOST
ifneq (${USE_CRMU_SRAM},)
$(eval $(call add_define,USE_CRMU_SRAM))
endif
# On BRCM platforms, separate the code and read-only data sections to allow
# mapping the former as executable and the latter as execute-never.
SEPARATE_CODE_AND_RODATA := 1
# Use generic OID definition (tbbr_oid.h)
USE_TBBR_DEFS := 1
PLAT_INCLUDES += -Iplat/brcm/board/common
PLAT_BL_COMMON_SOURCES += plat/brcm/common/brcm_common.c \
plat/brcm/board/common/cmn_sec.c \
plat/brcm/board/common/bcm_console.c \
plat/brcm/board/common/plat_setup.c \
plat/brcm/board/common/platform_common.c \
drivers/arm/sp804/sp804_delay_timer.c \
drivers/delay_timer/delay_timer.c \
drivers/io/io_fip.c \
drivers/io/io_memmap.c \
drivers/io/io_storage.c \
plat/brcm/common/brcm_io_storage.c \
plat/brcm/board/common/err.c \
drivers/arm/sp805/sp805.c
BL2_SOURCES += plat/brcm/common/brcm_bl2_mem_params_desc.c \
plat/brcm/common/brcm_image_load.c \
common/desc_image_load.c
BL2_SOURCES += plat/brcm/common/brcm_bl2_setup.c
# Use translation tables library v1 by default
ARM_XLAT_TABLES_LIB_V1 := 1
ifeq (${ARM_XLAT_TABLES_LIB_V1}, 1)
$(eval $(call assert_boolean,ARM_XLAT_TABLES_LIB_V1))
$(eval $(call add_define,ARM_XLAT_TABLES_LIB_V1))
PLAT_BL_COMMON_SOURCES += lib/xlat_tables/aarch64/xlat_tables.c \
lib/xlat_tables/xlat_tables_common.c
endif
/*
* Copyright (c) 2015 - 2020, Broadcom
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef CMN_PLAT_DEF_H
#define CMN_PLAT_DEF_H
/* Print file and line number on assert */
#define PLAT_LOG_LEVEL_ASSERT LOG_LEVEL_INFO
/*
* The number of regions like RO(code), coherent and data required by
* different BL stages which need to be mapped in the MMU.
*/
#if USE_COHERENT_MEM
#define CMN_BL_REGIONS 3
#else
#define CMN_BL_REGIONS 2
#endif
/*
* FIP definitions
*/
#define PLAT_FIP_ATTEMPT_OFFSET 0x20000
#define PLAT_FIP_NUM_ATTEMPTS 128
#define PLAT_BRCM_FIP_QSPI_BASE QSPI_BASE_ADDR
#define PLAT_BRCM_FIP_NAND_BASE NAND_BASE_ADDR
#define PLAT_BRCM_FIP_MAX_SIZE 0x01000000
#define PLAT_BRCM_FIP_BASE PLAT_BRCM_FIP_QSPI_BASE
#endif
/*
* Copyright (c) 2015 - 2020, Broadcom
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef CMN_PLAT_UTIL_H
#define CMN_PLAT_UTIL_H
#include <lib/mmio.h>
/* BOOT source */
#define BOOT_SOURCE_MASK 7
#define BOOT_SOURCE_QSPI 0
#define BOOT_SOURCE_NAND 1
#define BOOT_SOURCE_SPI_NAND 2
#define BOOT_SOURCE_UART 3
#define BOOT_SOURCE_RES4 4
#define BOOT_SOURCE_EMMC 5
#define BOOT_SOURCE_ATE 6
#define BOOT_SOURCE_USB 7
#define BOOT_SOURCE_MAX 8
#define BOOT_SOURCE_UNKNOWN (-1)
#define KHMAC_SHA256_KEY_SIZE 32
#define SOFT_PWR_UP_RESET_L0 0
#define SOFT_SYS_RESET_L1 1
#define SOFT_RESET_L3 0x3
#define BOOT_SOURCE_SOFT_DATA_OFFSET 8
#define BOOT_SOURCE_SOFT_ENABLE_OFFSET 14
#define BOOT_SOURCE_SOFT_ENABLE_MASK BIT(BOOT_SOURCE_SOFT_ENABLE_OFFSET)
typedef struct _key {
uint8_t hmac_sha256[KHMAC_SHA256_KEY_SIZE];
} cmn_key_t;
uint32_t boot_source_get(void);
void bl1_platform_wait_events(void);
void plat_soft_reset(uint32_t reset);
#endif
/*
* Copyright (c) 2015-2020, Broadcom
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <stdint.h>
#include <common/debug.h>
#include <lib/mmio.h>
#include <cmn_sec.h>
#pragma weak plat_tz_master_default_cfg
#pragma weak plat_tz_sdio_ns_master_set
#pragma weak plat_tz_usb_ns_master_set
void plat_tz_master_default_cfg(void)
{
/* This function should be implemented in the platform side. */
ERROR("%s: TZ CONFIGURATION NOT SET!!!\n", __func__);
}
void plat_tz_sdio_ns_master_set(uint32_t ns)
{
/* This function should be implemented in the platform side. */
ERROR("%s: TZ CONFIGURATION NOT SET!!!\n", __func__);
}
void plat_tz_usb_ns_master_set(uint32_t ns)
{
/* This function should be implemented in the platform side. */
ERROR("%s: TZ CONFIGURATION NOT SET!!!\n", __func__);
}
void tz_master_default_cfg(void)
{
plat_tz_master_default_cfg();
}
void tz_sdio_ns_master_set(uint32_t ns)
{
plat_tz_sdio_ns_master_set(ns);
}
void tz_usb_ns_master_set(uint32_t ns)
{
plat_tz_usb_ns_master_set(ns);
}
/*
* Copyright (c) 2015-2020, Broadcom
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef CMN_SEC_H
#define CMN_SEC_H
#include <stdint.h>
#define SECURE_MASTER 0
#define NS_MASTER 1
void tz_master_default_cfg(void);
void tz_usb_ns_master_set(uint32_t ns);
void tz_sdio_ns_master_set(uint32_t ns);
#endif
/*
* Copyright (c) 2016 - 2020, Broadcom
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <stdint.h>
#include <arch_helpers.h>
#include <common/debug.h>
#include <drivers/console.h>
#include <lib/mmio.h>
#include <platform_def.h>
#define L0_RESET 0x2
/*
* Brcm error handler
*/
void plat_error_handler(int err)
{
INFO("L0 reset...\n");
/* Ensure the characters are flushed out */
console_flush();
mmio_write_32(CRMU_SOFT_RESET_CTRL, L0_RESET);
/*
* In case we get here:
* Loop until the watchdog resets the system
*/
while (1) {
wfi();
}
}
/*
* Copyright (c) 2015 - 2020, Broadcom
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <plat/common/platform.h>
#include <platform_def.h>
/*
* This function returns the fixed clock frequency at which private
* timers run. This value will be programmed into CNTFRQ_EL0.
*/
unsigned int plat_get_syscnt_freq2(void)
{
return SYSCNT_FREQ;
}
static const char * const plat_prefix_str[] = {
"E: ", "N: ", "W: ", "I: ", "V: "
};
const char *plat_log_get_prefix(unsigned int log_level)
{
return plat_prefix_str[log_level - 1U];
}
/*
* Copyright (c) 2015-2020, Broadcom
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <arch_helpers.h>
#include <common/debug.h>
#include <cmn_plat_util.h>
#include <platform_def.h>
uint32_t boot_source_get(void)
{
/* For now return BOOT_SOURCE_QSPI */
return BOOT_SOURCE_QSPI;
}
void __dead2 plat_soft_reset(uint32_t reset)
{
if (reset == SOFT_RESET_L3) {
mmio_setbits_32(CRMU_IHOST_SW_PERSISTENT_REG1, reset);
mmio_write_32(CRMU_MAIL_BOX0, 0x0);
mmio_write_32(CRMU_MAIL_BOX1, 0xFFFFFFFF);
}
if (reset != SOFT_SYS_RESET_L1)
reset = SOFT_PWR_UP_RESET_L0;
if (reset == SOFT_PWR_UP_RESET_L0)
INFO("L0 RESET...\n");
if (reset == SOFT_SYS_RESET_L1)
INFO("L1 RESET...\n");
console_flush();
mmio_clrbits_32(CRMU_SOFT_RESET_CTRL, 1 << reset);
while (1) {
;
}
}
/*
* Copyright (c) 2015-2020, Broadcom
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <arch.h>
#include <asm_macros.S>
#include <assert_macros.S>
#include <cpu_macros.S>
#include <cortex_a72.h>
#include <drivers/ti/uart/uart_16550.h>
#include <platform_def.h>
.globl plat_reset_handler
.globl platform_get_entrypoint
.globl plat_secondary_cold_boot_setup
.globl platform_mem_init
.globl platform_check_mpidr
.globl plat_crash_console_init
.globl plat_crash_console_putc
.globl plat_crash_console_flush
.globl plat_disable_acp
.globl plat_is_my_cpu_primary
.globl plat_my_core_pos
.globl platform_is_primary_cpu
.globl plat_brcm_calc_core_pos
.globl plat_get_my_entrypoint
/* ------------------------------------------------------------
* void plat_l2_init(void);
*
* BL1 and BL2 run with one core, one cluster
* This is safe to disable cluster coherency
* to make use of the data cache MMU WB attribute
* for the SRAM.
*
* Set L2 Auxiliary Control Register
* --------------------------------------------------------------------
*/
func plat_l2_init
mrs x0, CORTEX_A72_L2ACTLR_EL1
#if (IMAGE_BL1 || IMAGE_BL2) || defined(USE_SINGLE_CLUSTER)
orr x0, x0, #CORTEX_A72_L2ACTLR_DISABLE_ACE_SH_OR_CHI
#else
bic x0, x0, #CORTEX_A72_L2ACTLR_DISABLE_ACE_SH_OR_CHI
#endif
msr CORTEX_A72_L2ACTLR_EL1, x0
/* Set L2 Control Register */
mrs x0, CORTEX_A72_L2CTLR_EL1
mov x1, #((CORTEX_A72_L2_DATA_RAM_LATENCY_MASK << \
CORTEX_A72_L2CTLR_DATA_RAM_LATENCY_SHIFT) | \
(CORTEX_A72_L2_TAG_RAM_LATENCY_MASK << \
CORTEX_A72_L2CTLR_TAG_RAM_LATENCY_SHIFT) | \
(U(0x1) << CORTEX_A72_L2CTLR_TAG_RAM_SETUP_SHIFT) | \
(U(0x1) << CORTEX_A72_L2CTLR_DATA_RAM_SETUP_SHIFT))
bic x0, x0, x1
mov x1, #((CORTEX_A72_L2_DATA_RAM_LATENCY_3_CYCLES << \
CORTEX_A72_L2CTLR_DATA_RAM_LATENCY_SHIFT) | \
(U(0x1) << CORTEX_A72_L2CTLR_TAG_RAM_SETUP_SHIFT) | \
(U(0x1) << CORTEX_A72_L2CTLR_DATA_RAM_SETUP_SHIFT))
orr x0, x0, x1
msr CORTEX_A72_L2CTLR_EL1, x0
isb
ret
endfunc plat_l2_init
/* --------------------------------------------------------------------
* void plat_reset_handler(void);
*
* Before adding code in this function, refer to the guidelines in
* docs/firmware-design.md.
*
* --------------------------------------------------------------------
*/
func plat_reset_handler
mov x9, x30
bl plat_l2_init
mov x30, x9
ret
endfunc plat_reset_handler
/* -----------------------------------------------------
* void platform_get_entrypoint (unsigned int mpid);
*
* Main job of this routine is to distinguish between
* a cold and warm boot.
* On a cold boot the secondaries first wait for the
* platform to be initialized after which they are
* hotplugged in. The primary proceeds to perform the
* platform initialization.
* -----------------------------------------------------
*/
func platform_get_entrypoint
/*TBD-STINGRAY*/
mov x0, #0
ret
endfunc platform_get_entrypoint
/* -----------------------------------------------------
* void plat_secondary_cold_boot_setup (void);
*
* This function performs any platform specific actions
* needed for a secondary cpu after a cold reset e.g
* mark the cpu's presence, mechanism to place it in a
* holding pen etc.
* -----------------------------------------------------
*/
func plat_secondary_cold_boot_setup
bl plat_my_core_pos
mov_imm x1, SECONDARY_CPU_SPIN_BASE_ADDR
add x0, x1, x0, LSL #3
mov x1, #0
str x1, [x0]
/* Wait until the entrypoint gets populated */
poll_mailbox:
ldr x1, [x0]
cbz x1, 1f
br x1
1:
wfe
b poll_mailbox
endfunc plat_secondary_cold_boot_setup
/* -----------------------------------------------------
* void platform_mem_init(void);
*
* We don't need to carry out any memory initialization
* on CSS platforms. The Secure RAM is accessible straight away.
* -----------------------------------------------------
*/
func platform_mem_init
/*TBD-STINGRAY*/
ret
endfunc platform_mem_init
/* -----------------------------------------------------
* Placeholder function which should be redefined by
* each platform.
* -----------------------------------------------------
*/
func platform_check_mpidr
/*TBD-STINGRAY*/
mov x0, xzr
ret
endfunc platform_check_mpidr
/* ---------------------------------------------
* int plat_crash_console_init(void)
* Function to initialize the crash console
* without a C Runtime to print crash report.
* Clobber list : x0, x1, x2
* ---------------------------------------------
*/
func plat_crash_console_init
mov_imm x0, BRCM_CRASH_CONSOLE_BASE
mov_imm x1, BRCM_CRASH_CONSOLE_REFCLK
mov_imm x2, BRCM_CRASH_CONSOLE_BAUDRATE
b console_16550_core_init
ret
endfunc plat_crash_console_init
/* ---------------------------------------------
* int plat_crash_console_putc(void)
* Function to print a character on the crash
* console without a C Runtime.
* Clobber list : x1, x2, x3
* ---------------------------------------------
*/
func plat_crash_console_putc
mov_imm x1, BRCM_CRASH_CONSOLE_BASE
b console_16550_core_putc
ret
endfunc plat_crash_console_putc
/* ---------------------------------------------
* int plat_crash_console_flush(void)
* Function to flush crash console
* Clobber list : x0, x1
* ---------------------------------------------
*/
func plat_crash_console_flush
mov_imm x0, BRCM_CRASH_CONSOLE_BASE
b console_16550_core_flush
ret
endfunc plat_crash_console_flush
/* -----------------------------------------------------
* Placeholder function which should be redefined by
* each platform. This function is allowed to use
* registers x0 - x17.
* -----------------------------------------------------
*/
func plat_disable_acp
/*TBD-STINGRAY*/
ret
endfunc plat_disable_acp
/* -----------------------------------------------------
* unsigned int plat_is_my_cpu_primary (void);
*
* Find out whether the current cpu is the primary
* cpu (applicable only after a cold boot)
* -----------------------------------------------------
*/
func plat_is_my_cpu_primary
mrs x0, mpidr_el1
b platform_is_primary_cpu
endfunc plat_is_my_cpu_primary
/* -----------------------------------------------------
* unsigned int plat_my_core_pos(void)
* This function uses the plat_brcm_calc_core_pos()
* definition to get the index of the calling CPU.
* -----------------------------------------------------
*/
func plat_my_core_pos
mrs x0, mpidr_el1
b plat_brcm_calc_core_pos
endfunc plat_my_core_pos
/* -----------------------------------------------------
* unsigned int platform_is_primary_cpu (void);
*
* Find out whether the current cpu is the primary
* cpu (applicable only after a cold boot)
* -----------------------------------------------------
*/
func platform_is_primary_cpu
mov x9, x30
bl plat_my_core_pos
cmp x0, #PRIMARY_CPU
cset x0, eq
ret x9
endfunc platform_is_primary_cpu
/* -----------------------------------------------------
* unsigned int plat_brcm_calc_core_pos(uint64_t mpidr)
* Helper function to calculate the core position.
* With this function: CorePos = (ClusterId * 4) +
* CoreId
* -----------------------------------------------------
*/
func plat_brcm_calc_core_pos
and x1, x0, #MPIDR_CPU_MASK
and x0, x0, #MPIDR_CLUSTER_MASK
add x0, x1, x0, LSR #7
ret
endfunc plat_brcm_calc_core_pos
func plat_get_my_entrypoint
mrs x0, mpidr_el1
b platform_get_entrypoint
endfunc plat_get_my_entrypoint
#
# Copyright (c) 2015 - 2020, Broadcom
#
# SPDX-License-Identifier: BSD-3-Clause
#
#######################################################
# Board config file for bcm958742t-ns3 Stingray SST100-NS3
#######################################################
include plat/brcm/board/stingray/bcm958742t.mk
# Load BL33 at 0xFF00_0000 address
ifneq (${BL33_OVERRIDE_LOAD_ADDR},)
$(eval $(call add_define_val,BL33_OVERRIDE_LOAD_ADDR,0xFF000000))
endif
#
# Copyright (c) 2015 - 2020, Broadcom
#
# SPDX-License-Identifier: BSD-3-Clause
#
#######################################################
# Board config file for bcm958742t Stingray SST100
#######################################################
BOARD_FAMILY := "<bcm958742t.h>"
$(eval $(call add_define,BOARD_FAMILY))
# Board has internal programmable regulator
IHOST_REG_TYPE := IHOST_REG_INTEGRATED
$(eval $(call add_define,IHOST_REG_TYPE))
# Board has internal programmable regulator
VDDC_REG_TYPE := VDDC_REG_INTEGRATED
$(eval $(call add_define,VDDC_REG_TYPE))
/*
* Copyright (c) 2019-2020, Broadcom
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef CRMU_DEF_H
#define CRMU_DEF_H
#define CRMU_REGS_BASE 0x66410000
/* 32 kB IDRAM */
#define CRMU_IDRAM_BASE_ADDR CRMU_REGS_BASE
#define CRMU_IDRAM_SIZE 0x8000
/* 4 kB Scratch RAM */
#define CRMU_SRAM_BASE (CRMU_IDRAM_BASE_ADDR + CRMU_IDRAM_SIZE)
#define CRMU_SRAM_SIZE 0x1000
#define CRMU_RESERVED_SPACE 0x3000
#define CRMU_CORE_BASE (CRMU_SRAM_BASE + CRMU_SRAM_SIZE + \
CRMU_RESERVED_SPACE)
#define CRMU_SHARED_SRAM_BASE CRMU_SRAM_BASE
#define CRMU_SHARED_SRAM_SIZE 0x200
#define CRMU_CFG_BASE (CRMU_SHARED_SRAM_BASE + \
CRMU_SHARED_SRAM_SIZE)
#define CRMU_PWR_GOOD_STATUS CRMU_CORE_BASE
#define CRMU_PWR_GOOD_STATUS__BBL_POWER_GOOD 0
#define CRMU_ISO_CELL_CONTROL (CRMU_CORE_BASE + 0x4)
#define CRMU_ISO_CELL_CONTROL__CRMU_ISO_PDBBL 16
#define CRMU_ISO_CELL_CONTROL__CRMU_ISO_PDBBL_TAMPER 24
#define CRMU_SPRU_SOURCE_SEL_STAT (CRMU_CORE_BASE + 0xc)
#define CRMU_SPRU_SOURCE_SEL_STAT__SPRU_SOURCE_SELECT 0
#define BSTI_BASE (CRMU_CORE_BASE + 0x28)
#define BSTI_CONTROL_OFFSET BSTI_BASE
#define BSTI_COMMAND_OFFSET (BSTI_BASE + 0x4)
#define OCOTP_REGS_BASE (CRMU_CORE_BASE + 0x400)
#define CRMU_TCI_BASE (CRMU_CORE_BASE + 0x800)
#define CRMU_SWREG_STATUS_ADDR (CRMU_TCI_BASE + 0x0c)
#define CRMU_CHIP_OTPC_STATUS (CRMU_TCI_BASE + 0x10)
#define CRMU_CHIP_OTPC_STATUS__OTP_BISR_LOAD_DONE 19
#define CRMU_BISR_PDG_MASK (CRMU_TCI_BASE + 0x4c)
#define CRMU_BISR_PDG_MASK__CRMU_BISR_IHOST0 2
#define CRMU_BISR_PDG_MASK__CRMU_BISR_IHOST1 3
#define CRMU_BISR_PDG_MASK__CRMU_BISR_IHOST2 4
#define CRMU_BISR_PDG_MASK__CRMU_BISR_IHOST3 0
#define CRMU_POWER_POLL (CRMU_TCI_BASE + 0x60)
#define CRMU_OTP_STATUS CRMU_POWER_POLL
#define CRMU_OTP_STATUS_BIT 1
#define CRMU_DDR_PHY_AON_CTRL (CRMU_TCI_BASE + 0x64)
#define CRMU_DDRPHY2_HW_RESETN_R BIT(21)
#define CRMU_DDRPHY2_PWROKIN_PHY_R BIT(20)
#define CRMU_DDRPHY2_PWRONIN_PHY_R BIT(19)
#define CRMU_DDRPHY2_ISO_PHY_DFI_R BIT(18)
#define CRMU_DDRPHY2_ISO_PHY_REGS_R BIT(17)
#define CRMU_DDRPHY2_ISO_PHY_PLL_R BIT(16)
#define CRMU_DDRPHY1_HW_RESETN_R BIT(13)
#define CRMU_DDRPHY1_PWROKIN_PHY_R BIT(12)
#define CRMU_DDRPHY1_PWRONIN_PHY_R BIT(11)
#define CRMU_DDRPHY1_ISO_PHY_DFI_R BIT(10)
#define CRMU_DDRPHY1_ISO_PHY_REGS_R BIT(9)
#define CRMU_DDRPHY1_ISO_PHY_PLL_R BIT(8)
#define CRMU_DDRPHY0_HW_RESETN_R BIT(5)
#define CRMU_DDRPHY0_PWROKIN_PHY_R BIT(4)
#define CRMU_DDRPHY0_PWRONIN_PHY_R BIT(3)
#define CRMU_DDRPHY0_ISO_PHY_DFI_R BIT(2)
#define CRMU_DDRPHY0_ISO_PHY_REGS_R BIT(1)
#define CRMU_DDRPHY0_ISO_PHY_PLL_R BIT(0)
#define CRMU_EMEM_RESET_N_R BIT(16)
#define CRMU_EMEM_PRESET_N_R BIT(0)
#define CRMU_SWREG_CTRL_ADDR (CRMU_TCI_BASE + 0x6c)
#define CRMU_AON_CTRL1 (CRMU_TCI_BASE + 0x70)
#define CRMU_AON_CTRL1__LCPLL1_ISO_IN 18
#define CRMU_AON_CTRL1__LCPLL1_PWRON_LDO 19
#define CRMU_AON_CTRL1__LCPLL1_PWR_ON 20
#define CRMU_AON_CTRL1__LCPLL0_ISO_IN 21
#define CRMU_AON_CTRL1__LCPLL0_PWRON_LDO 22
#define CRMU_AON_CTRL1__LCPLL0_PWR_ON 23
#define CRMU_PCIE_LCPLL_PWR_ON_SHIFT 29
#define CRMU_PCIE_LCPLL_PWR_ON_MASK BIT(CRMU_PCIE_LCPLL_PWR_ON_SHIFT)
#define CRMU_PCIE_LCPLL_PWRON_LDO_SHIFT 28
#define CRMU_PCIE_LCPLL_PWRON_LDO_MASK BIT(CRMU_PCIE_LCPLL_PWRON_LDO_SHIFT)
#define CRMU_PCIE_LCPLL_ISO_IN_SHIFT 27
#define CRMU_PCIE_LCPLL_ISO_IN_MASK BIT(CRMU_PCIE_LCPLL_ISO_IN_SHIFT)
#define CRMU_MASTER_AXI_ARUSER_CONFIG (CRMU_TCI_BASE + 0x74)
#define CRMU_MASTER_AXI_AWUSER_CONFIG (CRMU_TCI_BASE + 0x78)
#define CRMU_DDR_PHY_AON_CTRL_1 (CRMU_TCI_BASE + 0x8c)
#define CDRU_BASE_ADDR (CRMU_CORE_BASE + 0x1000)
#define CDRU_MISC_RESET_CONTROL CDRU_BASE_ADDR
#define CDRU_MISC_RESET_CONTROL_TS_RESET_N 16
#define CDRU_MISC_RESET_CONTROL__CDRU_USBSS_RESET_N 14
#define CDRU_MISC_RESET_CONTROL__CDRU_SATA_RESET_N_R 15
#define CDRU_MISC_RESET_CONTROL__CDRU_MHB_RESET_N_R 13
#define CDRU_MISC_RESET_CONTROL__CDRU_PCIE_RESET_N_R 3
#define CDRU_MISC_RESET_CONTROL__CDRU_PM_RESET_N_R 2
#define CDRU_MISC_RESET_CONTROL__CDRU_NITRO_RESET_N_R 1
#define CDRU_PROC_EVENT_CLEAR (CDRU_BASE_ADDR + 0x48)
#define CDRU_PROC_EVENT_CLEAR__IH0_CDRU_STANDBYWFIL2 0
#define CDRU_PROC_EVENT_CLEAR__IH0_CDRU_STANDBYWFI 3
#define CDRU_PROC_EVENT_CLEAR__IH1_CDRU_STANDBYWFIL2 5
#define CDRU_PROC_EVENT_CLEAR__IH1_CDRU_STANDBYWFI 8
#define CDRU_PROC_EVENT_CLEAR__IH2_CDRU_STANDBYWFIL2 10
#define CDRU_PROC_EVENT_CLEAR__IH2_CDRU_STANDBYWFI 13
#define CDRU_PROC_EVENT_CLEAR__IH3_CDRU_STANDBYWFIL2 15
#define CDRU_PROC_EVENT_CLEAR__IH3_CDRU_STANDBYWFI 18
#define CDRU_CHIP_STRAP_CTRL (CDRU_BASE_ADDR + 0x50)
#define CDRU_CHIP_STRAP_CTRL__SOFTWARE_OVERRIDE 31
#define CDRU_CHIP_IO_PAD_CONTROL (CDRU_BASE_ADDR + 0x58)
#define CDRU_CHIP_IO_PAD_CONTROL__CDRU_IOMUX_FORCE_PDN_R 8
#define CDRU_CHIP_IO_PAD_CONTROL__CDRU_IOMUX_FORCE_PAD_IN_R 0
#define CDRU_CHIP_STRAP_DATA_LSW (CDRU_BASE_ADDR + 0x5c)
#define CDRU_CHIP_STRAP_DATA_LSW__BISR_BYPASS_MODE 18
#define CDRU_CHIP_STRAP_DATA_LSW__NIC_MODE_MASK BIT(8)
#define CDRU_CHIP_STRAP_DATA_LSW_PAD_USB_MODE BIT(26)
#define CDRU_CHIP_STRAP_DATA (CDRU_BASE_ADDR + 0x5c)
#define CDRU_DDR0_CONTROL_OFFSET (CDRU_BASE_ADDR + 0xb8)
#define CDRU_DDR1_CONTROL_OFFSET (CDRU_BASE_ADDR + 0xbc)
#define CDRU_DDR2_CONTROL_OFFSET (CDRU_BASE_ADDR + 0xc0)
#define CRMU_SW_POR_RESET_CTRL (CDRU_BASE_ADDR + 0x100)
#define CDRU_GENPLL2_CONTROL1 (CDRU_BASE_ADDR + 0x1b0)
#define CDRU_GENPLL2_CONTROL1__CHNL6_FS4_CLK BIT(11)
#define CDRU_GENPLL5_CONTROL1 (CDRU_BASE_ADDR + 0x24c)
#define CDRU_GENPLL5_CONTROL1__CHNL0_DME_CLK BIT(6)
#define CDRU_GENPLL5_CONTROL1__CHNL1_CRYPTO_AE_CLK BIT(7)
#define CDRU_GENPLL5_CONTROL1__CHNL2_RAID_AE_CLK BIT(8)
#define CDRU_NITRO_CONTROL (CDRU_BASE_ADDR + 0x2c4)
#define CDRU_NITRO_CONTROL__CDRU_NITRO_SEC_MODE_R 20
#define CDRU_NITRO_CONTROL__CDRU_NITRO_SEC_OVERRIDE_R 16
#define CDRU_MISC_CLK_ENABLE_CONTROL (CDRU_BASE_ADDR + 0x2c8)
#define CDRU_MISC_CLK_ENABLE_CONTROL__CDRU_EMEM2_CLK_EN_R 11
#define CDRU_MISC_CLK_ENABLE_CONTROL__CDRU_EMEM1_CLK_EN_R 10
#define CDRU_MISC_CLK_ENABLE_CONTROL__CDRU_EMEM0_CLK_EN_R 9
#define CDRU_MISC_CLK_ENABLE_CONTROL__CDRU_SATA_CLK_EN_R 8
#define CDRU_MISC_CLK_ENABLE_CONTROL__CDRU_USBSS_CLK_EN_R 7
#define CDRU_MISC_CLK_ENABLE_CONTROL__CDRU_MHB_CLK_EN_R 6
#define CDRU_MISC_CLK_ENABLE_CONTROL__CDRU_HSLS_CLK_EN_R 5
#define CDRU_MISC_CLK_ENABLE_CONTROL__CDRU_SCR_CLK_EN_R 4
#define CDRU_MISC_CLK_ENABLE_CONTROL__CDRU_FS4_CLK_EN_R 3
#define CDRU_MISC_CLK_ENABLE_CONTROL__CDRU_PCIE_CLK_EN_R 2
#define CDRU_MISC_CLK_ENABLE_CONTROL__CDRU_PM_CLK_EN_R 1
#define CDRU_MISC_CLK_ENABLE_CONTROL__CDRU_NITRO_CLK_EN_R 0
#define CDRU_CCN_REGISTER_CONTROL_1 (CDRU_BASE_ADDR + 0x324)
#define CDRU_CCN_REGISTER_CONTROL_1__D2XS_PD_EMEM0_BIT 6
#define CDRU_CCN_REGISTER_CONTROL_1__D2XS_PD_EMEM1_BIT 5
#define CDRU_CCN_REGISTER_CONTROL_1__D2XS_PD_EMEM2_BIT 4
#define CDRU_CHIP_TOP_SPARE_REG0 (CDRU_BASE_ADDR + 0x378)
#define CDRU_CHIP_TOP_SPARE_REG1 (CDRU_BASE_ADDR + 0x37c)
#define CENTRAL_TIMER_BASE (CRMU_CORE_BASE + 0x5000)
#define CENTRAL_TIMER_CTRL (CENTRAL_TIMER_BASE + 0x0)
#define CENTRAL_TIMER_GET_L (CENTRAL_TIMER_BASE + 0x4)
#define CENTRAL_TIMER_GET_L0 (CENTRAL_TIMER_BASE + 0x8) /* SCR STM */
#define CENTRAL_TIMER_GET_L1 (CENTRAL_TIMER_BASE + 0xC) /* FS STM */
#define CENTRAL_TIMER_GET_L2 (CENTRAL_TIMER_BASE + 0x10) /* iHost0 */
#define CENTRAL_TIMER_GET_L3 (CENTRAL_TIMER_BASE + 0x14) /* iHost1 */
#define CENTRAL_TIMER_GET_L4 (CENTRAL_TIMER_BASE + 0x18) /* iHost2 */
#define CENTRAL_TIMER_GET_L5 (CENTRAL_TIMER_BASE + 0x1C) /* iHost3 */
#define CENTRAL_TIMER_GET_H (CENTRAL_TIMER_BASE + 0x28)
#define CENTRAL_TIMER_SAT_TMR_ENA (CENTRAL_TIMER_BASE + 0x34)
#define CENTRAL_TIMER_GET_IHOST_ENA_BASE (CENTRAL_TIMER_GET_L2)
#define CRMU_WDT_REGS_BASE (CRMU_CORE_BASE + 0x6000)
#define CRMU_MAIL_BOX0 (CRMU_CORE_BASE + 0x8024)
#define CRMU_MAIL_BOX1 (CRMU_CORE_BASE + 0x8028)
#define CRMU_READ_MAIL_BOX0 (CRMU_CORE_BASE + 0x802c)
#define CRMU_READ_MAIL_BOX1 (CRMU_CORE_BASE + 0x8030)
#define AP_TO_SCP_MAILBOX1 CRMU_MAIL_BOX1
#define SCP_TO_AP_MAILBOX1 CRMU_READ_MAIL_BOX1
#define CRMU_IHOST_POWER_CONFIG (CRMU_CORE_BASE + 0x8038)
#define CRMU_RESET_EVENT_LOG (CRMU_CORE_BASE + 0x8064)
#define CRMU_SOFT_RESET_CTRL (CRMU_CORE_BASE + 0x8090)
#define CRMU_SOFT_RESET_CTRL__SOFT_PWR_UP_RST 0
#define CRMU_SOFT_RESET_CTRL__SOFT_SYS_RST 1
#define CRMU_SPARE_REG_0 (CRMU_CORE_BASE + 0x80b8)
#define CRMU_SPARE_REG_1 (CRMU_CORE_BASE + 0x80bc)
#define CRMU_SPARE_REG_2 (CRMU_CORE_BASE + 0x80c0)
#define CRMU_SPARE_REG_3 (CRMU_CORE_BASE + 0x80c4)
#define CRMU_SPARE_REG_4 (CRMU_CORE_BASE + 0x80c8)
#define CRMU_SPARE_REG_5 (CRMU_CORE_BASE + 0x80cc)
#define CRMU_CORE_ADDR_RANGE0_LOW (CRMU_CORE_BASE + 0x8c30)
#define CRMU_CORE_ADDR_RANGE1_LOW (CRMU_CORE_BASE + 0x8c38)
#define CRMU_CORE_ADDR_RANGE2_LOW (CRMU_CORE_BASE + 0x8c40)
#define CRMU_IHOST_SW_PERSISTENT_REG0 (CRMU_CORE_BASE + 0x8c54)
#define CRMU_IHOST_SW_PERSISTENT_REG1 (CRMU_CORE_BASE + 0x8c58)
#define CRMU_IHOST_SW_PERSISTENT_REG2 (CRMU_CORE_BASE + 0x8c5c)
#define CRMU_IHOST_SW_PERSISTENT_REG3 (CRMU_CORE_BASE + 0x8c60)
#define CRMU_IHOST_SW_PERSISTENT_REG4 (CRMU_CORE_BASE + 0x8c64)
#define CRMU_IHOST_SW_PERSISTENT_REG5 (CRMU_CORE_BASE + 0x8c68)
#define CRMU_IHOST_SW_PERSISTENT_REG6 (CRMU_CORE_BASE + 0x8c6c)
#define CRMU_IHOST_SW_PERSISTENT_REG7 (CRMU_CORE_BASE + 0x8c70)
#define CRMU_BBL_AUTH_CHECK (CRMU_CORE_BASE + 0x8c78)
#define CRMU_SOTP_NEUTRALIZE_ENABLE (CRMU_CORE_BASE + 0x8c84)
#define CRMU_IHOST_SW_PERSISTENT_REG8 (CRMU_CORE_BASE + 0x8c88)
#define CRMU_IHOST_SW_PERSISTENT_REG9 (CRMU_CORE_BASE + 0x8c8c)
#define CRMU_IHOST_SW_PERSISTENT_REG10 (CRMU_CORE_BASE + 0x8c90)
#define CRMU_IHOST_SW_PERSISTENT_REG11 (CRMU_CORE_BASE + 0x8c94)
#define CNT_CONTROL_BASE (CRMU_CORE_BASE + 0x9000)
#define CNTCR (CNT_CONTROL_BASE)
#define CNTCR__EN BIT(0)
#define SPRU_BBL_WDATA (CRMU_CORE_BASE + 0xa000)
#define SPRU_BBL_CMD (CRMU_CORE_BASE + 0xa004)
#define SPRU_BBL_CMD__IND_SOFT_RST_N 10
#define SPRU_BBL_CMD__IND_WR 11
#define SPRU_BBL_CMD__BBL_ADDR_R 0
#define SPRU_BBL_CMD__IND_RD 12
#define SPRU_BBL_CMD__BBL_ADDR_R 0
#define SPRU_BBL_STATUS (CRMU_CORE_BASE + 0xa008)
#define SPRU_BBL_STATUS__ACC_DONE 0
#define SPRU_BBL_RDATA (CRMU_CORE_BASE + 0xa00c)
#endif /* CRMU_DEF_H */
/*
* Copyright (c) 2015-2020, Broadcom
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef PLAT_MACROS_S
#define PLAT_MACROS_S
.section .rodata.gic_reg_name, "aS"
gicc_regs:
.asciz "gicc_hppir", "gicc_ahppir", "gicc_ctlr", ""
gicd_pend_reg:
.asciz "gicd_ispendr regs (Offsets 0x200 - 0x278)\n Offset:\t\t\tvalue\n"
newline:
.asciz "\n"
spacer:
.asciz ":\t\t0x"
/* ---------------------------------------------
* The below required platform porting macro
* prints out relevant registers whenever an
* unhandled exception is taken in BL31.
* ---------------------------------------------
*/
.macro plat_crash_print_regs
nop
.endm
/* ---------------------------------------------
* The below macro prints out relevant GIC
* registers whenever an unhandled exception is
* taken in BL31.
* ---------------------------------------------
*/
.macro plat_print_gic_regs
nop
/*TBD-STINGRAY*/
.endm
/* ------------------------------------------------
* The below required platform porting macro prints
* out relevant interconnect registers whenever an
* unhandled exception is taken in BL3-1.
* ------------------------------------------------
*/
.macro plat_print_interconnect_regs
nop
/*TBD-STINGRAY*/
.endm
#endif /* PLAT_MACROS_S */
/*
* Copyright (c) 2015-2020, Broadcom
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef PLATFORM_DEF_H
#define PLATFORM_DEF_H
#include <arch.h>
#include <common/tbbr/tbbr_img_def.h>
#include <plat/common/common_def.h>
#include <brcm_def.h>
#include <cmn_plat_def.h>
#include "sr_def.h"
/*
* Most platform porting definitions provided by included headers
*/
#define PLAT_BRCM_SCP_TZC_DRAM1_SIZE ULL(0x0)
/*
* Required by standard platform porting definitions
*/
#define PLATFORM_CLUSTER0_CORE_COUNT 2
#define PLATFORM_CLUSTER1_CORE_COUNT 2
#define PLATFORM_CLUSTER2_CORE_COUNT 2
#define PLATFORM_CLUSTER3_CORE_COUNT 2
#define PLATFORM_CLUSTER4_CORE_COUNT 2
#define BRCM_SYSTEM_COUNT 1
#define BRCM_CLUSTER_COUNT 5
#define PLATFORM_CORE_COUNT (PLATFORM_CLUSTER0_CORE_COUNT + \
PLATFORM_CLUSTER1_CORE_COUNT+ \
PLATFORM_CLUSTER2_CORE_COUNT+ \
PLATFORM_CLUSTER3_CORE_COUNT+ \
PLATFORM_CLUSTER4_CORE_COUNT)
#define PLAT_NUM_PWR_DOMAINS (BRCM_SYSTEM_COUNT + \
BRCM_CLUSTER_COUNT + \
PLATFORM_CORE_COUNT)
#define PLAT_MAX_PWR_LVL MPIDR_AFFLVL2
/* TBD-STINGRAY */
#define CACHE_WRITEBACK_SHIFT 6
/*
* Some data must be aligned on the biggest cache line size in the platform.
* This is known only to the platform as it might have a combination of
* integrated and external caches.
*/
#define CACHE_WRITEBACK_GRANULE (1 << CACHE_WRITEBACK_SHIFT)
/* TBD-STINGRAY */
#define PLATFORM_MAX_AFFLVL MPIDR_AFFLVL1
#define BL1_PLATFORM_STACK_SIZE 0x3300
#define BL2_PLATFORM_STACK_SIZE 0xc000
#define BL11_PLATFORM_STACK_SIZE 0x2b00
#define DEFAULT_PLATFORM_STACK_SIZE 0x400
#if IMAGE_BL1
# define PLATFORM_STACK_SIZE BL1_PLATFORM_STACK_SIZE
#else
#if IMAGE_BL2
#ifdef USE_BL1_RW
# define PLATFORM_STACK_SIZE BL2_PLATFORM_STACK_SIZE
#else
# define PLATFORM_STACK_SIZE BL1_PLATFORM_STACK_SIZE
#endif
#else
#if IMAGE_BL11
# define PLATFORM_STACK_SIZE BL11_PLATFORM_STACK_SIZE
#else
# define PLATFORM_STACK_SIZE DEFAULT_PLATFORM_STACK_SIZE
#endif
#endif
#endif
#define PLAT_BRCM_TRUSTED_SRAM_BASE 0x66D00000
#define PLAT_BRCM_TRUSTED_SRAM_SIZE 0x00040000
#ifdef RUN_BL1_FROM_QSPI /* BL1 XIP from QSPI */
# define PLAT_BRCM_TRUSTED_ROM_BASE QSPI_BASE_ADDR
#elif RUN_BL1_FROM_NAND /* BL1 XIP from NAND */
# define PLAT_BRCM_TRUSTED_ROM_BASE NAND_BASE_ADDR
#else /* BL1 executed in ROM */
# define PLAT_BRCM_TRUSTED_ROM_BASE ROM_BASE_ADDR
#endif
#define PLAT_BRCM_TRUSTED_ROM_SIZE 0x00040000
/*******************************************************************************
* BL1 specific defines.
******************************************************************************/
#define BL1_RO_BASE PLAT_BRCM_TRUSTED_ROM_BASE
#define BL1_RO_LIMIT (PLAT_BRCM_TRUSTED_ROM_BASE \
+ PLAT_BRCM_TRUSTED_ROM_SIZE)
/*
* Put BL1 RW at the beginning of the Trusted SRAM.
*/
#define BL1_RW_BASE (BRCM_BL_RAM_BASE)
#define BL1_RW_LIMIT (BL1_RW_BASE + 0x12000)
#define BL11_RW_BASE BL1_RW_LIMIT
#define BL11_RW_LIMIT (PLAT_BRCM_TRUSTED_SRAM_BASE + \
PLAT_BRCM_TRUSTED_SRAM_SIZE)
/*******************************************************************************
* BL2 specific defines.
******************************************************************************/
#if RUN_BL2_FROM_QSPI /* BL2 XIP from QSPI */
#define BL2_BASE QSPI_BASE_ADDR
#define BL2_LIMIT (BL2_BASE + 0x40000)
#define BL2_RW_BASE BL1_RW_LIMIT
#define BL2_RW_LIMIT (PLAT_BRCM_TRUSTED_SRAM_BASE + \
PLAT_BRCM_TRUSTED_SRAM_SIZE)
#elif RUN_BL2_FROM_NAND /* BL2 XIP from NAND */
#define BL2_BASE NAND_BASE_ADDR
#define BL2_LIMIT (BL2_BASE + 0x40000)
#define BL2_RW_BASE BL1_RW_LIMIT
#define BL2_RW_LIMIT (PLAT_BRCM_TRUSTED_SRAM_BASE + \
PLAT_BRCM_TRUSTED_SRAM_SIZE)
#else
#define BL2_BASE (BL1_RW_LIMIT + PAGE_SIZE)
#define BL2_LIMIT (BRCM_BL_RAM_BASE + BRCM_BL_RAM_SIZE)
#endif
/*
* BL1 persistent area in internal SRAM
* This area will increase as more features gets into BL1
*/
#define BL1_PERSISTENT_DATA_SIZE 0x2000
/* To reduce BL2 runtime footprint, we can re-use some BL1_RW area */
#define BL1_RW_RECLAIM_BASE (PLAT_BRCM_TRUSTED_SRAM_BASE + \
BL1_PERSISTENT_DATA_SIZE)
/*******************************************************************************
* BL3-1 specific defines.
******************************************************************************/
/* Max Size of BL31 (in DRAM) */
#define PLAT_BRCM_MAX_BL31_SIZE 0x30000
#ifdef USE_DDR
#define BL31_BASE BRCM_AP_TZC_DRAM1_BASE
#define BL31_LIMIT (BRCM_AP_TZC_DRAM1_BASE + \
PLAT_BRCM_MAX_BL31_SIZE)
#else
/* Put BL3-1 at the end of external on-board SRAM connected as NOR flash */
#define BL31_BASE (NOR_BASE_ADDR + NOR_SIZE - \
PLAT_BRCM_MAX_BL31_SIZE)
#define BL31_LIMIT (NOR_BASE_ADDR + NOR_SIZE)
#endif
#define SECURE_DDR_END_ADDRESS BL31_LIMIT
#ifdef NEED_SCP_BL2
#define SCP_BL2_BASE BL31_BASE
#define PLAT_MAX_SCP_BL2_SIZE 0x9000
#define PLAT_SCP_COM_SHARED_MEM_BASE (CRMU_SHARED_SRAM_BASE)
/* dummy defined */
#define PLAT_BRCM_MHU_BASE 0x0
#endif
#define SECONDARY_CPU_SPIN_BASE_ADDR BRCM_SHARED_RAM_BASE
/* Generic system timer counter frequency */
#ifndef SYSCNT_FREQ
#define SYSCNT_FREQ (125 * 1000 * 1000)
#endif
/*
* Enable the BL32 definitions, only when optee os is selected as secure
* payload (BL32).
*/
#ifdef SPD_opteed
/*
* Reserved Memory Map : SHMEM & TZDRAM.
*
* +--------+----------+ 0x8D000000
* | SHMEM (NS) | 16MB
* +-------------------+ 0x8E000000
* | | TEE_RAM(S)| 4MB
* + TZDRAM +----------+ 0x8E400000
* | | TA_RAM(S) | 12MB
* +-------------------+ 0x8F000000
* | BL31 Binary (S) | 192KB
* +-------------------+ 0x8F030000
*/
#define BL32_VA_SIZE (4 * 1024 * 1024)
#define BL32_BASE (0x8E000000)
#define BL32_LIMIT (BL32_BASE + BL32_VA_SIZE)
#define TSP_SEC_MEM_BASE BL32_BASE
#define TSP_SEC_MEM_SIZE BL32_VA_SIZE
#endif
#ifdef SPD_opteed
#define SECURE_DDR_BASE_ADDRESS BL32_BASE
#else
#define SECURE_DDR_BASE_ADDRESS BL31_BASE
#endif
/*******************************************************************************
* Platform specific page table and MMU setup constants
******************************************************************************/
#define MAX_XLAT_TABLES 7
#define PLAT_BRCM_MMAP_ENTRIES 10
#define MAX_MMAP_REGIONS (PLAT_BRCM_MMAP_ENTRIES + \
BRCM_BL_REGIONS)
#ifdef USE_DDR
#ifdef BL33_OVERRIDE_LOAD_ADDR
#define PLAT_BRCM_NS_IMAGE_OFFSET BL33_OVERRIDE_LOAD_ADDR
#else
/*
* BL3-3 image starting offset.
* Putting start of DRAM as of now.
*/
#define PLAT_BRCM_NS_IMAGE_OFFSET 0x80000000
#endif /* BL33_OVERRIDE_LOAD_ADDR */
#else
/*
* BL3-3 image starting offset.
* Putting start of external on-board SRAM as of now.
*/
#define PLAT_BRCM_NS_IMAGE_OFFSET NOR_BASE_ADDR
#endif /* USE_DDR */
/******************************************************************************
* Required platform porting definitions common to all BRCM platforms
*****************************************************************************/
#define MAX_IO_DEVICES 5
#define MAX_IO_HANDLES 6
#define PRIMARY_CPU 0
/* GIC Parameter */
#define PLAT_BRCM_GICD_BASE GIC500_BASE
#define PLAT_BRCM_GICR_BASE (GIC500_BASE + 0x200000)
/* Define secure interrupt as per Group here */
#define PLAT_BRCM_G1S_IRQ_PROPS(grp) \
INTR_PROP_DESC(BRCM_IRQ_SEC_SGI_1, GIC_HIGHEST_SEC_PRIORITY, (grp), \
GIC_INTR_CFG_EDGE), \
INTR_PROP_DESC(BRCM_IRQ_SEC_SPI_0, GIC_HIGHEST_SEC_PRIORITY, (grp), \
GIC_INTR_CFG_EDGE)
#define PLAT_BRCM_G0_IRQ_PROPS(grp) \
INTR_PROP_DESC(BRCM_IRQ_SEC_SGI_0, PLAT_SDEI_NORMAL_PRI, (grp), \
GIC_INTR_CFG_EDGE), \
/*
*CCN 502 related constants.
*/
#define PLAT_BRCM_CLUSTER_COUNT 4 /* Number of RN-F Masters */
#define PLAT_BRCM_CLUSTER_TO_CCN_ID_MAP CLUSTER0_NODE_ID, CLUSTER1_NODE_ID, CLUSTER2_NODE_ID, CLUSTER3_NODE_ID
#define CCN_SIZE 0x1000000
#define CLUSTER0_NODE_ID 1
#define CLUSTER1_NODE_ID 7
#define CLUSTER2_NODE_ID 9
#define CLUSTER3_NODE_ID 15
#endif
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment