Skip to content

drivers/sdmmc: fix stall in _disable_sd_clk#21930

Merged
crasbe merged 2 commits intoRIOT-OS:masterfrom
fabian18:pr/sdmmc_sdhc_fix_stall_in_disable_sd_clk
Dec 5, 2025
Merged

drivers/sdmmc: fix stall in _disable_sd_clk#21930
crasbe merged 2 commits intoRIOT-OS:masterfrom
fabian18:pr/sdmmc_sdhc_fix_stall_in_disable_sd_clk

Conversation

@fabian18
Copy link
Copy Markdown
Contributor

@fabian18 fabian18 commented Dec 3, 2025

Contribution description

I saw a situation in GDB where it was hanging in this function because of SDHC_PSR_CMDINHD.
There was already a comment to handle timeout and a function _wait_sdhc_busy.
Maybe it was just forgotten here.

Testing procedure

Issues/PRs references

@github-actions github-actions bot added the Area: drivers Area: Device drivers label Dec 3, 2025
@fabian18 fabian18 added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Dec 3, 2025
@riot-ci
Copy link
Copy Markdown

riot-ci commented Dec 3, 2025

Murdock results

✔️ PASSED

63c0dc9 tests/drivers/sdmmc: choose board which has periph_sdmmc feature

Success Failures Total Runtime
10950 0 10950 11m:15s

Artifacts

@benpicco benpicco requested a review from gschorcht December 3, 2025 23:17
@benpicco benpicco added the Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) label Dec 3, 2025
Copy link
Copy Markdown
Contributor

@benpicco benpicco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_wait_sdhc_busy() does just what was open-coded here with a timeout.

@benpicco benpicco enabled auto-merge December 4, 2025 10:52
@benpicco benpicco added this pull request to the merge queue Dec 4, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 4, 2025
/* wait for command/data to go inactive */
while (sdhc->PSR.reg & (SDHC_PSR_CMDINHC | SDHC_PSR_CMDINHD)) {}
if (_wait_sdhc_busy(sdhc)) {
_reset_sdhc(sdhc, SDHC_SRR_SWRSTALL);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sdmmc_sdhc.c: In function '_disable_sd_clk':
sdmmc_sdhc.c:814:25: error: passing argument 1 of '_reset_sdhc' from incompatible pointer type [-Werror=incompatible-pointer-types]
  814 |             _reset_sdhc(sdhc, SDHC_SRR_SWRSTALL);
      |                         ^~~~
      |                         |
      |                         sdhc_t *
sdmmc_sdhc.c:685:37: note: expected 'sdhc_dev_t *' but argument is of type 'sdhc_t *'
  685 | static void _reset_sdhc(sdhc_dev_t *sdhc_dev, uint8_t type)
      |                         ~~~~~~~~~~~~^~~~~~~~

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, I tested it in another repository and did a mistake when I copied it over to my RIOT repo.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But if CI passed then there is no compile test yet. :(
I can try to add one

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make: Entering directory '/home/[email protected]/RIOT/tests/drivers/sdmmc'
There are unsatisfied feature requirements: periph_sdmmc

There is a compile tets but the default board BOARD ?= samr21-xpro is lacking the feature

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The full compile test is only on merge, 'CI: ready for build' just does a quick run with a subset of boards.

@fabian18 fabian18 force-pushed the pr/sdmmc_sdhc_fix_stall_in_disable_sd_clk branch from d27960d to 63c0dc9 Compare December 4, 2025 15:59
@github-actions github-actions bot added the Area: tests Area: tests and testing framework label Dec 4, 2025
@benpicco benpicco added this pull request to the merge queue Dec 4, 2025
@benpicco benpicco removed this pull request from the merge queue due to a manual request Dec 4, 2025
@benpicco benpicco added this pull request to the merge queue Dec 4, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 4, 2025
@crasbe crasbe added this pull request to the merge queue Dec 5, 2025
Merged via the queue into RIOT-OS:master with commit 839a6b6 Dec 5, 2025
26 checks passed
@leandrolanzieri leandrolanzieri added this to the Release 2026.01 milestone Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: drivers Area: Device drivers Area: tests Area: tests and testing framework CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants