From patchwork Wed Oct 28 09:23:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikita Kiryanov X-Patchwork-Id: 537271 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 E1808140DAE for ; Wed, 28 Oct 2015 20:24:24 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=compulab.co.il header.i=@compulab.co.il header.b=oPretFtX; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 485BC4B69E; Wed, 28 Oct 2015 10:24:22 +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 g52RoRjGZhj6; Wed, 28 Oct 2015 10:24:22 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0D2FE4B6AD; Wed, 28 Oct 2015 10:23:53 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DA0EF4B62A for ; Wed, 28 Oct 2015 10:23:40 +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 GZXpzAdn6rVE for ; Wed, 28 Oct 2015 10:23:40 +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 compulab.co.il (softlayer.compulab.co.il [50.23.254.55]) by theia.denx.de (Postfix) with ESMTPS id 6E3C64B622 for ; Wed, 28 Oct 2015 10:23:38 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=compulab.co.il; s=default; h=References:In-Reply-To:Message-Id:Date:Subject :Cc:To:From; bh=YcVusGB6FWgFCR4R9Yk/ge1kjfqrot9v6Faw8It/6+0=; b=oPretFtXZ++Ma 5kbR3S9OS88M5JS9LV5VTKx7EuR/A2Ceto4LGERaZh6WuX1pdwJQOVaiTqGdE0fKM1HmQqcPDo/w0 Z1vbsdDh+J9xDa7u10ZtZT8K+L9CyrBN5BBmywhJnkQOTkJS143fHkyutf071s8SaDE8QRENrT3b8 TKR4=; Received: from [62.90.235.247] (port=34873 helo=zimbra-mta.compulab.co.il) by softlayer.compulab.co.il with esmtp (Exim 4.86) (envelope-from ) id 1ZrMxD-0006Sx-Tt; Wed, 28 Oct 2015 11:23:36 +0200 Received: from localhost (localhost [127.0.0.1]) by zimbra-mta.compulab.co.il (Postfix) with ESMTP id EBDD8487002; Wed, 28 Oct 2015 11:23:34 +0200 (IST) Received: from zimbra-mta.compulab.co.il ([127.0.0.1]) by localhost (zimbra-mta.compulab.co.il [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id BKkUbUnqkXT3; Wed, 28 Oct 2015 11:23:34 +0200 (IST) Received: from localhost (localhost [127.0.0.1]) by zimbra-mta.compulab.co.il (Postfix) with ESMTP id 05E5848700C; Wed, 28 Oct 2015 11:23:34 +0200 (IST) X-Virus-Scanned: amavisd-new at zimbra-mta.compulab.co.il Received: from zimbra-mta.compulab.co.il ([127.0.0.1]) by localhost (zimbra-mta.compulab.co.il [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id z9BZ1w6tVCzN; Wed, 28 Oct 2015 11:23:33 +0200 (IST) Received: from skynet.compulab.local (nikita-pc.compulab.local [192.168.11.211]) by zimbra-mta.compulab.co.il (Postfix) with ESMTP id DD362487006; Wed, 28 Oct 2015 11:23:33 +0200 (IST) From: Nikita Kiryanov To: u-boot@lists.denx.de Date: Wed, 28 Oct 2015 11:23:23 +0200 Message-Id: <1446024210-16517-7-git-send-email-nikita@compulab.co.il> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1446024210-16517-1-git-send-email-nikita@compulab.co.il> References: <1446024210-16517-1-git-send-email-nikita@compulab.co.il> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - softlayer.compulab.co.il X-AntiAbuse: Original Domain - lists.denx.de X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - compulab.co.il X-Get-Message-Sender-Via: softlayer.compulab.co.il: acl_c_recent_authed_mail_ips_text_entry: nikita@compulab.co.il|compulab.co.il X-Authenticated-Sender: softlayer.compulab.co.il: nikita@compulab.co.il Cc: Tom Rini , Pantelis Antoniou Subject: [U-Boot] [PATCH V2 06/13] spl: mmc: move fs boot into its own function 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" Move the code that handles fs boot out of spl_mmc_load_image() and into its own function to reduce the #ifdef complexit of spl_mmc_load_image(). No functional changes. Signed-off-by: Nikita Kiryanov Cc: Igor Grinberg Cc: Paul Kocialkowski Cc: Pantelis Antoniou Cc: Tom Rini Cc: Simon Glass Reviewed-by: Simon Glass Reviewed-by: Tom Rini --- Changes in V2: - No changes. common/spl/spl_mmc.c | 81 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 51 insertions(+), 30 deletions(-) diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index 5d67952..08aa4ae 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -171,6 +171,55 @@ static int mmc_load_image_raw_os(struct mmc *mmc) } #endif +#ifdef CONFIG_SYS_MMCSD_FS_BOOT_PARTITION +int spl_mmc_do_fs_boot(struct mmc *mmc) +{ + int err = -ENOSYS; + +#ifdef CONFIG_SPL_FAT_SUPPORT + if (!spl_start_uboot()) { + err = spl_load_image_fat_os(&mmc->block_dev, + CONFIG_SYS_MMCSD_FS_BOOT_PARTITION); + if (!err) + return err; + } +#ifdef CONFIG_SPL_FS_LOAD_PAYLOAD_NAME + err = spl_load_image_fat(&mmc->block_dev, + CONFIG_SYS_MMCSD_FS_BOOT_PARTITION, + CONFIG_SPL_FS_LOAD_PAYLOAD_NAME); + if (!err) + return err; +#endif +#endif +#ifdef CONFIG_SPL_EXT_SUPPORT + if (!spl_start_uboot()) { + err = spl_load_image_ext_os(&mmc->block_dev, + CONFIG_SYS_MMCSD_FS_BOOT_PARTITION); + if (!err) + return err; + } +#ifdef CONFIG_SPL_FS_LOAD_PAYLOAD_NAME + err = spl_load_image_ext(&mmc->block_dev, + CONFIG_SYS_MMCSD_FS_BOOT_PARTITION, + CONFIG_SPL_FS_LOAD_PAYLOAD_NAME); + if (!err) + return err; +#endif +#endif + +#if defined(CONFIG_SPL_FAT_SUPPORT) || defined(CONFIG_SPL_EXT_SUPPORT) + err = -ENOENT; +#endif + + return err; +} +#else +int spl_mmc_do_fs_boot(struct mmc *mmc) +{ + return -ENOSYS; +} +#endif + void spl_mmc_load_image(void) { struct mmc *mmc; @@ -214,38 +263,10 @@ void spl_mmc_load_image(void) case MMCSD_MODE_FS: debug("spl: mmc boot mode: fs\n"); -#ifdef CONFIG_SYS_MMCSD_FS_BOOT_PARTITION -#ifdef CONFIG_SPL_FAT_SUPPORT - if (!spl_start_uboot()) { - err = spl_load_image_fat_os(&mmc->block_dev, - CONFIG_SYS_MMCSD_FS_BOOT_PARTITION); - if (!err) - return; - } -#ifdef CONFIG_SPL_FS_LOAD_PAYLOAD_NAME - err = spl_load_image_fat(&mmc->block_dev, - CONFIG_SYS_MMCSD_FS_BOOT_PARTITION, - CONFIG_SPL_FS_LOAD_PAYLOAD_NAME); - if (!err) - return; -#endif -#endif -#ifdef CONFIG_SPL_EXT_SUPPORT - if (!spl_start_uboot()) { - err = spl_load_image_ext_os(&mmc->block_dev, - CONFIG_SYS_MMCSD_FS_BOOT_PARTITION); - if (!err) - return; - } -#ifdef CONFIG_SPL_FS_LOAD_PAYLOAD_NAME - err = spl_load_image_ext(&mmc->block_dev, - CONFIG_SYS_MMCSD_FS_BOOT_PARTITION, - CONFIG_SPL_FS_LOAD_PAYLOAD_NAME); + err = spl_mmc_do_fs_boot(mmc); if (!err) return; -#endif -#endif -#endif + break; #ifdef CONFIG_SUPPORT_EMMC_BOOT case MMCSD_MODE_EMMCBOOT: