2020-01-09 08:52:15 +00:00
|
|
|
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
|
|
|
|
/*
|
|
|
|
* (C) Copyright 2019 Amarula Solutions(India)
|
|
|
|
* Author: Jagan Teki <jagan@amarulasolutions.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
2020-05-10 17:40:03 +00:00
|
|
|
#include <env.h>
|
2020-05-10 17:40:02 +00:00
|
|
|
#include <init.h>
|
2020-01-09 08:52:18 +00:00
|
|
|
#include <asm/io.h>
|
|
|
|
#include <asm/arch-rockchip/clock.h>
|
|
|
|
#include <asm/arch-rockchip/cru.h>
|
|
|
|
#include <asm/arch-rockchip/hardware.h>
|
|
|
|
#include <linux/err.h>
|
|
|
|
|
2020-07-21 15:06:03 +00:00
|
|
|
char *get_reset_cause(void)
|
2020-01-09 08:52:18 +00:00
|
|
|
{
|
|
|
|
struct rockchip_cru *cru = rockchip_get_cru();
|
|
|
|
char *cause = NULL;
|
|
|
|
|
|
|
|
if (IS_ERR(cru))
|
|
|
|
return cause;
|
|
|
|
|
|
|
|
switch (cru->glb_rst_st) {
|
|
|
|
case GLB_POR_RST:
|
|
|
|
cause = "POR";
|
|
|
|
break;
|
|
|
|
case FST_GLB_RST_ST:
|
|
|
|
case SND_GLB_RST_ST:
|
|
|
|
cause = "RST";
|
|
|
|
break;
|
|
|
|
case FST_GLB_TSADC_RST_ST:
|
|
|
|
case SND_GLB_TSADC_RST_ST:
|
|
|
|
cause = "THERMAL";
|
|
|
|
break;
|
|
|
|
case FST_GLB_WDT_RST_ST:
|
|
|
|
case SND_GLB_WDT_RST_ST:
|
|
|
|
cause = "WDOG";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
cause = "unknown reset";
|
|
|
|
}
|
|
|
|
|
|
|
|
return cause;
|
|
|
|
}
|
2020-01-09 08:52:15 +00:00
|
|
|
|
2020-07-21 15:06:03 +00:00
|
|
|
#if CONFIG_IS_ENABLED(DISPLAY_CPUINFO)
|
2020-01-09 08:52:15 +00:00
|
|
|
int print_cpuinfo(void)
|
|
|
|
{
|
2020-07-21 15:06:03 +00:00
|
|
|
char *cause = get_reset_cause();
|
|
|
|
|
2020-01-09 08:52:15 +00:00
|
|
|
printf("SoC: Rockchip %s\n", CONFIG_SYS_SOC);
|
2020-07-21 15:06:03 +00:00
|
|
|
printf("Reset cause: %s\n", cause);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* reset_reason env is used by rk3288, due to special use case
|
|
|
|
* to figure it the boot behavior. so keep this as it is.
|
|
|
|
*/
|
|
|
|
env_set("reset_reason", cause);
|
2020-01-09 08:52:15 +00:00
|
|
|
|
|
|
|
/* TODO print operating temparature and clock */
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2020-07-21 15:06:03 +00:00
|
|
|
#endif
|