Author: wmb Date: Sat Feb 13 20:27:16 2010 New Revision: 1744 URL: http://tracker.coreboot.org/trac/openfirmware/changeset/1744
Log: OLPC trac 10024 - Improved SD card detection procedure so it works well for both the CaFe SDHCI controller and the Via SDHCI controller.
Modified: dev/mmc/sdhci/sdhci.fth
Modified: dev/mmc/sdhci/sdhci.fth ============================================================================== --- dev/mmc/sdhci/sdhci.fth Sat Feb 13 08:06:38 2010 (r1743) +++ dev/mmc/sdhci/sdhci.fth Sat Feb 13 20:27:16 2010 (r1744) @@ -153,7 +153,18 @@ \ The debouncer takes about 300 ms to stabilize.
: card-inserted? ( -- flag ) - present-state@ h# 30000 and h# 30000 = + get-msecs d# 500 + begin ( time-limit ) + \ When the stable bit is set, we can believe the answer + present-state@ h# 20000 and if ( time-limit ) + drop ( ) + present-state@ h# 10000 and 0<> ( flag ) + exit ( -- flag ) + then ( time-limit ) + dup get-msecs - 0< ( time-limit timeout? ) + until ( time-limit ) + drop ( ) + ." SD Card detect unstable!" cr ( ) + false ( flag ) ; : write-protected? ( -- flag ) present-state@ h# 80000 and 0=