[openfirmware] [commit] r1951 - dev/mmc/sdhci

repository service svn at openfirmware.info
Sun Sep 12 10:42:15 CEST 2010


Author: wmb
Date: Sun Sep 12 10:42:14 2010
New Revision: 1951
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/1951

Log:
SDHCI - Added 3-second delay in detach card before turning off power,
to avoid killing the ADATA 8G cards that do stuff after writing.
The delay is from the last write command, so read-only operations
are not penalized.

Modified:
   dev/mmc/sdhci/sdhci.fth

Modified: dev/mmc/sdhci/sdhci.fth
==============================================================================
--- dev/mmc/sdhci/sdhci.fth	Fri Sep 10 08:40:07 2010	(r1950)
+++ dev/mmc/sdhci/sdhci.fth	Sun Sep 12 10:42:14 2010	(r1951)
@@ -443,6 +443,7 @@
 : protected?  ( group# -- 32-bits )  h# 1e1a cmd  response  ;  \ CMD30 R1 UNTESTED
 
 0 instance value writing?
+0 instance value last-write-time
 
 : erase-blocks  ( block# #blocks -- ) \ UNTESTED
    intstat-on
@@ -873,6 +874,10 @@
 
 : detach-card  ( -- )
    wait-dma-done
+   last-write-time  if
+      begin  get-msecs last-write-time -  d# 3000 >  until
+   then
+
    intstat-on  wait-write-done drop  intstat-off
    card-clock-off
    card-power-off
@@ -945,6 +950,7 @@
    else                                 ( block# r: #blocks fresh? )
       r>  if  r@ pre-write-erase  then  ( block# r: #blocks )
       r> issue-write                    ( )
+      get-msecs to last-write-time      ( )
       true to writing?                  ( )
    then                                 ( )
    true to dma?                         ( )



More information about the openfirmware mailing list