From patchwork Sat Dec 5 19:32:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Nelson X-Patchwork-Id: 553026 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 6A6D0140322 for ; Sun, 6 Dec 2015 06:32:45 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1F96E4B660; Sat, 5 Dec 2015 20:32:41 +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 Wjlim4eXxrJg; Sat, 5 Dec 2015 20:32:40 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 710584B652; Sat, 5 Dec 2015 20:32:40 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D48504B652 for ; Sat, 5 Dec 2015 20:32:36 +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 cJfMOkj9PIpK for ; Sat, 5 Dec 2015 20:32:36 +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 fed1rmfepo203.cox.net (fed1rmfepo203.cox.net [68.230.241.148]) by theia.denx.de (Postfix) with ESMTP id 2396E4B64D for ; Sat, 5 Dec 2015 20:32:33 +0100 (CET) Received: from fed1rmimpo210 ([68.230.241.161]) by fed1rmfepo203.cox.net (InterMail vM.8.01.05.15 201-2260-151-145-20131218) with ESMTP id <20151205193231.WTQG26406.fed1rmfepo203.cox.net@fed1rmimpo210> for ; Sat, 5 Dec 2015 14:32:31 -0500 Received: from localhost.localdomain ([98.165.107.234]) by fed1rmimpo210 with cox id pvYW1r00353Tyga01vYWrU; Sat, 05 Dec 2015 14:32:30 -0500 X-CT-Class: Clean X-CT-Score: 0.00 X-CT-RefID: str=0001.0A020204.56633BCF.0019,ss=1,re=0.000,fgs=0 X-CT-Spam: 0 X-Authority-Analysis: v=2.0 cv=Hq2o7TvS c=1 sm=1 a=mmedTQiI2PtWY+RDxZIZmw==:17 a=9_1hYV8uAAAA:8 a=YfCOm-DyAAAA:8 a=D2-xr_skXyWlTrbNdC0A:9 a=-FEs8UIgK8oA:10 a=NWVoK91CQyQA:10 a=4tkS0mDVIT4NLr0T:21 a=rZpRjTXc91fDvCL0:21 a=mmedTQiI2PtWY+RDxZIZmw==:117 X-CM-Score: 0.00 Authentication-Results: cox.net; auth=pass (CRAM-MD5) smtp.auth=eric.a.nelson@cox.net From: Eric Nelson To: u-boot@lists.denx.de, sjg@chromium.org Date: Sat, 5 Dec 2015 12:32:28 -0700 Message-Id: <1449343948-14839-1-git-send-email-eric@nelint.com> X-Mailer: git-send-email 2.6.2 Cc: guillaume.gardet@free.fr Subject: [U-Boot] [PATCH] spl: mmc: use block device number, not hard-coded 0 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" In order to support boot from multiple devices through board_boot_order, it's necessary to use the block number of a device. The use of a hard-coded 0 for the device number also creates a need to re-order block devices for use in SPL like this: http://git.denx.de/?p=u-boot.git;a=blob;f=board/freescale/mx6slevk/mx6slevk.c;hb=HEAD#l195 Signed-off-by: Eric Nelson --- common/spl/spl_mmc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index b3c2c64..cc97e47 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -23,12 +23,13 @@ static int mmc_load_image_raw_sector(struct mmc *mmc, unsigned long sector) unsigned long count; u32 image_size_sectors; struct image_header *header; + int dev_num = mmc->block_dev.dev; header = (struct image_header *)(CONFIG_SYS_TEXT_BASE - sizeof(struct image_header)); /* read image header to find the image size & load address */ - count = mmc->block_dev.block_read(0, sector, 1, header); + count = mmc->block_dev.block_read(dev_num, sector, 1, header); debug("read sector %lx, count=%lu\n", sector, count); if (count == 0) goto end; @@ -45,7 +46,7 @@ static int mmc_load_image_raw_sector(struct mmc *mmc, unsigned long sector) mmc->read_bl_len; /* Read the header too to avoid extra memcpy */ - count = mmc->block_dev.block_read(0, sector, image_size_sectors, + count = mmc->block_dev.block_read(dev_num, sector, image_size_sectors, (void *)(ulong)spl_image.load_addr); debug("read %x sectors to %x\n", image_size_sectors, spl_image.load_addr); @@ -172,7 +173,8 @@ static int mmc_load_image_raw_os(struct mmc *mmc) { unsigned long count; - count = mmc->block_dev.block_read(0, + count = mmc->block_dev.block_read( + mmc->block_dev.dev, CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR, CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS, (void *) CONFIG_SYS_SPL_ARGS_ADDR);