From patchwork Mon Dec 19 15:14:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kostya Porotchkin X-Patchwork-Id: 707123 X-Patchwork-Delegate: sr@denx.de 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 3tj4Cp68Z5z9vFT for ; Tue, 20 Dec 2016 02:12:38 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7CE8AB38C7; Mon, 19 Dec 2016 16:12:34 +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 0sX5x1qD2sHy; Mon, 19 Dec 2016 16:12:34 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1115AB38AE; Mon, 19 Dec 2016 16:12:34 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9A506B387C for ; Mon, 19 Dec 2016 16:12:26 +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 Whn2GJKMRHVl for ; Mon, 19 Dec 2016 16:12:26 +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 mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by theia.denx.de (Postfix) with ESMTPS id 2A75EB3864 for ; Mon, 19 Dec 2016 16:12:22 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id uBJFA3cp026454; Mon, 19 Dec 2016 07:12:19 -0800 Received: from il-exch01.marvell.com ([199.203.130.101]) by mx0b-0016f401.pphosted.com with ESMTP id 27ebh4acud-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 19 Dec 2016 07:12:19 -0800 Received: from SC-EXCH04.marvell.com (10.93.176.84) by IL-EXCH01.marvell.com (10.4.102.220) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Mon, 19 Dec 2016 17:12:16 +0200 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server id 15.0.1210.3 via Frontend Transport; Mon, 19 Dec 2016 07:12:15 -0800 Received: from Malogato.pt.marvell.com (unknown [10.5.24.37]) by maili.marvell.com (Postfix) with ESMTP id A626E3F7040; Mon, 19 Dec 2016 07:12:13 -0800 (PST) From: To: Date: Mon, 19 Dec 2016 17:14:43 +0200 Message-ID: <1482160489-4148-2-git-send-email-kostap@marvell.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1482160489-4148-1-git-send-email-kostap@marvell.com> References: <1482160489-4148-1-git-send-email-kostap@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-12-19_11:, , signatures=0 X-Proofpoint-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1612190197 Cc: Haim Boot , Hanna Hawa , Omri Itach , Nadav Haklai , Neta Zur Hershkovits , Stefan Roese , Igal Liberman Subject: [U-Boot] [PATCH 1/7] arm64: mvebu: Update bubt command MMC block device access 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: Konstantin Porotchkin Update the MMC block device access code in bubt command implementation according to the latest MMC driver changes Change-Id: Ie852ceefa0b040ffe1362bdb7815fcea9b2d923b Signed-off-by: Konstantin Porotchkin Cc: Stefan Roese Cc: Nadav Haklai Cc: Neta Zur Hershkovits Cc: Omri Itach Cc: Igal Liberman Cc: Haim Boot Cc: Hanna Hawa --- cmd/mvebu/bubt.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c index 1cbfcf0..0ac2e63 100644 --- a/cmd/mvebu/bubt.c +++ b/cmd/mvebu/bubt.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -111,6 +112,7 @@ static ulong get_load_addr(void) static int mmc_burn_image(size_t image_size) { struct mmc *mmc; + struct blk_desc *blk_desc; lbaint_t start_lba; lbaint_t blk_count; ulong blk_written; @@ -144,13 +146,18 @@ static int mmc_burn_image(size_t image_size) * MMC/eMMC boots from LBA-0 */ start_lba = IS_SD(mmc) ? 1 : 0; - blk_count = image_size / mmc->block_dev.blksz; - if (image_size % mmc->block_dev.blksz) + blk_count = image_size / mmc->write_bl_len; + if (image_size % mmc->write_bl_len) blk_count += 1; - blk_written = mmc->block_dev.block_write(mmc_dev_num, - start_lba, blk_count, - (void *)get_load_addr()); + blk_desc = mmc_get_blk_desc(mmc); + if (!blk_desc) { + printf("Error - failed to obtain block descriptor\n"); + return -ENODEV; + } + blk_written = blk_dwrite(blk_desc, start_lba, blk_count, + (void *)get_load_addr()); + if (blk_written != blk_count) { printf("Error - written %#lx blocks\n", blk_written); return -ENOSPC;