Skip to content
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

mmc: host: Wait for Vdd to settle on card power off #214

Draft
wants to merge 2 commits into
base: nilrt/master/6.6
Choose a base branch
from

Conversation

erickshepherdNI
Copy link
Contributor

@erickshepherdNI erickshepherdNI commented Mar 12, 2025

The SD spec version 6.0 section 6.4.1.5 requires that Vdd must be
lowered to less than 0.5V for a minimum of 1 ms when powering off a
card. Increase wait to 15 ms so that voltage has time to drain down
to 0.5V and cards can power off correctly. Issues with voltage drain
time were only observed on Apollo Lake and Bay Trail host controllers
so this fix is limited to those devices.

WI#2316635

Testing

Built the kernel locally and confirmed the 15ms delay was present. Tested on a cRIO-9053 and cRIO-9043 to cover Apollo Lake and Bay Trail host controllers.

@erickshepherdNI
Copy link
Contributor Author

Adrian, the upstream maintainer, suggested that I move the delay to the set_power() callback instead of set_ios(). sdhci_set_power() gets called right before the delay in sdhci_set_ios() so I would expect this behavior to be the same. Adrian also suggested I use the usleep_range() function instead of mdelay() but didn't specify exactly why. He also wanted me to make the delay specific to Apollo Lake devices but I asked Tony Liechty, who was involved with this issue initially, and he believes the delay should be used by all of our devices. I'm going to get Adrian's opinion on this before pushing more changes upstream.

@chaitu236
Copy link
Contributor

Adrian also suggested I use the usleep_range() function instead of mdelay() but didn't specify exactly why

Possibly because mdelay wastes cpu cycles by busy spinning and is usually used in interrupt contexts where *sleep isn't allowed. msleep/usleep* lets scheduler schedule out the thread and run something else until the sleep completes and thread is runnable again.

@erickshepherdNI erickshepherdNI force-pushed the ershephe/move-vdd-delay branch from 61183d8 to eb813af Compare March 13, 2025 20:31
Copy link
Contributor

@chaitu236 chaitu236 left a comment

Choose a reason for hiding this comment

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

Changes look fine but the commit message should be made more generic around "Increase our wait..". Remove "our" and mention why 15ms is required and not 1ms as the spec says - i.e., some controllers require longer waits, etc.

The SD spec version 6.0 section 6.4.1.5 requires that Vdd must be
lowered to less than 0.5V for a minimum of 1 ms when powering off a
card. Increase wait to 15 ms so that voltage has time to drain down
to 0.5V and cards can power off correctly. Issues with voltage drain
time were only observed on Apollo Lake and Bay Trail host controllers
so this fix is limited to those devices.

Signed-off-by: Erick Shepherd <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants