From patchwork Tue Aug 25 15:40:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Kocialkowski X-Patchwork-Id: 510546 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 B0B4C1401EF for ; Wed, 26 Aug 2015 01:41:09 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4F8154B667; Tue, 25 Aug 2015 17:41:07 +0200 (CEST) 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 0l6wZJpMHxCq; Tue, 25 Aug 2015 17:41:07 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DAAAC4B65B; Tue, 25 Aug 2015 17:41:06 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5AD064B65B for ; Tue, 25 Aug 2015 17:41:04 +0200 (CEST) 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 7-tAOrPXNkjP for ; Tue, 25 Aug 2015 17:41:04 +0200 (CEST) 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 101354B65A for ; Tue, 25 Aug 2015 17:41:01 +0200 (CEST) Received: by gagarine.paulk.fr (Postfix, from userid 65534) id B27131FE90; Tue, 25 Aug 2015 17:41:00 +0200 (CEST) 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 localhost.localdomain (collins [192.168.1.129]) by gagarine.paulk.fr (Postfix) with ESMTP id 235221FE25; Tue, 25 Aug 2015 17:40:57 +0200 (CEST) From: Paul Kocialkowski To: u-boot@lists.denx.de Date: Tue, 25 Aug 2015 17:40:53 +0200 Message-Id: <1440517253-18394-1-git-send-email-contact@paulk.fr> X-Mailer: git-send-email 1.9.1 Cc: Marek Vasut , Tom Rini , Hannes Schmelzer Subject: [U-Boot] [PATCH] omap-common: SYS_BOOT fallback logic correction 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" The SYS_BOOT-based fallback shouldn't only check for one of the conditions of use and then let the switch/case handle each boot device without enforcing the conditions for each type of boot device again. For instance, this behaviour would trigger the fallback for UART when BOOT_DEVICE_UART is defined, CONFIG_SPL_YMODEM_SUPPORT is enabled (which should be a show-stopper) and e.g. BOOT_DEVICE_USB is enabled and not CONFIG_SPL_USB_SUPPORT. Separating the logic for USB and UART is a first step to solve this. In addition, a similar problematic behaviour took place when BOOT_DEVICE_USBETH, BOOT_DEVICE_USB and CONFIG_SPL_USBETH_SUPPORT were enabled and not CONFIG_SPL_USB_SUPPORT. Since BOOT_DEVICE_USBETH is only a problem when it's defined to the same value as BOOT_DEVICE_USB, we can check that BOOT_DEVICE_USBETH and BOOT_DEVICE_USB are different and if not, that CONFIG_SPL_USBETH_SUPPORT is not enabled to enable the SYS_BOOT-based fallback mechanism. Signed-off-by: Paul Kocialkowski Reviewed-by: Tom Rini --- arch/arm/cpu/armv7/omap-common/boot-common.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/arch/arm/cpu/armv7/omap-common/boot-common.c b/arch/arm/cpu/armv7/omap-common/boot-common.c index 5ec46fa..41f65c0 100644 --- a/arch/arm/cpu/armv7/omap-common/boot-common.c +++ b/arch/arm/cpu/armv7/omap-common/boot-common.c @@ -30,6 +30,7 @@ void save_omap_boot_params(void) { u32 boot_params = *((u32 *)OMAP_SRAM_SCRATCH_BOOT_PARAMS); struct omap_boot_parameters *omap_boot_params; + int sys_boot_device = 0; u32 boot_device; u32 boot_mode; @@ -64,31 +65,31 @@ void save_omap_boot_params(void) if (boot_device == BOOT_DEVICE_QSPI_4) boot_device = BOOT_DEVICE_SPI; #endif -#if (defined(BOOT_DEVICE_UART) && !defined(CONFIG_SPL_YMODEM_SUPPORT)) || \ - (defined(BOOT_DEVICE_USB) && !defined(CONFIG_SPL_USB_SUPPORT)) || \ - (defined(BOOT_DEVICE_USBETH) && !defined(CONFIG_SPL_USBETH_SUPPORT)) /* * When booting from peripheral booting, the boot device is not usable * as-is (unless there is support for it), so the boot device is instead * figured out using the SYS_BOOT pins. */ - switch (boot_device) { -#ifdef BOOT_DEVICE_UART - case BOOT_DEVICE_UART: +#if defined(BOOT_DEVICE_UART) && !defined(CONFIG_SPL_YMODEM_SUPPORT) + if (boot_device == BOOT_DEVICE_UART) + sys_boot_device = 1; #endif -#ifdef BOOT_DEVICE_USB - case BOOT_DEVICE_USB: +#if defined(BOOT_DEVICE_USB) && !defined(CONFIG_SPL_USB_SUPPORT) && \ + (!defined(BOOT_DEVICE_USBETH) || \ + ((BOOT_DEVICE_USBETH != BOOT_DEVICE_USB) || \ + !defined(CONFIG_SPL_USBETH_SUPPORT))) + if (boot_device == BOOT_DEVICE_USB) + sys_boot_device = 1; #endif + + if (sys_boot_device) { boot_device = omap_sys_boot_device(); /* MMC raw mode will fallback to FS mode. */ if ((boot_device >= MMC_BOOT_DEVICES_START) && (boot_device <= MMC_BOOT_DEVICES_END)) boot_mode = MMCSD_MODE_RAW; - - break; } -#endif gd->arch.omap_boot_device = boot_device;