HomeFreeBSD

cam_fill_mmcio: initialize cmd.error sub-field

Description

cam_fill_mmcio: initialize cmd.error sub-field

For me, this fixes a problem with using eMMC storage in MMCCAM
configuration with dwmmc driver (on Rock64).
The problem appeared after commit 07da3bb5d56c85 "mmc: support for SPI
bus type".

The problem was caused by the said commit changing the layout of struct
mmc_ios which is embedded into struct ccb_trans_settings_mmc with the
latter being embedded into struct ccb_trans_settings, a member of
union ccb.

The layout mattered for two reasons:

  1. dwmmc sets cmd.error only in case of an error;
  2. mmc_da's sdda_start_init uses the same ccb for different transaction types without explicitly clearing the object between transactions.

As a result, cmd.error could start out with a non-zero value and dwmmc
would keep that value which would then be interpreted as a failure.
Such a failure happened in mmc_set_timing resulting in incorrect timing
settings and subsequent complete failure to communicate with the eMMC
module.

Reviewed by: pkelsey
MFC after: 2 weeks

Details

Provenance
avgAuthored on Jun 23 2025, 9:30 PM
Parents
rG99f436aec00e: rk3328_codec: add trivial set_sysclk method implementation
Branches
Unknown
Tags
Unknown