summaryrefslogtreecommitdiff
path: root/cmd/mvebu
diff options
context:
space:
mode:
authorKonstantin Porotchkin <kostap@marvell.com>2017-01-08 16:52:06 +0200
committerStefan Roese <sr@denx.de>2017-01-25 07:04:22 +0100
commite559ef1ae80c1bde942ad9c62932de20e2b68cef (patch)
tree8154cdd2cd875e4d1e42cae7310e06158862e3fe /cmd/mvebu
parent274d3562fd38caa6dbb7aad518eb712c3ad1b6b7 (diff)
downloadu-boot-imx-e559ef1ae80c1bde942ad9c62932de20e2b68cef.zip
u-boot-imx-e559ef1ae80c1bde942ad9c62932de20e2b68cef.tar.gz
u-boot-imx-e559ef1ae80c1bde942ad9c62932de20e2b68cef.tar.bz2
arm64: mvebu: Update bubt command MMC block device access
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@marvell.com> Cc: Stefan Roese <sr@denx.de> Cc: Nadav Haklai <nadavh@marvell.com> Cc: Neta Zur Hershkovits <neta@marvell.com> Cc: Omri Itach <omrii@marvell.com> Cc: Igal Liberman <igall@marvell.com> Cc: Haim Boot <hayim@marvell.com> Cc: Hanna Hawa <hannah@marvell.com>
Diffstat (limited to 'cmd/mvebu')
-rw-r--r--cmd/mvebu/bubt.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c
index 1cbfcf0..b752927 100644
--- a/cmd/mvebu/bubt.c
+++ b/cmd/mvebu/bubt.c
@@ -18,6 +18,9 @@
#include <usb.h>
#include <fs.h>
#include <mmc.h>
+#ifdef CONFIG_BLK
+#include <blk.h>
+#endif
#include <u-boot/sha1.h>
#include <u-boot/sha256.h>
@@ -116,7 +119,9 @@ static int mmc_burn_image(size_t image_size)
ulong blk_written;
int err;
const u8 mmc_dev_num = CONFIG_SYS_MMC_ENV_DEV;
-
+#ifdef CONFIG_BLK
+ struct blk_desc *blk_desc;
+#endif
mmc = find_mmc_device(mmc_dev_num);
if (!mmc) {
printf("No SD/MMC/eMMC card found\n");
@@ -144,13 +149,27 @@ static int mmc_burn_image(size_t image_size)
* MMC/eMMC boots from LBA-0
*/
start_lba = IS_SD(mmc) ? 1 : 0;
+#ifdef CONFIG_BLK
+ blk_count = image_size / mmc->write_bl_len;
+ if (image_size % mmc->write_bl_len)
+ blk_count += 1;
+
+ 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());
+#else
blk_count = image_size / mmc->block_dev.blksz;
if (image_size % mmc->block_dev.blksz)
blk_count += 1;
blk_written = mmc->block_dev.block_write(mmc_dev_num,
- start_lba, blk_count,
- (void *)get_load_addr());
+ start_lba, blk_count,
+ (void *)get_load_addr());
+#endif /* CONFIG_BLK */
if (blk_written != blk_count) {
printf("Error - written %#lx blocks\n", blk_written);
return -ENOSPC;