| Submitter | Liu Hui-R64343 |
|---|---|
| Date | April 15, 2011, 5:30 p.m. |
| Message ID | <1302888624-14144-1-git-send-email-r64343@freescale.com> |
| Download | mbox | patch |
| Permalink | /patch/91425/ |
| State | Superseded |
| Delegated to: | Stefano Babic |
| Headers | show |
Comments
Hi, Stefano, 2011/4/16 Jason Liu <r64343@freescale.com>: > From: Liu Hui-R64343 <r64343@freescale.com> > > factor out boot cause funciton to common code to avoid > the duplicate code in each board support package > > Signed-off-by: Jason Liu <r64343@freescale.com> > --- > changes since v3: > - add full boot reset cause Ping, any comments? > 1.7.1 > > > _______________________________________________ > U-Boot mailing list > U-Boot@lists.denx.de > http://lists.denx.de/mailman/listinfo/u-boot >
Patch
diff --git a/arch/arm/cpu/armv7/mx5/soc.c b/arch/arm/cpu/armv7/mx5/soc.c index 09500b3..975864d 100644 --- a/arch/arm/cpu/armv7/mx5/soc.c +++ b/arch/arm/cpu/armv7/mx5/soc.c @@ -77,6 +77,33 @@ u32 get_cpu_rev(void) return system_rev; } +char *get_reset_cause(void) +{ + u32 cause; + struct src *src_regs = (struct src *)SRC_BASE_ADDR; + + cause = readl(&src_regs->srsr); + writel(cause, &src_regs->srsr); + + switch (cause) { + case 0x00001: + return "POR"; + case 0x00004: + return "CSU"; + case 0x00008: + return "IPP USER"; + case 0x00010: + return "WDOG"; + case 0x00020: + return "JTAG HIGH-Z"; + case 0x00040: + return "JTAG SW"; + case 0x10000: + return "WARM BOOT"; + default: + return "unknown reset"; + } +} #if defined(CONFIG_DISPLAY_CPUINFO) int print_cpuinfo(void) diff --git a/arch/arm/include/asm/arch-mx5/sys_proto.h b/arch/arm/include/asm/arch-mx5/sys_proto.h index f687503..00c2c5d 100644 --- a/arch/arm/include/asm/arch-mx5/sys_proto.h +++ b/arch/arm/include/asm/arch-mx5/sys_proto.h @@ -27,5 +27,6 @@ u32 get_cpu_rev(void); #define is_soc_rev(rev) ((get_cpu_rev() & 0xFF) - rev) void sdelay(unsigned long); +char *get_reset_cause(void); #endif