From patchwork Wed Oct 28 09:23:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikita Kiryanov X-Patchwork-Id: 537275 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 04CE7140DAE for ; Wed, 28 Oct 2015 20:25:09 +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=4UnAqSQ6; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C9A414B667; Wed, 28 Oct 2015 10:25:02 +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 HYPPz0ahj-vd; Wed, 28 Oct 2015 10:25:02 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5C4054B6CA; Wed, 28 Oct 2015 10:24:04 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C64DC4B64D for ; Wed, 28 Oct 2015 10:23:42 +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 MBMz14TWC4ux for ; Wed, 28 Oct 2015 10:23:42 +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 5AEF54B62C 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=2Gh1UwsTkwABsqmB8azFTrvAI/wG3jLMBECM5UgjCrI=; b=4UnAqSQ6rLrkc VSh+1+ctWMvU1fdMgUGSw/Ys3slycWH0c2Wb+rEIYooMQS5nyB08qe24oZX+TRLnKEvOplK9hQSa2 iX7fr8o85qNPOoXP2Hn08qIvJ8D9ZUc5GRZrRG2rWwpDVmsU22yDaSQahB+WobbqDSq5INBLxlxbd Rnzs=; Received: from [62.90.235.247] (port=34886 helo=zimbra-mta.compulab.co.il) by softlayer.compulab.co.il with esmtp (Exim 4.86) (envelope-from ) id 1ZrMxE-0006TG-Ot; 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 8D84F487009; Wed, 28 Oct 2015 11:23:35 +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 b_vQrYK_cMrw; Wed, 28 Oct 2015 11:23:35 +0200 (IST) Received: from localhost (localhost [127.0.0.1]) by zimbra-mta.compulab.co.il (Postfix) with ESMTP id 47DEA487006; 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 2rZ1gyLTJ0cT; Wed, 28 Oct 2015 11:23:34 +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 F19EB48700B; 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:24 +0200 Message-Id: <1446024210-16517-8-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 07/13] spl: mmc: get rid of emmc boot code duplication 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" Get rid of emmc boot code duplication in spl_mmc_load_image() using a switch case fallthrough into MMCSD_MODE_RAW. Since the #ifdef CONFIG_SUPPORT_EMMC_BOOT check is not really necessary, remove it in the process. 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 | 54 ++++++++++++++++++---------------------------------- 1 file changed, 18 insertions(+), 36 deletions(-) diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index 08aa4ae..eaba29b 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -240,6 +240,24 @@ void spl_mmc_load_image(void) boot_mode = spl_boot_mode(); switch (boot_mode) { + case MMCSD_MODE_EMMCBOOT: + /* + * We need to check what the partition is configured to. + * 1 and 2 match up to boot0 / boot1 and 7 is user data + * which is the first physical partition (0). + */ + part = (mmc->part_config >> 3) & PART_ACCESS_MASK; + + if (part == 7) + part = 0; + + if (mmc_switch_part(0, part)) { +#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT + puts("spl: mmc partition switch failed\n"); +#endif + hang(); + } + /* Fall through */ case MMCSD_MODE_RAW: debug("spl: mmc boot mode: raw\n"); @@ -268,42 +286,6 @@ void spl_mmc_load_image(void) return; break; -#ifdef CONFIG_SUPPORT_EMMC_BOOT - case MMCSD_MODE_EMMCBOOT: - /* - * We need to check what the partition is configured to. - * 1 and 2 match up to boot0 / boot1 and 7 is user data - * which is the first physical partition (0). - */ - part = (mmc->part_config >> 3) & PART_ACCESS_MASK; - - if (part == 7) - part = 0; - - if (mmc_switch_part(0, part)) { -#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT - puts("spl: mmc partition switch failed\n"); -#endif - hang(); - } - - if (!spl_start_uboot()) { - err = mmc_load_image_raw_os(mmc); - if (!err) - return; - } - err = mmc_load_image_raw_partition(mmc, - CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION); - if (!err) - return; -#if defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR) - err = mmc_load_image_raw_sector(mmc, - CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR); - if (!err) - return; -#endif - break; -#endif case MMCSD_MODE_UNDEFINED: #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT default: