From patchwork Sat Feb 27 18:26:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Kocialkowski X-Patchwork-Id: 589442 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 9BE581401C7 for ; Sun, 28 Feb 2016 05:26:56 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id BA9CBA7857; Sat, 27 Feb 2016 19:26:54 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id p8aJGm1tANtW; Sat, 27 Feb 2016 19:26:54 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 227D5A7835; Sat, 27 Feb 2016 19:26:53 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 61E27A74E3 for ; Sat, 27 Feb 2016 19:26:46 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id URo0n1KkElPO for ; Sat, 27 Feb 2016 19:26:46 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from gagarine.paulk.fr (gagarine.paulk.fr [109.190.93.129]) by theia.denx.de (Postfix) with ESMTPS id 0FFC0A74D6 for ; Sat, 27 Feb 2016 19:26:44 +0100 (CET) Received: by gagarine.paulk.fr (Postfix, from userid 65534) id AC97820327; Sat, 27 Feb 2016 19:26:43 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on gagarine.paulk.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from armstrong.paulk.fr (armstrong.paulk.fr [82.233.88.171]) by gagarine.paulk.fr (Postfix) with ESMTPS id 1EA8820327; Sat, 27 Feb 2016 19:26:39 +0100 (CET) Received: from localhost.localdomain (aldrin [192.168.0.128]) by armstrong.paulk.fr (Postfix) with ESMTP id 1B5DC37707; Sat, 27 Feb 2016 19:26:38 +0100 (CET) From: Paul Kocialkowski To: u-boot@lists.denx.de Date: Sat, 27 Feb 2016 19:26:41 +0100 Message-Id: <1456597604-10981-2-git-send-email-contact@paulk.fr> X-Mailer: git-send-email 2.6.4 In-Reply-To: <1456597604-10981-1-git-send-email-contact@paulk.fr> References: <1456597604-10981-1-git-send-email-contact@paulk.fr> Cc: Tom Rini Subject: [U-Boot] [PATCH 1/4] omap3: String-based reboot mode handling X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" 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 ++-- board/lge/sniper/sniper.c | 6 +++--- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/arch/arm/cpu/armv7/omap3/boot.c b/arch/arm/cpu/armv7/omap3/boot.c index 44d7c30..259c210 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 2c94a81..4044b8d 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 diff --git a/board/lge/sniper/sniper.c b/board/lge/sniper/sniper.c index f093f97..b2c8e97 100644 --- a/board/lge/sniper/sniper.c +++ b/board/lge/sniper/sniper.c @@ -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