From patchwork Sun Mar 27 19:00:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Nelson X-Patchwork-Id: 602378 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 3qY5w80Tqvz9sBc for ; Mon, 28 Mar 2016 06:00:40 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AD9B5A7606; Sun, 27 Mar 2016 21:00:36 +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 sc9NtuUGKJFV; Sun, 27 Mar 2016 21:00:36 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 363D3A75D6; Sun, 27 Mar 2016 21:00:31 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2073FA7564 for ; Sun, 27 Mar 2016 21:00:26 +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 T-xzCw0vBKH2 for ; Sun, 27 Mar 2016 21:00:26 +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 fed1rmfepo203.cox.net (fed1rmfepo203.cox.net [68.230.241.148]) by theia.denx.de (Postfix) with ESMTP id 735BEA7517 for ; Sun, 27 Mar 2016 21:00:21 +0200 (CEST) Received: from fed1rmimpo305.cox.net ([68.230.241.173]) by fed1rmfepo203.cox.net (InterMail vM.8.01.05.15 201-2260-151-145-20131218) with ESMTP id <20160327190020.GUXK26141.fed1rmfepo203.cox.net@fed1rmimpo305.cox.net> for ; Sun, 27 Mar 2016 15:00:20 -0400 Received: from localhost.localdomain ([98.165.107.234]) by fed1rmimpo305.cox.net with cox id b70H1s00K53Tyga0170KoN; Sun, 27 Mar 2016 15:00:20 -0400 X-CT-Class: Clean X-CT-Score: 0.00 X-CT-RefID: str=0001.0A020204.56F82DC4.004E, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CT-Spam: 0 X-Authority-Analysis: v=2.1 cv=M9LtU3Es c=1 sm=1 tr=0 a=mmedTQiI2PtWY+RDxZIZmw==:117 a=mmedTQiI2PtWY+RDxZIZmw==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=9_1hYV8uAAAA:8 a=IJwJAAa8mtEiDypNwKwA:9 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 Date: Sun, 27 Mar 2016 12:00:14 -0700 Message-Id: <1459105215-3647-3-git-send-email-eric@nelint.com> X-Mailer: git-send-email 2.6.2 In-Reply-To: <1459105215-3647-1-git-send-email-eric@nelint.com> References: <1458524727-4643-1-git-send-email-eric@nelint.com> <1459105215-3647-1-git-send-email-eric@nelint.com> Cc: marex@denx.de, trini@konsulko.com, swarren@nvidia.com, ioan.nicu.ext@nsn.com, erik.tideman@faltcom.se, tor@excito.com, hdegoede@redhat.com, p.marczak@samsung.com, sr@denx.de, patrick.delaunay73@gmail.com Subject: [U-Boot] [PATCH 2/3] mmc: use block layer in mmc command 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" Call blk_dread, blk_dwrite, blk_derase to ensure that the block cache is used if enabled and to remove build breakage when CONFIG_BLK is enabled. Signed-off-by: Eric Nelson Reviewed-by: Tom Rini --- cmd/mmc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/mmc.c b/cmd/mmc.c index fb4382e..39ef072 100644 --- a/cmd/mmc.c +++ b/cmd/mmc.c @@ -150,6 +150,7 @@ static struct mmc *init_mmc_device(int dev, bool force_init) printf("no mmc device at slot %x\n", dev); return NULL; } + if (force_init) mmc->has_init = 0; if (mmc_init(mmc)) @@ -345,7 +346,7 @@ static int do_mmc_read(cmd_tbl_t *cmdtp, int flag, printf("\nMMC read: dev # %d, block # %d, count %d ... ", curr_device, blk, cnt); - n = mmc->block_dev.block_read(&mmc->block_dev, blk, cnt, addr); + n = blk_dread(&mmc->block_dev, blk, cnt, addr); /* flush cache after read */ flush_cache((ulong)addr, cnt * 512); /* FIXME */ printf("%d blocks read: %s\n", n, (n == cnt) ? "OK" : "ERROR"); @@ -377,7 +378,7 @@ static int do_mmc_write(cmd_tbl_t *cmdtp, int flag, printf("Error: card is write protected!\n"); return CMD_RET_FAILURE; } - n = mmc->block_dev.block_write(&mmc->block_dev, blk, cnt, addr); + n = blk_dwrite(&mmc->block_dev, blk, cnt, addr); printf("%d blocks written: %s\n", n, (n == cnt) ? "OK" : "ERROR"); return (n == cnt) ? CMD_RET_SUCCESS : CMD_RET_FAILURE; @@ -405,7 +406,7 @@ static int do_mmc_erase(cmd_tbl_t *cmdtp, int flag, printf("Error: card is write protected!\n"); return CMD_RET_FAILURE; } - n = mmc->block_dev.block_erase(&mmc->block_dev, blk, cnt); + n = blk_derase(&mmc->block_dev, blk, cnt); printf("%d blocks erased: %s\n", n, (n == cnt) ? "OK" : "ERROR"); return (n == cnt) ? CMD_RET_SUCCESS : CMD_RET_FAILURE;