summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorJagan Teki <jagan@amarulasolutions.com>2020-07-21 20:36:03 +0530
committerKever Yang <kever.yang@rock-chips.com>2020-07-22 20:55:13 +0800
commite230c579a3f6a325fa1624ed9a3df445096674bb (patch)
tree1a18bc60e7daab3d10b7eb1c1856728aa58d4ce6 /arch
parent88132e0a280adc120642f05f140aa77fd7e52611 (diff)
rockchip: Separate the reset cause from display cpuinfo
reset cause is a generic functionality based on the soc cru registers in rockchip. This can be used for printing the cause of reset in cpuinfo or some other place where reset cause is needed.  Other than cpuinfo, reset cause can also be using during bootcount for checking the specific reset cause and glow the led based on the reset cause. So, let's separate the reset cause code from cpuinfo, and add a check to build it for rk3399, rk3288 since these two soc are supporting reset cause as of now. Tested-by: Suniel Mahesh <sunil@amarulasolutions.com> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/include/asm/arch-rockchip/cru.h2
-rw-r--r--arch/arm/mach-rockchip/Makefile5
-rw-r--r--arch/arm/mach-rockchip/cpu-info.c20
3 files changed, 18 insertions, 9 deletions
diff --git a/arch/arm/include/asm/arch-rockchip/cru.h b/arch/arm/include/asm/arch-rockchip/cru.h
index d2057cb738..13ea4aba8e 100644
--- a/arch/arm/include/asm/arch-rockchip/cru.h
+++ b/arch/arm/include/asm/arch-rockchip/cru.h
@@ -30,4 +30,6 @@ enum {
#define MHz 1000000
+char *get_reset_cause(void);
+
#endif /* _ROCKCHIP_CLOCK_H */
diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile
index 5b38526fe0..121f23a563 100644
--- a/arch/arm/mach-rockchip/Makefile
+++ b/arch/arm/mach-rockchip/Makefile
@@ -22,11 +22,14 @@ ifeq ($(CONFIG_SPL_BUILD)$(CONFIG_TPL_BUILD),)
# we can have the preprocessor correctly recognise both 0x0 and 0
# meaning "turn it off".
obj-y += boot_mode.o
-obj-$(CONFIG_DISPLAY_CPUINFO) += cpu-info.o
obj-$(CONFIG_ROCKCHIP_COMMON_BOARD) += board.o
obj-$(CONFIG_MISC_INIT_R) += misc.o
endif
+ifeq ($(CONFIG_TPL_BUILD),)
+obj-$(CONFIG_DISPLAY_CPUINFO) += cpu-info.o
+endif
+
obj-$(CONFIG_$(SPL_TPL_)RAM) += sdram.o
obj-$(CONFIG_ROCKCHIP_PX30) += px30/
diff --git a/arch/arm/mach-rockchip/cpu-info.c b/arch/arm/mach-rockchip/cpu-info.c
index bb5a198039..d0f030109f 100644
--- a/arch/arm/mach-rockchip/cpu-info.c
+++ b/arch/arm/mach-rockchip/cpu-info.c
@@ -13,7 +13,7 @@
#include <asm/arch-rockchip/hardware.h>
#include <linux/err.h>
-static char *get_reset_cause(void)
+char *get_reset_cause(void)
{
struct rockchip_cru *cru = rockchip_get_cru();
char *cause = NULL;
@@ -41,21 +41,25 @@ static char *get_reset_cause(void)
cause = "unknown reset";
}
- /**
- * 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);
-
return cause;
}
+#if CONFIG_IS_ENABLED(DISPLAY_CPUINFO)
int print_cpuinfo(void)
{
+ char *cause = get_reset_cause();
+
printf("SoC: Rockchip %s\n", CONFIG_SYS_SOC);
- printf("Reset cause: %s\n", get_reset_cause());
+ 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);
/* TODO print operating temparature and clock */
return 0;
}
+#endif