[mmc] Fix async eMMC multi-descriptor chain and sticky error state
In aml_sd_rw_async(), continuation descriptors (i > 0) previously left
no_cmd = 0 and cmd_index = CMD18/CMD25, causing the Amlogic SD/eMMC DMA
engine to transmit an illegal CMD18/CMD25 on the CMD line every 256
blocks while the eMMC card was already streaming in 'data'/'rcv' state.
While Samsung eMMC on VIM3 V12 ignored the mid-transfer command on
DAT[7:0] and only latched JEDEC R1_ILLEGAL_COMMAND in Card Status,
FORESEE eMMC on VIM3 V15 aborts its data stream (rxd_err = 0xff,
status=0x1ff20ff), causing GBL to panic with UnificationError(DeviceError).
Additionally, once an async I/O failed, aml_priv->io_info.error remained
latched after pending became false, causing subsequent synchronous MMC
commands (such as reading durable_boot ABR metadata during UEFI
ResetSystem()) to fail with 'Async IO err'.
Fix both issues:
- Set no_cmd = 1 and no_resp = 1 on continuation descriptors (i > 0),
expect R1 on i == 0 (no_resp = 0, resp_num = 1), and configure a
per-descriptor hardware timeout (0xc = 4096 ms).
- Flush desc_buf before DMA and re-invalidate the read data buffer after
DMA completion.
- Check JEDEC R1 data error bits (MMC_R1_DATA_ERR_MASK) on CMD12's R1b
response so card-side protocol/ECC errors are caught across all eMMC
vendors.
- Make aml_sd_sync() a no-op when no async I/O is pending, consume
io_info.error once in aml_sd_poll_io(), and restore MMC_HWPART_USER /
reset disk->status in efi_aml_sd_emmc.c error and reset paths.
Bug: 584803959
Test: Built with ./fuchsia_build.py; reproduced R1_ILLEGAL_COMMAND +
ResetSystem() failure on VIM3 and verified cold boot, 4-blk/desc
(12,934-descriptor) stress boot, GBL fastboot flash, and post-error
ResetSystem() ABR read.
Change-Id: I8baa931ed5f971012ad30fdf577d05f089814283
Reviewed-on: https://turquoise-internal-review.googlesource.com/c/third_party/u-boot/+/1823613
Commit-Queue: Yecheng Zhao <zyecheng@google.com>
Reviewed-by: Sergii Parubochyi <sergiip@google.com>
Lint: android-build-ayeaye@system.gserviceaccount.com <android-build-ayeaye@system.gserviceaccount.com>
Reviewed-by: David Pursell <dpursell@google.com>
GitOrigin-RevId: 4e6cc1558377579a3fc519f5c1bccf75ec340ea3
This is a version of u-boot, modified to support Fuchsia on the Khadas vim3
To build the vim3 bootloader for Fuchsia:
CIPD access. All build tools are downloaded to cipd_deps.
Run the build script from repo root
./fuchsia_build.py
Options:
--clean-cipd option can be used to make sure CIPD checkout is clean. It will remove cipd_deps directory and download dependencies again.--gbl-path <path> option specifies a path to a local GBL (gbl.efi) binary. If provided, CIPD GBL is not used; otherwise, the script downloads GBL from CIPD and uses gbl_aarch64_dev.efi.You now have a build/u-boot.bin.unsigned that you can flash to a target using fastboot.
go/fuchsia-firmware-licensing-publishing