From: Jagan Teki <jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org> To: Kever Yang <kever.yang-TNX95d0MmH7DzftRWevZcw@public.gmane.org>, Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>, Philipp Tomsich <philipp.tomsich-SN7IsUiht6C/RdPyistoZJqQE7yCjDx5@public.gmane.org> Cc: Jagan Teki <jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org>, u-boot-0aAXYlwwYIKGBzrmiIFOJg@public.gmane.org, linux-amarula-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org, Akash Gajjar <akash-oRp2ZoJdM/RWk0Htik3J/w@public.gmane.org>, linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org Subject: [PATCH v2 04/16] rockchip: Add rk3399 reset cause Date: Mon, 26 Aug 2019 23:50:59 +0530 [thread overview] Message-ID: <20190826182111.30999-5-jagan@amarulasolutions.com> (raw) In-Reply-To: <20190826182111.30999-1-jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org> Add reset cause for rk3399 in common cpu-info file. This would help to print the reset cause for various resets. Common code for various rockchip reset cause will add it in future. Signed-off-by: Jagan Teki <jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org> --- arch/arm/include/asm/arch-rockchip/cru.h | 12 +++++++ arch/arm/mach-rockchip/cpu-info.c | 43 ++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/arch/arm/include/asm/arch-rockchip/cru.h b/arch/arm/include/asm/arch-rockchip/cru.h index 3d1927580f..e267a71ca6 100644 --- a/arch/arm/include/asm/arch-rockchip/cru.h +++ b/arch/arm/include/asm/arch-rockchip/cru.h @@ -11,4 +11,16 @@ # include <asm/arch-rockchip/cru_rk3399.h> #endif +/* CRU_GLB_RST_ST */ +enum { + GLB_POR_RST, + FST_GLB_RST_ST = BIT(0), + SND_GLB_RST_ST = BIT(1), + FST_GLB_TSADC_RST_ST = BIT(2), + SND_GLB_TSADC_RST_ST = BIT(3), + FST_GLB_WDT_RST_ST = BIT(4), + SND_GLB_WDT_RST_ST = BIT(5), + GLB_RST_ST_MASK = GENMASK(5, 0), +}; + #endif /* _ROCKCHIP_CLOCK_H */ diff --git a/arch/arm/mach-rockchip/cpu-info.c b/arch/arm/mach-rockchip/cpu-info.c index 90ce65d9ff..63d867fe78 100644 --- a/arch/arm/mach-rockchip/cpu-info.c +++ b/arch/arm/mach-rockchip/cpu-info.c @@ -5,10 +5,53 @@ */ #include <common.h> +#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> + +static char *get_reset_cause(void) +{ + 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"; + } + + /* + * Clear glb_rst_st, so we can determine the last reset cause + * for following resets. + */ + rk_clrreg(&cru->glb_rst_st, GLB_RST_ST_MASK); + + return cause; +} int print_cpuinfo(void) { printf("SoC: Rockchip %s\n", CONFIG_SYS_SOC); + printf("Reset cause: %s\n", get_reset_cause()); /* TODO print operating temparature and clock */ -- 2.18.0.321.gffc6fa0e3
WARNING: multiple messages have this Message-ID (diff)
From: Jagan Teki <jagan@amarulasolutions.com> To: u-boot@lists.denx.de Subject: [U-Boot] [PATCH v2 04/16] rockchip: Add rk3399 reset cause Date: Mon, 26 Aug 2019 23:50:59 +0530 [thread overview] Message-ID: <20190826182111.30999-5-jagan@amarulasolutions.com> (raw) In-Reply-To: <20190826182111.30999-1-jagan@amarulasolutions.com> Add reset cause for rk3399 in common cpu-info file. This would help to print the reset cause for various resets. Common code for various rockchip reset cause will add it in future. Signed-off-by: Jagan Teki <jagan@amarulasolutions.com> --- arch/arm/include/asm/arch-rockchip/cru.h | 12 +++++++ arch/arm/mach-rockchip/cpu-info.c | 43 ++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/arch/arm/include/asm/arch-rockchip/cru.h b/arch/arm/include/asm/arch-rockchip/cru.h index 3d1927580f..e267a71ca6 100644 --- a/arch/arm/include/asm/arch-rockchip/cru.h +++ b/arch/arm/include/asm/arch-rockchip/cru.h @@ -11,4 +11,16 @@ # include <asm/arch-rockchip/cru_rk3399.h> #endif +/* CRU_GLB_RST_ST */ +enum { + GLB_POR_RST, + FST_GLB_RST_ST = BIT(0), + SND_GLB_RST_ST = BIT(1), + FST_GLB_TSADC_RST_ST = BIT(2), + SND_GLB_TSADC_RST_ST = BIT(3), + FST_GLB_WDT_RST_ST = BIT(4), + SND_GLB_WDT_RST_ST = BIT(5), + GLB_RST_ST_MASK = GENMASK(5, 0), +}; + #endif /* _ROCKCHIP_CLOCK_H */ diff --git a/arch/arm/mach-rockchip/cpu-info.c b/arch/arm/mach-rockchip/cpu-info.c index 90ce65d9ff..63d867fe78 100644 --- a/arch/arm/mach-rockchip/cpu-info.c +++ b/arch/arm/mach-rockchip/cpu-info.c @@ -5,10 +5,53 @@ */ #include <common.h> +#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> + +static char *get_reset_cause(void) +{ + 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"; + } + + /* + * Clear glb_rst_st, so we can determine the last reset cause + * for following resets. + */ + rk_clrreg(&cru->glb_rst_st, GLB_RST_ST_MASK); + + return cause; +} int print_cpuinfo(void) { printf("SoC: Rockchip %s\n", CONFIG_SYS_SOC); + printf("Reset cause: %s\n", get_reset_cause()); /* TODO print operating temparature and clock */ -- 2.18.0.321.gffc6fa0e3
next prev parent reply other threads:[~2019-08-26 18:20 UTC|newest] Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-08-26 18:20 [PATCH v2 00/16] rk3399: Add redundant boot support Jagan Teki 2019-08-26 18:20 ` [U-Boot] " Jagan Teki [not found] ` <20190826182111.30999-1-jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org> 2019-08-26 18:20 ` [PATCH v2 01/16] rockchip: Add cpu-info Jagan Teki 2019-08-26 18:20 ` [U-Boot] " Jagan Teki 2019-09-02 8:33 ` Kever Yang 2019-09-02 8:33 ` [U-Boot] " Kever Yang 2019-08-26 18:20 ` [PATCH v2 02/16] rockchip: rk3288/rk3399: Enable DISPLAY_CPUINFO Jagan Teki 2019-08-26 18:20 ` [U-Boot] " Jagan Teki 2019-08-26 18:20 ` [PATCH v2 03/16] arm: rockchip: Add common cru.h Jagan Teki 2019-08-26 18:20 ` [U-Boot] " Jagan Teki 2019-08-26 18:20 ` Jagan Teki [this message] 2019-08-26 18:20 ` [U-Boot] [PATCH v2 04/16] rockchip: Add rk3399 reset cause Jagan Teki 2019-08-26 18:21 ` [PATCH v2 05/16] wdt: designware: Simplify is_enabled function Jagan Teki 2019-08-26 18:21 ` [U-Boot] " Jagan Teki 2019-08-26 18:21 ` [PATCH v2 06/16] wdt: designware: Simplify enable function Jagan Teki 2019-08-26 18:21 ` [U-Boot] " Jagan Teki 2019-08-26 18:21 ` [PATCH v2 07/16] wdt: dw: Add driver-model support Jagan Teki 2019-08-26 18:21 ` [U-Boot] " Jagan Teki 2019-08-26 18:21 ` [PATCH v2 08/16] wdt: dw: Rename to dw_wdt.c Jagan Teki 2019-08-26 18:21 ` [U-Boot] " Jagan Teki 2019-08-26 18:21 ` [PATCH v2 09/16] rockchip: dts: rk3399: Add u-boot, dm-pre-reloc for watchdog Jagan Teki 2019-08-26 18:21 ` [U-Boot] " Jagan Teki 2019-08-26 18:21 ` [PATCH v2 10/16] wdt: Kconfig: Add WDT_DW entry Jagan Teki 2019-08-26 18:21 ` [U-Boot] " Jagan Teki 2019-08-26 18:21 ` [PATCH v2 11/16] wdt: Kconfig: Add TPL_WDT entry Jagan Teki 2019-08-26 18:21 ` [U-Boot] " Jagan Teki 2019-08-26 18:21 ` [PATCH v2 12/16] spl: Add watchdog support fot TPL Jagan Teki 2019-08-26 18:21 ` [U-Boot] " Jagan Teki 2019-08-26 18:21 ` [PATCH v2 13/16] watchdog: Handle TPL build with watchdog disabled Jagan Teki 2019-08-26 18:21 ` [U-Boot] " Jagan Teki 2019-08-26 18:21 ` [DO NOT MERGE] [PATCH v2 14/16] rk3399: rockpro64: Enable watchdog Jagan Teki 2019-08-26 18:21 ` [U-Boot] " Jagan Teki 2019-08-26 18:21 ` [PATCH v2 15/16] rockchip: rk3399: Add bootcount support Jagan Teki 2019-08-26 18:21 ` [U-Boot] " Jagan Teki 2019-08-26 18:21 ` [DO NOT MERGE] [PATCH v2 16/16] rk3399: rockpro64: Enable bootcount Jagan Teki 2019-08-26 18:21 ` [U-Boot] " Jagan Teki
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190826182111.30999-5-jagan@amarulasolutions.com \ --to=jagan-dyjbcgdgk7pe9whmmfpqlfatqe2ktcn/@public.gmane.org \ --cc=akash-oRp2ZoJdM/RWk0Htik3J/w@public.gmane.org \ --cc=kever.yang-TNX95d0MmH7DzftRWevZcw@public.gmane.org \ --cc=linux-amarula-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org \ --cc=linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \ --cc=philipp.tomsich-SN7IsUiht6C/RdPyistoZJqQE7yCjDx5@public.gmane.org \ --cc=sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \ --cc=u-boot-0aAXYlwwYIKGBzrmiIFOJg@public.gmane.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.