* [U-Boot] [PATCH] arm: vf610: improve evaluation of reset source
@ 2014-11-27 22:58 Stefan Agner
2014-12-01 9:39 ` Stefano Babic
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Agner @ 2014-11-27 22:58 UTC (permalink / raw)
To: u-boot
Improve the evaluation of the reset source. Bit description according
to latest reference manual rev. 7.
Signed-off-by: Stefan Agner <stefan@agner.ch>
---
arch/arm/cpu/armv7/vf610/generic.c | 21 +++++++++++----------
arch/arm/include/asm/arch-vf610/imx-regs.h | 8 ++++++++
2 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/arch/arm/cpu/armv7/vf610/generic.c b/arch/arm/cpu/armv7/vf610/generic.c
index a26d63e..92aaad9 100644
--- a/arch/arm/cpu/armv7/vf610/generic.c
+++ b/arch/arm/cpu/armv7/vf610/generic.c
@@ -265,20 +265,21 @@ static char *get_reset_cause(void)
cause = readl(&src_regs->srsr);
writel(cause, &src_regs->srsr);
- cause &= 0xff;
- switch (cause) {
- case 0x08:
- return "WDOG";
- case 0x20:
+ if (cause & SRC_SRSR_POR_RST)
+ return "POWER ON RESET";
+ else if (cause & SRC_SRSR_WDOG_A5)
+ return "WDOG A5";
+ else if (cause & SRC_SRSR_WDOG_M4)
+ return "WDOG M4";
+ else if (cause & SRC_SRSR_JTAG_RST)
return "JTAG HIGH-Z";
- case 0x80:
+ else if (cause & SRC_SRSR_SW_RST)
+ return "SW RESET";
+ else if (cause & SRC_SRSR_RESETB)
return "EXTERNAL RESET";
- case 0xfd:
- return "POR";
- default:
+ else
return "unknown reset";
- }
}
int print_cpuinfo(void)
diff --git a/arch/arm/include/asm/arch-vf610/imx-regs.h b/arch/arm/include/asm/arch-vf610/imx-regs.h
index 9d797db..6b10bdf 100644
--- a/arch/arm/include/asm/arch-vf610/imx-regs.h
+++ b/arch/arm/include/asm/arch-vf610/imx-regs.h
@@ -256,6 +256,14 @@
#define DDRMC_CR161_TODTH_RD(v) (((v) & 0xf) << 8)
#define DDRMC_CR161_TODTH_WR(v) ((v) & 0xf)
+/* System Reset Controller (SRC) */
+#define SRC_SRSR_SW_RST (0x1 << 18)
+#define SRC_SRSR_RESETB (0x1 << 7)
+#define SRC_SRSR_JTAG_RST (0x1 << 5)
+#define SRC_SRSR_WDOG_M4 (0x1 << 4)
+#define SRC_SRSR_WDOG_A5 (0x1 << 3)
+#define SRC_SRSR_POR_RST (0x1 << 0)
+
#if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__))
#include <asm/types.h>
--
2.1.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [U-Boot] [PATCH] arm: vf610: improve evaluation of reset source
2014-11-27 22:58 [U-Boot] [PATCH] arm: vf610: improve evaluation of reset source Stefan Agner
@ 2014-12-01 9:39 ` Stefano Babic
0 siblings, 0 replies; 2+ messages in thread
From: Stefano Babic @ 2014-12-01 9:39 UTC (permalink / raw)
To: u-boot
On 27/11/2014 23:58, Stefan Agner wrote:
> Improve the evaluation of the reset source. Bit description according
> to latest reference manual rev. 7.
>
> Signed-off-by: Stefan Agner <stefan@agner.ch>
> ---
> arch/arm/cpu/armv7/vf610/generic.c | 21 +++++++++++----------
> arch/arm/include/asm/arch-vf610/imx-regs.h | 8 ++++++++
> 2 files changed, 19 insertions(+), 10 deletions(-)
>
> diff --git a/arch/arm/cpu/armv7/vf610/generic.c b/arch/arm/cpu/armv7/vf610/generic.c
> index a26d63e..92aaad9 100644
> --- a/arch/arm/cpu/armv7/vf610/generic.c
> +++ b/arch/arm/cpu/armv7/vf610/generic.c
> @@ -265,20 +265,21 @@ static char *get_reset_cause(void)
>
> cause = readl(&src_regs->srsr);
> writel(cause, &src_regs->srsr);
> - cause &= 0xff;
>
> - switch (cause) {
> - case 0x08:
> - return "WDOG";
> - case 0x20:
> + if (cause & SRC_SRSR_POR_RST)
> + return "POWER ON RESET";
> + else if (cause & SRC_SRSR_WDOG_A5)
> + return "WDOG A5";
> + else if (cause & SRC_SRSR_WDOG_M4)
> + return "WDOG M4";
> + else if (cause & SRC_SRSR_JTAG_RST)
> return "JTAG HIGH-Z";
> - case 0x80:
> + else if (cause & SRC_SRSR_SW_RST)
> + return "SW RESET";
> + else if (cause & SRC_SRSR_RESETB)
> return "EXTERNAL RESET";
> - case 0xfd:
> - return "POR";
> - default:
> + else
> return "unknown reset";
> - }
> }
>
> int print_cpuinfo(void)
> diff --git a/arch/arm/include/asm/arch-vf610/imx-regs.h b/arch/arm/include/asm/arch-vf610/imx-regs.h
> index 9d797db..6b10bdf 100644
> --- a/arch/arm/include/asm/arch-vf610/imx-regs.h
> +++ b/arch/arm/include/asm/arch-vf610/imx-regs.h
> @@ -256,6 +256,14 @@
> #define DDRMC_CR161_TODTH_RD(v) (((v) & 0xf) << 8)
> #define DDRMC_CR161_TODTH_WR(v) ((v) & 0xf)
>
> +/* System Reset Controller (SRC) */
> +#define SRC_SRSR_SW_RST (0x1 << 18)
> +#define SRC_SRSR_RESETB (0x1 << 7)
> +#define SRC_SRSR_JTAG_RST (0x1 << 5)
> +#define SRC_SRSR_WDOG_M4 (0x1 << 4)
> +#define SRC_SRSR_WDOG_A5 (0x1 << 3)
> +#define SRC_SRSR_POR_RST (0x1 << 0)
> +
> #if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__))
> #include <asm/types.h>
>
>
Applied to u-boot-imx, thanks !
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-12-01 9:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-27 22:58 [U-Boot] [PATCH] arm: vf610: improve evaluation of reset source Stefan Agner
2014-12-01 9:39 ` Stefano Babic
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox