Patchwork [U-Boot,v2] MX51: mx51evk: Use struct to access SRSR register instead of offset

login
register
mail settings
Submitter Fabio Estevam
Date April 13, 2011, 3:36 a.m.
Message ID <1302665771-13658-1-git-send-email-festevam@gmail.com>
Download mbox | patch
Permalink /patch/90939/
State Changes Requested
Headers show

Comments

Fabio Estevam - April 13, 2011, 3:36 a.m.
Use struct to access SRSR register instead of offset. While at it mask 
the 7 bits of SRSR for correctness.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
Changes since v1:
- Use readl to read the srsr register
- Mask the lower 7 bits of the SRSR register for
getting the correct result.

 board/freescale/mx51evk/mx51evk.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
Detlev Zundel - April 13, 2011, 11:48 a.m.
Hi Fabio,

> Use struct to access SRSR register instead of offset. While at it mask 
> the 7 bits of SRSR for correctness.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

The SRSR is a MX51 register and thus not board specific.  Can we please
move this reset cause detection into common mx51 code so other boards
will profit from it also?

Thanks
  Detlev

Patch

diff --git a/board/freescale/mx51evk/mx51evk.c b/board/freescale/mx51evk/mx51evk.c
index 02a765d..ea45ece 100644
--- a/board/freescale/mx51evk/mx51evk.c
+++ b/board/freescale/mx51evk/mx51evk.c
@@ -431,6 +431,10 @@  int board_late_init(void)
 
 int checkboard(void)
 {
+	u32 reset;
+	struct src *src_regs = (struct src *)SRC_BASE_ADDR;
+	reset = readl(&src_regs->srsr);
+
 	puts("Board: MX51EVK ");
 
 	switch (system_rev & 0xff) {
@@ -452,7 +456,7 @@  int checkboard(void)
 		break;
 	}
 
-	switch (__raw_readl(SRC_BASE_ADDR + 0x8)) {
+	switch (reset & 0x7F) {
 	case 0x0001:
 		puts("POR");
 		break;