Documented CSD parsing expectations for SDIO lower-half#18543
Merged
acassis merged 5 commits intoapache:masterfrom Mar 17, 2026
Merged
Documented CSD parsing expectations for SDIO lower-half#18543acassis merged 5 commits intoapache:masterfrom
acassis merged 5 commits intoapache:masterfrom
Conversation
a20aa66 to
7616424
Compare
linguini1
requested changes
Mar 16, 2026
xiaoxiang781216
previously approved these changes
Mar 17, 2026
7616424 to
91ea749
Compare
acassis
previously approved these changes
Mar 17, 2026
This update adds comprehensive documentation regarding the 136-bit response format for SDIO, including the structure of the response, CRC handling, and necessary byte-shifting for alignment. This information is crucial for developers implementing or maintaining SDIO drivers. Signed-off-by: Arjav Patel <arjav1528@gmail.com>
This update expands the documentation for implementing an SDIO lower-half driver, detailing the required interface, call-flow, and handling of the R2 response format. It emphasizes the importance of byte-shifting when the CRC is stripped by the hardware, providing reference implementations for clarity. Signed-off-by: Arjav Patel <arjav1528@gmail.com>
…ation This update adds a reference to the SDIO Driver Documentation for implementers of SDIO lower-half drivers, emphasizing the importance of understanding R2/CSD response handling and the correct implementation of the lower-half interface. Signed-off-by: Arjav Patel <arjav1528@gmail.com>
This update clarifies the call-flow for the SDIO lower-half driver implementation by providing a simplified example of the interaction between the MMCSD upper-half and the lower-half. It details the command sequence for handling R2 responses, improving the understanding of the expected behavior during card identification and initialization. Signed-off-by: Arjav Patel <arjav1528@gmail.com>
This update enhances the SDIO documentation by including a reference to the card initialization flowchart in the MMC/SD physical layer specification. This addition aims to provide implementers with a clearer understanding of the complete card initialization and command sequence. Signed-off-by: Arjav Patel <arjav1528@gmail.com>
91ea749 to
1feaaf6
Compare
acassis
approved these changes
Mar 17, 2026
linguini1
approved these changes
Mar 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: #17248
Summary
Addressed the issue by documenting how SDIO lower-half drivers must provide R2 (CID/CSD) responses and by adding a small sanity check in the MMCSD upper-half.
include/nuttx/sdio.hnow explains the R2 format, states that the upper-half expects a 128‑bit CID/CSD payload in the standard layout, and notes that controllers which strip the CRC must shift the four 32‑bit words left by one byte (withbcm2711_sdio.candimx9_usdhc.cas examples).mmcsd_decode_csdindrivers/mmcsd/mmcsd_sdio.cgains aDEBUGASSERT(csd[0] != 0);underCONFIG_DEBUG_FEATURESto catch obviously invalid or misaligned CSDs, and the SDIO/MMCSD docs now describe the SDIO lower-half call-flow and R2/CSD expectations and point implementers to this guidance.Impact
DEBUGASSERTinmmcsd_decode_csdis added; there is no behavior or performance change in non‑debug builds.recv_r2/R2 handling (including CRC‑stripping controllers), and MMCSD docs direct SDIO lower‑half implementers there./dev/mmcsd*users is unchanged.Testing
make htmlinDocumentation/to verify the updated RST documentation builds successfully.DEBUGASSERTbehavior is validated by static inspection only.