diff mbox

[U-Boot,2/4] omap3: Use a define for reboot reason offset

Message ID 1456597604-10981-3-git-send-email-contact@paulk.fr
State Accepted
Commit 90ca5dfec4406bd0d6759395d8d24cb401be2c28
Delegated to: Tom Rini
Headers show

Commit Message

Paul Kocialkowski Feb. 27, 2016, 6:26 p.m. UTC
This introduces a define for the offset to the reboot reason, rather than
hardcoding it.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
---
 arch/arm/cpu/armv7/omap3/boot.c        | 8 +++++---
 arch/arm/include/asm/arch-omap3/omap.h | 2 ++
 2 files changed, 7 insertions(+), 3 deletions(-)

Comments

Tom Rini March 15, 2016, 11:52 a.m. UTC | #1
On Sat, Feb 27, 2016 at 07:26:42PM +0100, Paul Kocialkowski wrote:

> This introduces a define for the offset to the reboot reason, rather than
> hardcoding it.
> 
> Signed-off-by: Paul Kocialkowski <contact@paulk.fr>

Reviewed-by: Tom Rini <trini@konsulko.com>
Tom Rini March 17, 2016, 1:57 a.m. UTC | #2
On Sat, Feb 27, 2016 at 07:26:42PM +0100, Paul Kocialkowski wrote:

> This introduces a define for the offset to the reboot reason, rather than
> hardcoding it.
> 
> Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/arch/arm/cpu/armv7/omap3/boot.c b/arch/arm/cpu/armv7/omap3/boot.c
index 259c210..64b242b 100644
--- a/arch/arm/cpu/armv7/omap3/boot.c
+++ b/arch/arm/cpu/armv7/omap3/boot.c
@@ -65,7 +65,8 @@  int omap_reboot_mode(char *mode, unsigned int length)
 	if (length < 2)
 		return -1;
 
-	reboot_mode = readl((u32 *)(OMAP34XX_SCRATCHPAD + 4));
+	reboot_mode = readl((u32 *)(OMAP34XX_SCRATCHPAD +
+		OMAP_REBOOT_REASON_OFFSET));
 
 	c = (reboot_mode >> 24) & 0xff;
 	if (c != 'B')
@@ -85,7 +86,7 @@  int omap_reboot_mode(char *mode, unsigned int length)
 
 int omap_reboot_mode_clear(void)
 {
-	writel(0, (u32 *)(OMAP34XX_SCRATCHPAD + 4));
+	writel(0, (u32 *)(OMAP34XX_SCRATCHPAD + OMAP_REBOOT_REASON_OFFSET));
 
 	return 0;
 }
@@ -96,7 +97,8 @@  int omap_reboot_mode_store(char *mode)
 
 	reboot_mode = 'B' << 24 | 'M' << 16 | mode[0];
 
-	writel(reboot_mode, (u32 *)(OMAP34XX_SCRATCHPAD + 4));
+	writel(reboot_mode, (u32 *)(OMAP34XX_SCRATCHPAD +
+		OMAP_REBOOT_REASON_OFFSET));
 
 	return 0;
 }
diff --git a/arch/arm/include/asm/arch-omap3/omap.h b/arch/arm/include/asm/arch-omap3/omap.h
index 4044b8d..bc0e02a 100644
--- a/arch/arm/include/asm/arch-omap3/omap.h
+++ b/arch/arm/include/asm/arch-omap3/omap.h
@@ -249,6 +249,8 @@  struct gpio {
 /* ABB tranxdone mask */
 #define OMAP_ABB_MPU_TXDONE_MASK	(0x1 << 26)
 
+#define OMAP_REBOOT_REASON_OFFSET	0x04
+
 /* Boot parameters */
 #ifndef __ASSEMBLY__
 struct omap_boot_parameters {