The branch main has been updated by avg:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=10db2ad8614adc544292856c693503ca8e9c9fd9

commit 10db2ad8614adc544292856c693503ca8e9c9fd9
Author:     Andriy Gapon <a...@freebsd.org>
AuthorDate: 2025-06-23 21:30:23 +0000
Commit:     Andriy Gapon <a...@freebsd.org>
CommitDate: 2025-06-27 07:12:40 +0000

    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
---
 sys/cam/cam_ccb.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/cam/cam_ccb.h b/sys/cam/cam_ccb.h
index da98b98ba7d1..1f110686a658 100644
--- a/sys/cam/cam_ccb.h
+++ b/sys/cam/cam_ccb.h
@@ -1524,6 +1524,7 @@ cam_fill_mmcio(struct ccb_mmcio *mmcio, uint32_t retries,
        mmcio->cmd.opcode = mmc_opcode;
        mmcio->cmd.arg = mmc_arg;
        mmcio->cmd.flags = mmc_flags;
+       mmcio->cmd.error = 0;
        mmcio->stop.opcode = 0;
        mmcio->stop.arg = 0;
        mmcio->stop.flags = 0;

Reply via email to