Page MenuHomeFreeBSD

mmc: Ignore BADCRC errors in CMD13 when switching to HS200
Needs ReviewPublic

Authored by ashafer_badland.io on May 6 2020, 9:45 PM.

Details

Reviewers
imp
manu
kibab
Summary

This fixes my acer aspire A114-32-P7E5, which has eMMC flash memory that
requires this patch to work. It showed CMD13 failing with result 2 (bad crc),
preventing bsdinstall from continuing. This is with a gemini lake sdhci.

successful dmesg: https://dmesgd.nycbug.org/index.cgi?do=view&id=5472

From reading around online, it seems that some number of cards can not depend on
CMD13 to check for errors while switching to HS200. They generate BADCRC errors
for a short bit before CMD13 succeeds. It's my understanding that CMD13 is used after
CMD6 to verify switching has completed, and if these BADCRC errors are observed
we should ignore them and retry CMD13.

I've update mmc_switch_status to have an argument to ignore bad crc errors,
which the caller sets if we are switching to HS200. This seemed to be the best
place to do this.

Test Plan

Tested on the aforementioned acer, and my guess is this fix will apply to other
cheap laptops since they all seem to use equivalent hardware. Posting the patch
here to get some more eyes on this, please let me know anything that needs
improving.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 30951
Build 28661: arc lint + arc unit