hw/sd: ssi-sd: Fix incorrect card response sequence
commit281c5c95b259a0d9809977c9f407d4654c3a79aa
authorBin Meng <bin.meng@windriver.com>
Sat, 23 Jan 2021 10:39:54 +0000 (23 18:39 +0800)
committerPhilippe Mathieu-Daudé <f4bug@amsat.org>
Sun, 24 Jan 2021 17:53:20 +0000 (24 18:53 +0100)
treed80ad0f068e2dcac1acf73d6f9c6632ddd3ec034
parente93c65a6c64fa18b0c61fb9338d364cbea32b6ef
hw/sd: ssi-sd: Fix incorrect card response sequence

Per the "Physical Layer Specification Version 8.00" chapter 7.5.1,
"Command/Response", there is a minimum 8 clock cycles (Ncr) before
the card response shows up on the data out line. However current
implementation jumps directly to the sending response state after
all 6 bytes command is received, which is a spec violation.

Add a new state PREP_RESP in the ssi-sd state machine to handle it.

Fixes: 775616c3ae8c ("Partial SD card SPI mode support")
Signed-off-by: Bin Meng <bin.meng@windriver.com>
Tested-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Pragnesh Patel <pragnesh.patel@sifive.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20210123104016.17485-4-bmeng.cn@gmail.com>
[PMD: Change VMState version id 2 -> 3]
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
hw/sd/ssi-sd.c