aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@trantor.hos.anvin.org>2008-12-30 11:33:16 -0800
committerH. Peter Anvin <hpa@trantor.hos.anvin.org>2008-12-30 11:33:16 -0800
commitc879bba5516e75429e15a4ee469104a0a6cf12f1 (patch)
tree1825f317ffdab75f8ad147b54ce3d9eb28064045
parent3be3dea5ec7bf0d7ff4c1109c8f4e09500d4d387 (diff)
downloadabc80-c879bba5516e75429e15a4ee469104a0a6cf12f1.tar.gz
abc80-c879bba5516e75429e15a4ee469104a0a6cf12f1.tar.xz
abc80-c879bba5516e75429e15a4ee469104a0a6cf12f1.zip
sddrom: fix support for SDHC
Fix support for SDHC. The wrong flag was checked in SDHC, and there were some minor misses in the initialization sequence. Per spec, the SDHC offer bit should only be in the first ACMD41, not in the interations thereof.
-rw-r--r--data/sddrom.asm16
1 files changed, 11 insertions, 5 deletions
diff --git a/data/sddrom.asm b/data/sddrom.asm
index da85a02..5a042a5 100644
--- a/data/sddrom.asm
+++ b/data/sddrom.asm
@@ -487,7 +487,7 @@ wb_error:
; byte offset.
;
fmt_lba:
- bit 6,(iy+0x17)
+ bit 6,(iy+0x1b) ; Bit 30 of OCR = SDHC
jr nz,fmt_lba_sdhc
; Format the LBA for non-SDHC mode
@@ -567,11 +567,17 @@ sd_init_wait:
;
; Initialize card
;
+new_card:
+ rst 16
+ ld d,40h ; SDHC supported
+ jr sd_init_acmd41
+
old_card:
rst 16 ; DEHL <- 0
- ld d,40h ; SDHC supported
sd_init_acmd41:
+ ld (iy+0x1b),d ; Remember if we offered SDHC or not
+sd_init_acmd41_loop:
ld a,41
call sd_acmd
bit 2,a
@@ -579,7 +585,8 @@ sd_init_acmd41:
and a
jr z,sd_probe_ocr
dec a
- jr z,sd_init_acmd41
+ ld d,0 ; Do not repeat SDHC bit, per spec
+ jr z,sd_init_acmd41_loop
jr sd_carderr
sd_init_cmd1:
@@ -599,8 +606,7 @@ sd_init_cmd1:
;
sd_probe_ocr:
; A = 0 here
- ld (iy+0x17),a ; Assume no SDHC
- bit 6,d ; Did we not even offer SDHC?
+ bit 6,(iy+0x1b) ; Did we not even offer SDHC?
jr z,no_sdhc
ld d,a ; DEHL <- 0
ld a,58 ; CMD58 - GET_OCR