Repository navigation
Add SC846 EMMC support - #164
qasim-ijaz wants to merge 4 commits into
Conversation
dfcfc05 to
8c08623
Compare
68eaa0f to
4e65c38
Compare
sipraga
left a comment
There was a problem hiding this comment.
I know it's a draft but here's some driveby comments since I was curious
LLM reviewThis series adds eMMC support for ADSP-SC846 (MISCREG timer clock enable, SDHCI capability-based Session: 37423885987 Review commentsAll four comments from CI warningsThe three
Fixup patches for these are attached below. Verification dataNo public ADSP-SC846 datasheet exists yet (checked the ADI PDF sitemap — the SC5xx family Builds were run locally with Two items worth double-checking before merge, in light of 3
Suggested patches
These are message-only Apply with: cd path/to/repository
export GITHUB_TOKEN=ghp_***
apply-patches --repo=analogdevicesinc/u-boot 37423885987Install instructionsThe following one-liner installs the script if not present already: curl -fSsL "https://raw.githubusercontent.com/analogdevicesinc/doctools/refs/heads/main/ci/scripts/apply-patches.sh" -o ~/.local/bin/apply-patches.sh && grep -q "/apply-patches.sh" ~/.bashrc || echo "source ~/.local/bin/apply-patches.sh" >> $_ ; . $_More information at AI Usage. |
|
A did a local LLM review with different prompting. I'd have to look more carefully, but I think some of this can go upstream once reviewed here. Note how the series is split and the commit messages:
|
|
|
1a542a4 to
c8c39b7
Compare
c8c39b7 to
f7f4a3b
Compare
|
It seems the frequency of the eMMC card clock is: It seems right now it's clocked at 31.25 MHz via: |
f7f4a3b to
1505ea4
Compare
1505ea4 to
6c55907
Compare
nunojsa
left a comment
There was a problem hiding this comment.
Just one comment about the compatible as I just realized I was messing with the same block (syscon) for the xspi reset lines
| }; | ||
|
|
||
| miscreg_syscon: syscon@310a9000 { | ||
| compatible = "adi,adsp-sc846-miscreg-syscon", "syscon"; |
There was a problem hiding this comment.
Looks to be the same block I have for XSPI 1. Good idea to have the compatible consistent with linux I guess.
There was a problem hiding this comment.
I would go with adi,adsp-... per the comments I'm always leaving, but you guys have to agree. anyway we can also figure it out later
There was a problem hiding this comment.
ah yes! sure im fine with adi,adsp- its been used quite a bit iirc (cdu driver, pinctrl+gpio driver and probably some other places im missing) but yea would be good to be consistent @nunojsa what do you think?
There was a problem hiding this comment.
I have to be honest that I don't love much the adsp prefix everywhere. Just adds up while the real name of the platform is sc846! No strong feelings though :)
There was a problem hiding this comment.
I mean in a driver we typically have the driver (device) name as prefix. At least in there I'm not really leaning in having adsp_sc846_foo()
Add SC846 specific eMMC miscellaneous register definitions for enabling the timer clock and configuring its divider. Also introduce SC846 SDHCI match data and initialise the eMMC timer through the MISCREG syscon before probing. This enables the eMMC timer clock and programs the CQE engine clock with a divider. The CQE engine clock has the following frequency equation: CQE_freq = EMSI Source clock (CGU0 SYSCLK) / MISCREG_EMMC_TMR_CKDIV Our current SYSCLK is clocked at 500MHz, meaning the CQE engine is clocked at 10MHz via a divider of 50. If SYSCLK changes (unlikely) an appropriate divider value will be chosen. avoiding the following error message during mmc setup: mmc0: Internal clock never stabilised. It should also be noted that the max CQE_freq is 10MHz. Signed-off-by: Qasim Ijaz <Qasim.Ijaz@analog.com>
The driver previously used the max-frequency device tree property to determine the SDHCI base clock frequency. This works on ADSP-SC598 because its core clock runs at 50 MHz, matching the max-frequency property (and the underlying capabilities register). On ADSP-SC846, the MSHC core clock currently runs at 125 MHz, while the capabilities register reports 200 MHz. To generalise the clock handling for both platforms, obtain the "core" clock rate using clk_get_rate() and use it as host->max_clk. Also remove the now unused max-frequency property from the ADSP-SC598 device tree. Signed-off-by: Qasim Ijaz <Qasim.Ijaz@analog.com>
The ADSP-SC846 DWC MSHC requires additional PHY configuration for the eMMC interface. Add the SC846 specific setup and invoke it from the SDHCI set_ios_post callback. The generic SDHCI set_ios path programs controller state such as the card clock, bus width, etc. before invoking set_ios_post. Using this hook allows the SC846 specific PHY setup to run after the generic SDHCI I/O configuration has been applied, including when the MMC core changes the I/O configuration during card initialisation. Set CARD_IS_EMMC in the DWC MSHC EMMC_CTL register as per the Synopsis HRM and configure the integrated PHY and PADs with the recommended 1.8V mode settings used by SC846. This configures PHY specific fields such as PHY strength controls, pull up/down settings, slew controls, etc. To allow SC846 to perform its PHY configuration from the generic SDHCI set_ios path, add a per SoC set_ios_post callback to adi_sdhci_data and dispatch the generic SDHCI set_ios_post hook to the appropriate SoC implementation. This keeps the PHY setup specific to ADSP-SC846 while preserving the existing behaviour for other ADI DWC MSHC platforms such as ADSP-SC598. Signed-off-by: Qasim Ijaz <Qasim.Ijaz@analog.com>
Add the Synopsys DWC MSHC eMMC controller node to the ADSP-SC846 device tree, including its register range, clock, and bus width configuration, etc. Also add the ADSP-SC846 MISCREG syscon node and reference it from the eMMC controller. The MISCREG block contains the eMMC timer clock control and divider registers required by the controller. Signed-off-by: Vasileios Bimpikas <Vasileios.Bimpikas@analog.com> Signed-off-by: Qasim Ijaz <Qasim.Ijaz@analog.com>
6c55907 to
a719705
Compare
Introduce eMMC support for the ADSP-SC846. This PR extends the current adi_sdhci mmc driver to now support the ADSP-SC846. The driver currently only supports the ADSP-SC598. The changes here have been tested in U-Boot and relevant U-Boot commands such as
mmc listandmmc infoseem to work as expected. I am also able to read/write to eMMC.