From c5412b084bf95781c54463570f96059a1d99d363 Mon Sep 17 00:00:00 2001 From: Paul Kocialkowski Date: Sat, 27 Feb 2016 19:26:41 +0100 Subject: omap3: String-based reboot mode handling This switches reboot mode handling to a string-based interface, that allows more flexibility to set a common interface with the next generations of OMAP devices. Signed-off-by: Paul Kocialkowski Reviewed-by: Tom Rini --- arch/arm/cpu/armv7/omap3/boot.c | 14 ++++++++++---- arch/arm/include/asm/arch-omap3/omap.h | 4 ++-- 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'arch/arm') diff --git a/arch/arm/cpu/armv7/omap3/boot.c b/arch/arm/cpu/armv7/omap3/boot.c index 44d7c30662..259c210015 100644 --- a/arch/arm/cpu/armv7/omap3/boot.c +++ b/arch/arm/cpu/armv7/omap3/boot.c @@ -57,11 +57,14 @@ u32 omap_sys_boot_device(void) return boot_devices[sys_boot]; } -char omap_reboot_mode(void) +int omap_reboot_mode(char *mode, unsigned int length) { u32 reboot_mode; char c; + if (length < 2) + return -1; + reboot_mode = readl((u32 *)(OMAP34XX_SCRATCHPAD + 4)); c = (reboot_mode >> 24) & 0xff; @@ -74,7 +77,10 @@ char omap_reboot_mode(void) c = reboot_mode & 0xff; - return c; + mode[0] = c; + mode[1] = '\0'; + + return 0; } int omap_reboot_mode_clear(void) @@ -84,11 +90,11 @@ int omap_reboot_mode_clear(void) return 0; } -int omap_reboot_mode_store(char c) +int omap_reboot_mode_store(char *mode) { u32 reboot_mode; - reboot_mode = 'B' << 24 | 'M' << 16 | c; + reboot_mode = 'B' << 24 | 'M' << 16 | mode[0]; writel(reboot_mode, (u32 *)(OMAP34XX_SCRATCHPAD + 4)); diff --git a/arch/arm/include/asm/arch-omap3/omap.h b/arch/arm/include/asm/arch-omap3/omap.h index 2c94a814ef..4044b8d725 100644 --- a/arch/arm/include/asm/arch-omap3/omap.h +++ b/arch/arm/include/asm/arch-omap3/omap.h @@ -260,9 +260,9 @@ struct omap_boot_parameters { unsigned int boot_device_descriptor; }; -char omap_reboot_mode(void); +int omap_reboot_mode(char *mode, unsigned int length); int omap_reboot_mode_clear(void); -int omap_reboot_mode_store(char c); +int omap_reboot_mode_store(char *mode); #endif #endif -- cgit v1.2.1