Skip to content

arch: sc5xx: Revert CDU0 CLKO10/12/13/14 IS_ENABLED guards - #143

Open
CalebEthridgeADI wants to merge 1 commit into
adi-u-boot-2025.10.yfrom
fix-configure-cdu-guards
Open

arch: sc5xx: Revert CDU0 CLKO10/12/13/14 IS_ENABLED guards#143
CalebEthridgeADI wants to merge 1 commit into
adi-u-boot-2025.10.yfrom
fix-configure-cdu-guards

Conversation

@CalebEthridgeADI

Copy link
Copy Markdown

CONFIG_CDU0_CLKOxx are "int" Kconfig options carrying a clock-source select value (range 1..7). IS_ENABLED() only evaluates true when a symbol is defined to 1, so any output configured with a value other than 1 was silently skipped.

This, for example, left the clocks for the eMMC on the sc598 unconfigured, preventing the mmc from working in U-boot.

@CalebEthridgeADI
CalebEthridgeADI requested review from a team August 4, 2026 15:47
@CalebEthridgeADI CalebEthridgeADI self-assigned this Aug 4, 2026
@CalebEthridgeADI CalebEthridgeADI added the bug Something isn't working label Aug 4, 2026
@CalebEthridgeADI CalebEthridgeADI added the llm review Request a review from a LLM Reviewer label Aug 4, 2026
@CalebEthridgeADI CalebEthridgeADI moved this to In Development in ADSP Aug 4, 2026
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

LLM review

This series fixes a regression where the SC598 (SC59x/SC59x_64) eMMC clock outputs (CLKO13/CLKO14) and CLKO10/CLKO12 were silently left unconfigured.

run: 30925904194

d6ed0928 - Revert CDU0 CLKO10/12/13/14 IS_ENABLED guards

Correct and well-targeted fix. CONFIG_CDU0_CLKO10/12/13/14 are Kconfig int options (range 1..7, clock-source select), not booleans, so IS_ENABLED() only saw them as "enabled" when the configured value happened to be exactly 1 (e.g. CDU0_CLKO12=1 in sc598-htol-spl_defconfig worked by coincidence, while CDU0_CLKO10=5, CDU0_CLKO13=3, CDU0_CLKO14=3 were silently skipped).

Reproduced the exact defect standalone by lifting U-Boot's IS_ENABLED/config_enabled macros and feeding them the real defconfig values: IS_ENABLED(CLKO10=5) evaluates false, #ifdef CLKO10 correctly evaluates true. Also confirmed against the referenced upstream commit 3285a564d2b that this is an exact, minimal revert of the offending hunk, and against the ADSP-SC596/SC598 HRM (Table 3-3, "CDU Targets") that CLKO13 maps to EMMC and CLKO14 to EMMC_TIMER_CMQ, matching the eMMC symptom described in the commit message.

CI warnings

checkpatch --strict on this commit reports:

WARNING: Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible

for all four restored #ifdef blocks. This is expected and should be ignored here: it is the exact generic style suggestion that most likely caused the original regression (someone converted #ifdef to IS_ENABLED() to satisfy this warning, without checking that these Kconfig symbols are int-valued, not bool). No other checkpatch errors/warnings.

Verification data

  • Downloaded the ADSP-SC596/ADSP-SC598 Hardware Reference Manual (adsp-sc595-sc596-sc598-hrm.pdf) from analog.com and extracted the CDU chapter (pages 187-196) with PyMuPDF; Table 3-3 confirms CLKO13/CLKO14 are the EMMC/EMMC_TIMER_CMQ clock outputs, corroborating the "mmc not working" symptom.
  • Fetched upstream commit 3285a564d2b (not present in this shallow clone) to confirm the Fixes: tag and that the revert is exact and minimal.
  • Reproduced the IS_ENABLED() int-vs-bool defect standalone with host gcc using the project's own include/linux/kconfig.h macros and the real defconfig values (CDU0_CLKO10=5, etc.), confirming the block was silently skipped before this fix.
  • Could not run a full cross-compiled sc598 build in this sandbox (no arm-linux-/aarch64-linux- toolchains installed despite the documented set_arch helper), so verification relied on the standalone macro reproduction plus static/datasheet cross-checks above.

Suggested patches

A small fixup adds a comment above the restored #ifdef block explaining why IS_ENABLED() must not be used here, to prevent this exact regression from being reintroduced by a future checkpatch-driven cleanup.

Apply the suggested patches with:

cd path/to/repository
export GITHUB_TOKEN=ghp_***
apply-patches --repo=analogdevicesinc/u-boot 30925904194
Install instructions

The 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.

CONFIG_CDU0_CLKOxx are "int" Kconfig options carrying a clock-source
select value (range 1..7). IS_ENABLED() only evaluates
true when a symbol is defined to 1, so any output configured with a
value other than 1 was silently skipped.

This, for example, left the clocks for the eMMC on the sc598
unconfigured, preventing the mmc from working in U-boot.

Restore the original "#ifdef" guards so the outputs are configured
whenever the board provides a value.

Fixes: 3285a56 ("arch: sc5xx: Add SC846 DDR init hooks")
Signed-off-by: Caleb Ethridge <caleb.ethridge@analog.com>
@CalebEthridgeADI
CalebEthridgeADI force-pushed the fix-configure-cdu-guards branch from d6ed092 to be8d39c Compare August 4, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working llm review Request a review from a LLM Reviewer

Projects

Status: In Development

Development

Successfully merging this pull request may close these issues.

1 participant