Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Iker Pedrosa" <ikerpedrosam@gmail.com>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org,
	krzk+dt@kernel.org, robh@kernel.org
Subject: Re: [PATCH v9 2/8] mmc: sdhci-of-k1: enable essential clock infrastructure for SD operation
Date: Tue, 12 May 2026 01:13:30 +0000	[thread overview]
Message-ID: <20260512011330.BD609C2BCB0@smtp.kernel.org> (raw)
In-Reply-To: <20260511-orangepi-sd-card-uhs-v9-2-ae48c0b2b2cf@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] Incorrect condition used for targeting removable card scenarios, leading to power regressions for SDIO devices.
- [Medium] Missing explicit clear of SD-specific vendor overrides for non-SD controllers.
--

commit acf2ed5de9b1d692d653b998c6c50d3cddd4cff5
Author: Iker Pedrosa <ikerpedrosam@gmail.com>

mmc: sdhci-of-k1: enable essential clock infrastructure for SD operation

This commit enables clock generation for SD operation on the spacemit
sdhci-of-k1 controller. It sets SDHC_GEN_PAD_CLK_ON for all modes and
conditionally overrides automatic clock gating for SD-only controllers
to handle removable card scenarios.

> diff --git a/drivers/mmc/host/sdhci-of-k1.c b/drivers/mmc/host/sdhci-of-k1.c
> index 455656f9842df..0dd06fc19b857 100644
> --- a/drivers/mmc/host/sdhci-of-k1.c
> +++ b/drivers/mmc/host/sdhci-of-k1.c

[ ... ]

> @@ -101,6 +108,12 @@ static void spacemit_sdhci_reset(struct sdhci_host *host, u8 mask)
>  
>  	if (!(host->mmc->caps2 & MMC_CAP2_NO_MMC))
>  		spacemit_sdhci_setbits(host, SDHC_MMC_CARD_MODE, SPACEMIT_SDHC_MMC_CTRL_REG);
> +
> +	spacemit_sdhci_setbits(host, SDHC_GEN_PAD_CLK_ON, SPACEMIT_SDHC_LEGACY_CTRL_REG);
> +
> +	if (host->mmc->caps2 & MMC_CAP2_NO_MMC)
> +		spacemit_sdhci_setbits(host, SDHC_OVRRD_CLK_OEN | SDHC_FORCE_CLK_ON,
> +				       SPACEMIT_SDHC_OP_EXT_REG);
>  }

The commit message states that the SD-specific clock overrides are intended
to handle removable card scenarios. Does checking for MMC_CAP2_NO_MMC
unintentionally apply these overrides to non-removable SDIO devices?

The MMC_CAP2_NO_MMC flag indicates the absence of eMMC support, which will
evaluate to true for both removable SD cards and non-removable SDIO modules
like Wi-Fi chips.

If the clock is forced to remain continuously on for SDIO devices, could this
override automatic clock gating and cause a power regression by preventing
deep sleep states?

Additionally, does this setup leave the vendor-specific clock overrides active
on eMMC interfaces if they were previously set by a bootloader?

Since SPACEMIT_SDHC_OP_EXT_REG is a vendor-specific register located at offset
0x108, it is typically untouched by the standard SDHCI_RESET_ALL mechanism.

If a prior execution stage leaves SDHC_OVRRD_CLK_OEN or SDHC_FORCE_CLK_ON set,
the absence of an explicit clear in this path could prevent automatic clock
gating on eMMC interfaces.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260511-orangepi-sd-card-uhs-v9-0-ae48c0b2b2cf@gmail.com?part=2

  reply	other threads:[~2026-05-12  1:13 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-11  8:53 [PATCH v9 0/8] riscv: spacemit: enable SD card support with UHS modes for OrangePi RV2 Iker Pedrosa
2026-05-11  8:53 ` [PATCH v9 1/8] dt-bindings: mmc: spacemit,sdhci: add pinctrl support for voltage switching Iker Pedrosa
2026-05-12  1:01   ` sashiko-bot
2026-05-11  8:53 ` [PATCH v9 2/8] mmc: sdhci-of-k1: enable essential clock infrastructure for SD operation Iker Pedrosa
2026-05-12  1:13   ` sashiko-bot [this message]
2026-05-11  8:53 ` [PATCH v9 3/8] mmc: sdhci-of-k1: add regulator and pinctrl voltage switching support Iker Pedrosa
2026-05-12  2:01   ` sashiko-bot
2026-05-11  8:53 ` [PATCH v9 4/8] mmc: sdhci-of-k1: add comprehensive SDR tuning support Iker Pedrosa
2026-05-11  8:54 ` [PATCH v9 5/8] riscv: dts: spacemit: k1: add SD card controller and pinctrl support Iker Pedrosa
2026-05-12  2:47   ` sashiko-bot
2026-05-11  8:54 ` [PATCH v9 6/8] riscv: dts: spacemit: k1-orangepi-rv2: add SD card support with UHS modes Iker Pedrosa
2026-05-12  3:20   ` sashiko-bot
2026-05-11  8:54 ` [PATCH v9 7/8] riscv: dts: spacemit: k1-bananapi-f3: " Iker Pedrosa
2026-05-11 16:55   ` Aurelien Jarno
2026-05-12  3:32   ` sashiko-bot
2026-05-12  5:43   ` Yixun Lan
2026-05-12 17:03     ` Aurelien Jarno
2026-05-11  8:54 ` [PATCH v9 8/8] riscv: dts: spacemit: k1-musepi-pro: " Iker Pedrosa
2026-05-11 11:43   ` Andre Heider
2026-05-12  3:48   ` sashiko-bot
2026-05-12  5:20   ` Yixun Lan
2026-05-11 15:40 ` [PATCH v9 0/8] riscv: spacemit: enable SD card support with UHS modes for OrangePi RV2 Ulf Hansson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260512011330.BD609C2BCB0@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=ikerpedrosam@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox