2009-06-11 15:06:50     mmcinit @2009R1-rc2 needs a reset ?

Document created by Aaronwu Employee on Sep 18, 2013
Version 1Show Document
  • View in full screen mode

2009-06-11 15:06:50     mmcinit @2009R1-rc2 needs a reset ?

Akhil K (INDIA)

Message: 75556   


First of all, Thanks a ton for porting mmcinit and fat* commands to uboot in 2009R1. I spent alot of time in trying to make the same work with 2008R1 and 2008R1.5.


I am using a custom BF537 board which is equivalent to BF-537 EZKIT with uboot 2009R1-rc2 build from Files area.


I am able to use mmcint and fatload to boot.


However I am facing a wierd issue:


if I run mmcinit right after power up it complains "NO SD/MMC card found"


If I reset the board using the reset button and then run mmcinit. It detects the card.


I am going to test the same on BF537-EZKIT.


Where should i start debugging this issue?




Thanks in advance






2009-06-11 15:22:13     Re: mmcinit @2009R1-rc2 needs a reset ?


Message: 75557   




To start, add something like:


Index: drivers/mmc/bfin_sdh.c


--- drivers/mmc/bfin_sdh.c      (revision 1908)

+++ drivers/mmc/bfin_sdh.c      (working copy)

@@ -5,7 +5,7 @@


  * Licensed under the GPL-2 or later.



+#define DEBUG 1

#include <common.h>

#include <malloc.h>

#include <part.h>



Index: fs/fat/fat.c


--- fs/fat/fat.c        (revision 1908)

+++ fs/fat/fat.c        (working copy)

@@ -25,6 +25,7 @@

  * MA 02111-1307 USA



+#define DEBUG 1

#include <common.h>

#include <config.h>

#include <fat.h>

Index: disk/part.c


--- disk/part.c (revision 1908)

+++ disk/part.c (working copy)

@@ -26,7 +26,7 @@

#include <ide.h>

#include <part.h>


-#undef PART_DEBUG

+#define        PART_DEBUG



#define        PRINTF(fmt,args...)     printf (fmt ,##args)



And do the steps again - and see if anything is different.






2009-06-12 01:24:30     Re: mmcinit @2009R1-rc2 needs a reset ?

Cliff Cai (CHINA)

Message: 75570   




Would you try to take a look at mmc_spi_init_card() in bfin_spimmc_mode.c,especially at some delay points such as mmc_spi_dummy_clocks(),pdev->write(Null_word,1,pdev->priv_data)....








2009-06-12 06:11:13     Re: mmcinit @2009R1-rc2 needs a reset ?

Akhil K (INDIA)

Message: 75619   


Thanks Robin and Cliff for your responses.


Update: I have been able to reproduce the same issue on BF537-EZKit as well. Will update what i find after more debugging




2009-06-12 10:54:22     Re: mmcinit @2009R1-rc2 needs a reset ?

Akhil K (INDIA)

Message: 75627   


I have been looking at the code and debugging.


I found the following:


When mmcinit is called right after power on. the first call to send_cmd_and_wait() returns with a time out error: ERR_MMC_TIMEOUT.


my guess is that  init_spi()  called from mmc_init() is not working right after power up.




I also stumbled upon a cheasy work around to this issue while playing with mmcinit and sspi commands


following script always detects the card


setenv mmcfix 'mmcinit; sleep 1; sspi $(mmc_spi_ssel); sleep 1; mmcinit'


Note that removing any pieces of chease from this work around will make it not work.


I am publishing these with the hope that it will help the author find a patch for this issue... and no one will need the work around.


Thanks and best regards