diff options
author | Ji Luo <ji.luo@nxp.com> | 2018-09-10 18:44:31 +0800 |
---|---|---|
committer | Ji Luo <ji.luo@nxp.com> | 2018-09-11 12:19:40 +0800 |
commit | 02b8787d0dc66aebbf395c4707c795ed8a42c5ff (patch) | |
tree | e309b95093c121c14c530063875e5e602ff40b4e /arch | |
parent | 225fa189faa518a334729d01176bc966e0259b8d (diff) |
MA-12335 Canonical Boot Reason in Android Pie 9.0
Read boot reason from SRC(system reset controller) and report
it to kernel by "androidboot.bootreason=<>" kernel commandline.
This is enabled on imx6/7/7ulp/8m, imx8 will report default value
"androidboot.bootreason=reboot" since it can't get such info on
A core at u-boot stage.
Test: Boot reason report ok on imx6qp/imx7ulp/imx8qxp.
Change-Id: I03effaa03bc513bec6153e82c1a04e29c07e7db8
Signed-off-by: Ji Luo <ji.luo@nxp.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-imx/cpu.c | 16 | ||||
-rw-r--r-- | arch/arm/mach-imx/mx7ulp/soc.c | 16 |
2 files changed, 32 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/cpu.c b/arch/arm/mach-imx/cpu.c index 3f19f7e4e5..67db961ea6 100644 --- a/arch/arm/mach-imx/cpu.c +++ b/arch/arm/mach-imx/cpu.c @@ -43,7 +43,12 @@ static char *get_reset_cause(void) struct src *src_regs = (struct src *)SRC_BASE_ADDR; cause = readl(&src_regs->srsr); +#ifndef CONFIG_ANDROID_BOOT_IMAGE + /* We will read the ssrs states later for android so we don't + * clear the states here. + */ writel(cause, &src_regs->srsr); +#endif reset_cause = cause; switch (cause) { @@ -87,6 +92,17 @@ static char *get_reset_cause(void) } } +#ifdef CONFIG_ANDROID_BOOT_IMAGE +void get_reboot_reason(char *ret) +{ + struct src *src_regs = (struct src *)SRC_BASE_ADDR; + + strcpy(ret, (char *)get_reset_cause()); + /* clear the srsr here, its state has been recorded in reset_cause */ + writel(reset_cause, &src_regs->srsr); +} +#endif + u32 get_imx_reset_cause(void) { return reset_cause; diff --git a/arch/arm/mach-imx/mx7ulp/soc.c b/arch/arm/mach-imx/mx7ulp/soc.c index 81ce576334..10b2e18978 100644 --- a/arch/arm/mach-imx/mx7ulp/soc.c +++ b/arch/arm/mach-imx/mx7ulp/soc.c @@ -252,7 +252,12 @@ static char *get_reset_cause(char *ret) srs = readl(reg_srs); cause1 = readl(reg_ssrs); +#ifndef CONFIG_ANDROID_BOOT_IMAGE + /* We will read the ssrs states later for android so we don't + * clear the states here. + */ writel(cause1, reg_ssrs); +#endif reset_cause = cause1; @@ -292,6 +297,17 @@ static char *get_reset_cause(char *ret) return ret; } +#ifdef CONFIG_ANDROID_BOOT_IMAGE +void get_reboot_reason(char *ret) +{ + u32 *reg_ssrs = (u32 *)(SRC_BASE_ADDR + 0x28); + + get_reset_cause(ret); + /* clear the ssrs here, its state has been recorded in reset_cause */ + writel(reset_cause, reg_ssrs); +} +#endif + void arch_preboot_os(void) { #if defined(CONFIG_VIDEO_MXS) |