-
Notifications
You must be signed in to change notification settings - Fork 7.7k
drivers: sdhc: fix sdhc caps field offset #91691
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
The first field in the capabilities register, "Timeout Clock Frequency" takes up the first 6 bits (5:0), not 5. Reference: 2.2.26, SD Specifications, Part A2, SD Host Controller Simplified Specification, Version 4.20 URL: https://www.sdcard.org/downloads/pls/pdf/?p=PartA2_SD%20Host_Controller_Simplified_Specification_Ver4.20.jpg Signed-off-by: Amneesh Singh <a-singh7@ti.com>
|
Actually on further inspection, seems like the struct was written as a bitfield to fit the capabilities register like a fiddle (hence the names of the reserved fields). However, some fields were added (and some were also omitted) that makes it very weird to look at. I will see if this needs more changes. We can do two things
|
Created a more comprehensive patch here: #91701 that splits standard capabilities from non standard capabilities. Please do let me know if this is desirable before I undraft it and ping every affected maintainer. |
This looks like the same PR- did you intend to link to a different draft? |
We can do two things
Yup, the struct was originally written to follow the capabilities register in the SD host specification (although the offset error this PR fixes always existed), but when MMC support was added the struct deviated from that format. Can you update the link to your more comprehensive patch? I think making this struct match the SDHCI specification would be best
Sure- the only reason common definitions don't exist right now is because not every SDHC IP I've encountered works well with the SDHCI specification, some need vendor specific registers |
Oops my bad, edited: #91701 |
Closing in favor of #91701 |
The first field in the capabilities register, "Timeout Clock Frequency" takes up the first 6 bits (5:0), not 5.
Reference: 2.2.26, SD Specifications, Part A2, SD Host Controller
Simplified Specification, Version 4.20
URL: https://www.sdcard.org/downloads/pls/pdf/?p=PartA2_SD%20Host_Controller_Simplified_Specification_Ver4.20.jpg
Side note: I am writing an SDHCI driver and found that most drivers write their own struct/macros for the SDHC registers, is it possible to have a common definition for these registers to avoid duplicated code?