On 2/18/21 6:09 PM, Philippe Mathieu-Daudé wrote: > On 2/16/21 4:46 AM, Bin Meng wrote: >> The codes to limit the maximum block size is only necessary when >> SDHC_BLKSIZE register is writable.
Per "SD Command Generation": The Host Driver should not read the SDMA System Address, Block Size and Block Count registers during a data transaction unless the transfer is stopped because the value is changing and not stable. To prevent destruction of registers using data transfer when issuing command, the 32-bit Block Count, Block Size, 16-bit Block Count and Transfer Mode registers shall be write protected by the Host Controller while Command Inhibit (DAT) is set to 1 in the Present State register. Shouldn't we check for !(s->prnsts & SDHC_DATA_INHIBIT) instead? >> >> Signed-off-by: Bin Meng <bmeng...@gmail.com> >> >> --- >> >> Changes in v2: >> - new patch: sdhci: Limit block size only when SDHC_BLKSIZE register is >> writable >> >> hw/sd/sdhci.c | 14 +++++++------- >> 1 file changed, 7 insertions(+), 7 deletions(-) > > Reviewed-by: Philippe Mathieu-Daudé <f4...@amsat.org> >