Skip to contentSkip to conversation

MX51: mx51evk: Use struct to access SRSR register instead of offset

PATCH New Fabio Estevam 2 participants 2 messages Apr 13, 2011

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 MX51: mx51evk: Use struct to access SRSR register instead of offset

Use struct to access SRSR register instead of offset. While at it mask the 7 bits of SRSR for correctness.

---
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(-)
board/freescale/mx51evk/mx51evk.c +5 -1
index 02a765d..ea45ece 100644
@@ -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;
Signature · 1 line
1.6.0.4
#1 lore raw

PATCH v2 1/1 MX51: mx51evk: Use struct to access SRSR register instead of offset

Hi Fabio,

Quoted 4 lines

Use struct to access SRSR register instead of offset. While at it mask the 7 bits of SRSR for correctness.

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

Signature · 7 lines
(7)  It is always something
(7a) (corollary). Good, Fast, Cheap: Pick any two (you can't have all three).
                                   -- The Twelve Networking Truths (RFC 1925)
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de