Author: wmb Date: 2007-05-14 12:50:34 +0200 (Mon, 14 May 2007) New Revision: 380
Modified: dev/mmc/sdhci/sdhci.fth Log: SDHCI - High-capacity SD memory card support now works - Pierre Ossman tested with one of his SDHC cards.
Modified: dev/mmc/sdhci/sdhci.fth =================================================================== --- dev/mmc/sdhci/sdhci.fth 2007-05-14 09:22:28 UTC (rev 379) +++ dev/mmc/sdhci/sdhci.fth 2007-05-14 10:50:34 UTC (rev 380) @@ -387,7 +387,7 @@
\ Version 2 of the spec add CMD8. Pre-v2 cards will time out on CMD8. : sd2? ( -- flag ) - true to allow-timeout? true to timeout? + true to allow-timeout? false to timeout? send-if-cond false to allow-timeout?
@@ -397,16 +397,22 @@ 0 instance value address-shift h# 8010.0000 value oc-mode \ Voltage settings, etc.
-: set-operating-conditions ( -- ) - sd2? if h# 4010.0000 else h# 8010.0000 then to oc-mode - - begin +: wait-powered ( -- ocr ) + d# 100 0 do oc-mode set-oc ( ocr ) \ acmd41 dup h# 8000.0000 and ( card-powered-on? ) - 0= while ( ocr ) + if unloop exit then drop d# 10 ms - repeat ( ocr ) + loop ( ) + ." Card didn't power up after 1 second" cr + abort +;
+: set-operating-conditions ( -- ) + sd2? if h# 4030.0000 else h# 0030.0000 then to oc-mode + + wait-powered + \ Card Capacity Status bit - High Capacity cards are addressed \ in blocks, so the block number does not have to be shifted. \ Standard capacity cards are addressed in bytes, so the block @@ -471,7 +477,7 @@
reset-card \ Cmd 0
- set-operating-conditions + ['] set-operating-conditions catch if false exit then
get-all-cids \ Cmd 2 get-rca \ Cmd 3 - Get relative card address