[openfirmware] r1263 - dev/mmc/sdhci

svn at openfirmware.info svn at openfirmware.info
Fri Jul 31 20:45:34 CEST 2009


Author: wmb
Date: 2009-07-31 20:45:34 +0200 (Fri, 31 Jul 2009)
New Revision: 1263

Modified:
   dev/mmc/sdhci/sdhci.fth
   dev/mmc/sdhci/sdmmc.fth
Log:
SDHCI/SDMMC driver - reordered closing sequence so deferred writes
get flushed before turning things off, thus avoiding command timeouts
on close.



Modified: dev/mmc/sdhci/sdhci.fth
===================================================================
--- dev/mmc/sdhci/sdhci.fth	2009-07-31 18:44:18 UTC (rev 1262)
+++ dev/mmc/sdhci/sdhci.fth	2009-07-31 18:45:34 UTC (rev 1263)
@@ -756,8 +756,12 @@
 ;
 
 : detach-card  ( -- )
+   intstat-on
+   wait-write-done
+   intstat-off
    card-clock-off
    card-power-off
+   unmap-regs
 ;
 
 : attach-sdio-card  ( -- okay? )
@@ -841,11 +845,8 @@
 
 : close  ( -- )
    open-count  1 =  if
-      intstat-on
-      wait-write-done
       scratch-buf d# 64 " dma-free" $call-parent
    then
-   unmap-regs
    open-count 1- 0 max  to open-count
 ;
 

Modified: dev/mmc/sdhci/sdmmc.fth
===================================================================
--- dev/mmc/sdhci/sdmmc.fth	2009-07-31 18:44:18 UTC (rev 1262)
+++ dev/mmc/sdhci/sdmmc.fth	2009-07-31 18:45:34 UTC (rev 1263)
@@ -57,9 +57,10 @@
 ;
 
 : close  ( -- )
-   " detach-card" $call-parent
    label-package close-package
    deblocker close-package
+   \ Close packages first in case of delayed write flush
+   " detach-card" $call-parent
 ;
 
 : block-size  ( -- n )  h# 200  ;




More information about the openfirmware mailing list