• Aditya Angadi's avatar
    plat/arm: introduce wrapper functions to setup secure watchdog · b0c97daf
    Aditya Angadi authored
    
    The BL1 stage setup code for ARM platforms sets up the SP805 watchdog
    controller as the secure watchdog. But not all ARM platforms use SP805
    as the secure watchdog controller.
    
    So introduce two new ARM platform code specific wrapper functions to
    start and stop the secure watchdog. These functions then replace the
    calls to SP805 driver in common BL1 setup code. All the ARM platforms
    implement these wrapper functions by either calling into SP805 driver
    or the SBSA watchdog driver.
    
    Change-Id: I1a9a11b124cf3fac2a84f22ca40acd440a441257
    Signed-off-by: default avatarAditya Angadi <aditya.angadi@arm.com>
    b0c97daf
sgm_bl1_setup.c 1.01 KB
/*
 * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#include <common/bl_common.h>
#include <common/debug.h>
#include <plat/arm/common/plat_arm.h>
#include <plat/arm/soc/common/soc_css.h>
#include <plat/arm/common/arm_def.h>
#include <drivers/arm/sp805.h>
#include <sgm_plat_config.h>

void bl1_early_platform_setup(void)
{

	/* Initialize the console before anything else */
	arm_bl1_early_platform_setup();

	/* Initialize the platform configuration structure */
	plat_config_init();

#if !HW_ASSISTED_COHERENCY
	/*
	 * Initialize Interconnect for this cluster during cold boot.
	 * No need for locks as no other CPU is active.
	 */
	plat_arm_interconnect_init();
	/*
	 * Enable Interconnect coherency for the primary CPU's cluster.
	 */
	plat_arm_interconnect_enter_coherency();
#endif
}

void plat_arm_secure_wdt_start(void)
{
	sp805_start(ARM_SP805_TWDG_BASE, ARM_TWDG_LOAD_VAL);
}

void plat_arm_secure_wdt_stop(void)
{
	sp805_stop(ARM_SP805_TWDG_BASE);
}