[U-Boot] [PATCH 1/7] arm64: mvebu: Update bubt command MMC block device access
kostap at marvell.com
kostap at marvell.com
Mon Dec 19 16:14:43 CET 2016
From: Konstantin Porotchkin <kostap at marvell.com>
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 <kostap at marvell.com>
Cc: Stefan Roese <sr at denx.de>
Cc: Nadav Haklai <nadavh at marvell.com>
Cc: Neta Zur Hershkovits <neta at marvell.com>
Cc: Omri Itach <omrii at marvell.com>
Cc: Igal Liberman <igall at marvell.com>
Cc: Haim Boot <hayim at marvell.com>
Cc: Hanna Hawa <hannah at marvell.com>
---
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 <usb.h>
#include <fs.h>
#include <mmc.h>
+#include <blk.h>
#include <u-boot/sha1.h>
#include <u-boot/sha256.h>
@@ -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;
--
2.7.4
More information about the U-Boot
mailing list