-
Notifications
You must be signed in to change notification settings - Fork 2.1k
drivers/sdmmc_sdhc: add timeout to wait for ISR mutex unlock #21432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
drivers/sdmmc/sdmmc_sdhc.c
Outdated
#define _ZTIMER_CLOCK ZTIMER_MSEC | ||
#define _ZTIMER_TICKS_PER_MS 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#define _ZTIMER_CLOCK ZTIMER_MSEC | |
#define _ZTIMER_TICKS_PER_MS 1 | |
# define _ZTIMER_CLOCK ZTIMER_MSEC | |
# define _ZTIMER_TICKS_PER_MS 1 |
drivers/sdmmc/sdmmc_sdhc.c
Outdated
#define _ZTIMER_CLOCK ZTIMER_USEC | ||
#define _ZTIMER_TICKS_PER_MS US_PER_MS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#define _ZTIMER_CLOCK ZTIMER_USEC | |
#define _ZTIMER_TICKS_PER_MS US_PER_MS | |
# define _ZTIMER_CLOCK ZTIMER_USEC | |
# define _ZTIMER_TICKS_PER_MS US_PER_MS |
I'm not sure if it makes sense to partially apply the indentation style now?
OR you could use the opportunity to apply it to the other #if-#else statements as well.
Ping @maribu?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ping @maribu
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm always happy when we add the indent. But as long as the CI does not enforce this, it is not really mandatory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small thing: The title and commit message should have a slash instead of colon. So |
48b1ae9
to
7ffe014
Compare
drivers/sdmmc/sdmmc_sdhc.c
Outdated
@@ -832,7 +841,7 @@ static int _sdhc_to_sdmmc_err_code(uint16_t code) | |||
static void _isr(sdhc_dev_t *sdhc_dev) | |||
{ | |||
sdhc_t *sdhc = sdhc_dev->conf->sdhc; | |||
|
|||
DEBUG_PUTS("[sdmmc] IRQ"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably a leftover from debugging, but it probably shouldn't stay.
drivers/sdmmc/sdmmc_sdhc.c
Outdated
if (timeout || (sdhc_dev->error & error_mask)) { | ||
if (IS_USED(ENABLE_DEBUG)) { | ||
if (timeout) { | ||
DEBUG("[sdmmc] IRQ wait timeout\n"); | ||
} | ||
DEBUG("[sdmmc] SDHC error: EISTR=%04x, ", sdhc_dev->error); | ||
switch (reset) { | ||
case SDHC_SRR_SWRSTCMD: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
???
if (timeout || (sdhc_dev->error & error_mask)) { | |
if (IS_USED(ENABLE_DEBUG)) { | |
if (timeout) { | |
DEBUG("[sdmmc] IRQ wait timeout\n"); | |
} | |
DEBUG("[sdmmc] SDHC error: EISTR=%04x, ", sdhc_dev->error); | |
switch (reset) { | |
case SDHC_SRR_SWRSTCMD: | |
if (timeout || (sdhc_dev->error & error_mask)) { | |
if (IS_USED(ENABLE_DEBUG)) { | |
if (timeout) { | |
DEBUG("[sdmmc] IRQ wait timeout\n"); | |
} | |
else { | |
DEBUG("[sdmmc] SDHC error: EISTR=%04x, ", sdhc_dev->error); | |
switch (reset) { | |
case SDHC_SRR_SWRSTCMD: | |
... |
Either a timeout happend or an SDHC error happened, right? If so, the DEBUG message for SDHC error shouldn't be generated in case of timeout error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, please quash.
562958b
to
94286a3
Compare
Contribution description
I witnessed situations where the sdmmc driver stalls while waiting for an IRQ.
It might be hardware though ...
However even if it is hardware, it keeps going with this changes in this PR.
Testing procedure
Internal app where data is written to an eMMC and I keep pressing ENTER to continuously execute
vfs ls
.Without the change it was stalling. With this change it keeps working afterwards.
Issues/PRs references