Browse Source

Tegra194: mce: support for shutdown and reboot

This patch adds support for shutdown/reboot handlers to the MCE
driver.

ATF communicates with mce using nvg interface for shutdown &
reboot. Both shutdown and reboot use the same nvg index.
However, the 1st bit of the nvg data argument differentiates
whether its a shutdown or reboot.

Change-Id: Id2d1b0c4fec55abf69b7f8adb65ca70bfa920e73
Signed-off-by: Vignesh Radhakrishnan <vigneshr@nvidia.com>
pull/1937/head
Vignesh Radhakrishnan 7 years ago
committed by Manish Pandey
parent
commit
0789758a4d
  1. 5
      plat/nvidia/tegra/soc/t194/drivers/include/mce_private.h
  2. 7
      plat/nvidia/tegra/soc/t194/drivers/include/t194_nvg.h
  3. 16
      plat/nvidia/tegra/soc/t194/drivers/mce/mce.c
  4. 22
      plat/nvidia/tegra/soc/t194/drivers/mce/nvg.c

5
plat/nvidia/tegra/soc/t194/drivers/include/mce_private.h

@ -7,6 +7,7 @@
#ifndef MCE_PRIVATE_H
#define MCE_PRIVATE_H
#include <stdbool.h>
#include <tegra_def.h>
/*******************************************************************************
@ -67,8 +68,12 @@ uint64_t nvg_cache_clean(void);
uint64_t nvg_cache_clean_inval(void);
uint64_t nvg_cache_inval_all(void);
void nvg_enable_strict_checking_mode(void);
void nvg_system_shutdown(void);
void nvg_system_reboot(void);
/* MCE helper functions */
void mce_enable_strict_checking(void);
void mce_system_shutdown(void);
void mce_system_reboot(void);
#endif /* MCE_PRIVATE_H */

7
plat/nvidia/tegra/soc/t194/drivers/include/t194_nvg.h

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -128,6 +128,11 @@ typedef enum {
TEGRA_NVG_SYSTEM_SC8 = 8
} tegra_nvg_system_sleep_state_t;
typedef enum {
TEGRA_NVG_SHUTDOWN = 0U,
TEGRA_NVG_REBOOT = 1U,
} tegra_nvg_shutdown_reboot_state_t;
// ---------------------------------------------------------------------------
// NVG Data subformats
// ---------------------------------------------------------------------------

16
plat/nvidia/tegra/soc/t194/drivers/mce/mce.c

@ -237,3 +237,19 @@ void mce_enable_strict_checking(void)
}
}
#endif
/*******************************************************************************
* Handler to power down the entire system
******************************************************************************/
void mce_system_shutdown(void)
{
nvg_system_shutdown();
}
/*******************************************************************************
* Handler to reboot the entire system
******************************************************************************/
void mce_system_reboot(void)
{
nvg_system_reboot();
}

22
plat/nvidia/tegra/soc/t194/drivers/mce/nvg.c

@ -302,3 +302,25 @@ void nvg_enable_strict_checking_mode(void)
nvg_set_request_data(TEGRA_NVG_CHANNEL_SECURITY_CONFIG, params);
}
#endif
/*
* Request a reboot
*
* NVGDATA[0]: reboot command
*/
void nvg_system_reboot(void)
{
/* issue command for reboot */
nvg_set_request_data(TEGRA_NVG_CHANNEL_SHUTDOWN, TEGRA_NVG_REBOOT);
}
/*
* Request a shutdown
*
* NVGDATA[0]: shutdown command
*/
void nvg_system_shutdown(void)
{
/* issue command for shutdown */
nvg_set_request_data(TEGRA_NVG_CHANNEL_SHUTDOWN, TEGRA_NVG_SHUTDOWN);
}

Loading…
Cancel
Save