I tested the following patch on mx51evk and it works for me.
From 283f367cc2efa1a9e4a884c719f05c5eb3991b6b Mon Sep 17 00:00:00 2001
From: Shawn Guo <email address hidden>
Date: Fri, 8 Oct 2010 20:06:18 +0800
Subject: [PATCH] Make sure function mmc_init() is called before mmc read/write routine
+ /* Ensure the call of mmc_init() */
+ if (!mmc->version)
+ mmc_init(mmc);
+
/* We always do full block reads from the card */
err = mmc_set_blocklen(mmc, mmc->read_bl_len);
I tested the following patch on mx51evk and it works for me.
From 283f367cc2efa1a 9e4a884c719f05c 5eb3991b6b Mon Sep 17 00:00:00 2001
From: Shawn Guo <email address hidden>
Date: Fri, 8 Oct 2010 20:06:18 +0800
Subject: [PATCH] Make sure function mmc_init() is called before mmc read/write routine
Signed-off-by: Shawn Guo <email address hidden>
---
drivers/mmc/mmc.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
return -1;
index cf4ea16..726daf3 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -90,6 +90,10 @@ mmc_bwrite(int dev_num, ulong start, lbaint_t blkcnt, const void*src)
if (!mmc)
+ /* Ensure the call of mmc_init() */
+ if (!mmc->version)
+ mmc_init(mmc);
+
blklen = mmc->write_bl_len;
err = mmc_set_ blocklen( mmc, mmc->write_bl_len);
return 0;
@@ -219,6 +223,10 @@ static ulong mmc_bread(int dev_num, ulong start, lbaint_t blkcnt, void *dst)
if (!mmc)
+ /* Ensure the call of mmc_init() */ blocklen( mmc, mmc->read_bl_len);
+ if (!mmc->version)
+ mmc_init(mmc);
+
/* We always do full block reads from the card */
err = mmc_set_