omap3: String-based reboot mode handling
authorPaul Kocialkowski <contact@paulk.fr>
Sat, 27 Feb 2016 18:26:41 +0000 (19:26 +0100)
committerTom Rini <trini@konsulko.com>
Tue, 15 Mar 2016 19:10:47 +0000 (15:10 -0400)
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 <contact@paulk.fr>
Reviewed-by: Tom Rini <trini@konsulko.com>
arch/arm/cpu/armv7/omap3/boot.c
arch/arm/include/asm/arch-omap3/omap.h
board/lge/sniper/sniper.c

index 44d7c30..259c210 100644 (file)
@@ -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));
 
index 2c94a81..4044b8d 100644 (file)
@@ -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
index f093f97..b2c8e97 100644 (file)
@@ -109,7 +109,7 @@ int misc_init_r(void)
 
        /* Reboot mode */
 
-       reboot_mode[0] = omap_reboot_mode();
+       omap_reboot_mode(reboot_mode, sizeof(reboot_mode));
 
        if (keys[0])
                reboot_mode[0] = 'r';
@@ -159,12 +159,12 @@ void get_board_serial(struct tag_serialnr *serialnr)
 
 void reset_misc(void)
 {
-       omap_reboot_mode_store('u');
+       omap_reboot_mode_store("u");
 }
 
 int fb_set_reboot_flag(void)
 {
-       return omap_reboot_mode_store('b');
+       return omap_reboot_mode_store("b");
 }
 
 #ifndef CONFIG_SPL_BUILD