commit f2059cf9fb0969e21776dcc0a104d3abe552644f
parent 9f3eee2a1b785ea9a645a210aaafa80d8229c99f
Author: Virgil Dupras <hsoft@hardcoded.net>
Date: Tue, 20 Jun 2023 17:02:31 -0400
rpi emmc: add ACMD41 CCS support
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/fs/drv/rpi/emmc.fs b/fs/drv/rpi/emmc.fs
@@ -15,10 +15,12 @@ extends Drive struct[ EMMCDrive
$00000020 const INT_READ_READY
$00000001 const INT_CMD_DONE
$80000000 const ACMD41_COMPLETE
+ $40000000 const ACMD41_CCS
$01000000 const SRST_HT
$00000002 const CLK_STABLE
0 value rca \ RCA of current card, stored in higher 16b
+ 0 value ccs
: err abort" EMMC error" ;
: # not if err then ;
@@ -55,9 +57,9 @@ extends Drive struct[ EMMCDrive
10 delayus
EMMC_CONTROL1 @ CLK_STABLE and if break then next
abort" clk failed" then ;
- : sec@ ( lba dst self -- ) drop
+ : sec@ ( sec dst self -- ) drop
datawait $00010200 EMMC_BLKSIZECNT !
- swap $200 * cmd17 readready \ TODO: check CCS flag to know if we do "$200 *"
+ swap ccs not if $200 * then cmd17 readready
$200 >> >> for EMMC_DATA @ swap !+ next drop ;
: sec! err ;
\ We assume the EMMC base clock to be 100 MHz. During identification, we need
@@ -71,6 +73,7 @@ extends Drive struct[ EMMCDrive
cmd0 $1aa cmd8 $fff and $1aa <> if abort" CMD8 error" then 10 for
$50ff8000 acmd41 ACMD41_COMPLETE and if break then 400 delayus next
abort" CMD41 timeout" then
+ EMMC_RESP0 @ ACMD41_CCS and bool to ccs
cmd2 cmd3 dup $ffff0000 and to rca
4 clk! \ 25 MHz
rca cmd7 ;