From patchwork Sun Nov 8 15:11:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikita Kiryanov X-Patchwork-Id: 541450 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 90ED71402D9 for ; Mon, 9 Nov 2015 02:14:15 +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=BYHseG6E; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 135C64BEC8; Sun, 8 Nov 2015 16:13:03 +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 d7WAzm0brbMY; Sun, 8 Nov 2015 16:13:02 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E3F4D4BECC; Sun, 8 Nov 2015 16:12:30 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 92F2F4BE62 for ; Sun, 8 Nov 2015 16:12:08 +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 R9NaLmn-BM7l for ; Sun, 8 Nov 2015 16:12:08 +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 32FBB4BE5F for ; Sun, 8 Nov 2015 16:12:04 +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=JsRoyVQkT7v5rFjkJl5LU6F8TOQJueuYs0qCgKtInzk=; b=BYHseG6EJczTd 2dGuE5tEakmAVYA3vgFCnGiNJt4EMceOCy22jqEkFes+JDTwAhyhbL+CXqtQPW1RmFcTdsf04R+zB AA9Bu78HcmQXq2N6sWynOY4+pjbgIcm3JgrxAJCkomCVnnfZm6dVBWU4rj2u7u5NCNqHvNKLkevtr wj90=; Received: from [62.90.235.247] (port=45545 helo=zimbra-mta.compulab.co.il) by softlayer.compulab.co.il with esmtp (Exim 4.86) (envelope-from ) id 1ZvRdS-0006g0-EG; Sun, 08 Nov 2015 17:12:02 +0200 Received: from localhost (localhost [127.0.0.1]) by zimbra-mta.compulab.co.il (Postfix) with ESMTP id 80F4948377D; Sun, 8 Nov 2015 17:12:01 +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 XeqWJHkHh7V3; Sun, 8 Nov 2015 17:12:00 +0200 (IST) Received: from localhost (localhost [127.0.0.1]) by zimbra-mta.compulab.co.il (Postfix) with ESMTP id 859C948377B; Sun, 8 Nov 2015 17:12:00 +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 L4KiPG67imZ0; Sun, 8 Nov 2015 17:12:00 +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 4E22A483770; Sun, 8 Nov 2015 17:12:00 +0200 (IST) From: Nikita Kiryanov To: u-boot@lists.denx.de Date: Sun, 8 Nov 2015 17:11:48 +0200 Message-Id: <1446995514-26357-8-git-send-email-nikita@compulab.co.il> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1446995514-26357-1-git-send-email-nikita@compulab.co.il> References: <1446995514-26357-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 V4 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 V4: - No changes. Changes in V3: - No changes. 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 5dc576b..7d100fa 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: