1// SPDX-License-Identifier: (GPL-2.0+ OR MIT) 2/* 3 * (C) Copyright 2019 Amarula Solutions(India) 4 * Author: Jagan Teki <jagan@amarulasolutions.com> 5 */ 6 7#include <common.h> 8#include <env.h> 9#include <init.h> 10#include <asm/arch-rockchip/clock.h> 11#include <asm/arch-rockchip/cru.h> 12#include <asm/arch-rockchip/hardware.h> 13#include <linux/err.h> 14 15char *get_reset_cause(void) 16{ 17 struct rockchip_cru *cru = rockchip_get_cru(); 18 char *cause = NULL; 19 20 if (IS_ERR(cru)) 21 return cause; 22 23 switch (cru->glb_rst_st) { 24 case GLB_POR_RST: 25 cause = "POR"; 26 break; 27 case FST_GLB_RST_ST: 28 case SND_GLB_RST_ST: 29 cause = "RST"; 30 break; 31 case FST_GLB_TSADC_RST_ST: 32 case SND_GLB_TSADC_RST_ST: 33 cause = "THERMAL"; 34 break; 35 case FST_GLB_WDT_RST_ST: 36 case SND_GLB_WDT_RST_ST: 37 cause = "WDOG"; 38 break; 39 default: 40 cause = "unknown reset"; 41 } 42 43 return cause; 44} 45 46#if IS_ENABLED(CONFIG_DISPLAY_CPUINFO) 47int print_cpuinfo(void) 48{ 49 char *cause = get_reset_cause(); 50 51 printf("SoC: Rockchip %s\n", CONFIG_SYS_SOC); 52 printf("Reset cause: %s\n", cause); 53 54 /** 55 * reset_reason env is used by rk3288, due to special use case 56 * to figure it the boot behavior. so keep this as it is. 57 */ 58 env_set("reset_reason", cause); 59 60 /* TODO print operating temparature and clock */ 61 62 return 0; 63} 64#endif 65