All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yixun Lan <dlan@gentoo.org>
To: Iker Pedrosa <ikerpedrosam@gmail.com>
Cc: Ulf Hansson <ulf.hansson@linaro.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Paul Walmsley <pjw@kernel.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Alexandre Ghiti <alex@ghiti.fr>,
	Michael Opdenacker <michael.opdenacker@rootcommit.com>,
	Javier Martinez Canillas <javierm@redhat.com>,
	linux-mmc@vger.kernel.org, devicetree@vger.kernel.org,
	linux-riscv@lists.infradead.org, spacemit@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 03/10] mmc: sdhci-of-k1: add regulator framework support
Date: Mon, 9 Mar 2026 14:34:16 +0800	[thread overview]
Message-ID: <20260309063416-GYB318052@gentoo.org> (raw)
In-Reply-To: <20260302-orangepi-sd-card-uhs-v1-3-89c219973c0c@gmail.com>

Hi IKer,

On 16:13 Mon 02 Mar     , Iker Pedrosa wrote:
> Add regulator framework support for voltage switching operations. This
> enables proper PMIC control for UHS voltage switching between 3.3V and
> 1.8V signaling levels.
> 
> - Add regulator supply parsing
> - Implement voltage switching callback
> - Enable mmc regulator framework integration
> 
> Signed-off-by: Iker Pedrosa <ikerpedrosam@gmail.com>
> ---
>  drivers/mmc/host/sdhci-of-k1.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci-of-k1.c b/drivers/mmc/host/sdhci-of-k1.c
> index b703b78282ed8d89183c816477c149c0a565618a..c260cb89704ae7a25bec0f07831d495553405bbd 100644
> --- a/drivers/mmc/host/sdhci-of-k1.c
> +++ b/drivers/mmc/host/sdhci-of-k1.c
> @@ -216,6 +216,12 @@ static void spacemit_sdhci_pre_hs400_to_hs200(struct mmc_host *mmc)
>  			       SPACEMIT_SDHC_PHY_CTRL_REG);
>  }
>  
> +static int spacemit_sdhci_start_signal_voltage_switch(struct mmc_host *mmc,
> +						      struct mmc_ios *ios)
> +{
> +	return sdhci_start_signal_voltage_switch(mmc, ios);
> +}
I'd suggest to implement voltage_switch() instead of start_signal_voltage_switch(),
and put the pinctrl state switch here, which will be called by
start_signal_voltage_switch(), see drivers/mmc/host/sdhci.c for more detail

sdhci_start_signal_voltage_switch() -> voltage_switch()

static const struct sdhci_ops spacemit_sdhci_ops = {
..
	.voltage_switch         = spacemit_sdhci_voltage_switch,
..

> +
>  static inline int spacemit_sdhci_get_clocks(struct device *dev,
>  					    struct sdhci_pltfm_host *pltfm_host)
>  {
> @@ -291,6 +297,12 @@ static int spacemit_sdhci_probe(struct platform_device *pdev)
>  
>  	host->mmc->caps |= MMC_CAP_NEED_RSP_BUSY;
>  
..
> +	ret = mmc_regulator_get_supply(host->mmc);
I think this is unnecessary which already handled in core framework, see
spacemit_sdhci_probbe() -> sdhci_add_host() -> sdhci_setup_host()

https://github.com/torvalds/linux/blob/v7.0-rc3/drivers/mmc/host/sdhci.c#L4289

> +	if (ret)
> +		dev_warn(dev, "Failed to get regulators: %d\n", ret);
> +
> +	host->mmc_host_ops.start_signal_voltage_switch = spacemit_sdhci_start_signal_voltage_switch;
> +
with above, this line can be dropped too

>  	ret = spacemit_sdhci_get_clocks(dev, pltfm_host);
>  	if (ret)
>  		goto err_pltfm;
> 
> -- 
> 2.53.0
> 

-- 
Yixun Lan (dlan)

WARNING: multiple messages have this Message-ID (diff)
From: Yixun Lan <dlan@gentoo.org>
To: Iker Pedrosa <ikerpedrosam@gmail.com>
Cc: Ulf Hansson <ulf.hansson@linaro.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Paul Walmsley <pjw@kernel.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Alexandre Ghiti <alex@ghiti.fr>,
	Michael Opdenacker <michael.opdenacker@rootcommit.com>,
	Javier Martinez Canillas <javierm@redhat.com>,
	linux-mmc@vger.kernel.org, devicetree@vger.kernel.org,
	linux-riscv@lists.infradead.org, spacemit@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 03/10] mmc: sdhci-of-k1: add regulator framework support
Date: Mon, 9 Mar 2026 14:34:16 +0800	[thread overview]
Message-ID: <20260309063416-GYB318052@gentoo.org> (raw)
In-Reply-To: <20260302-orangepi-sd-card-uhs-v1-3-89c219973c0c@gmail.com>

Hi IKer,

On 16:13 Mon 02 Mar     , Iker Pedrosa wrote:
> Add regulator framework support for voltage switching operations. This
> enables proper PMIC control for UHS voltage switching between 3.3V and
> 1.8V signaling levels.
> 
> - Add regulator supply parsing
> - Implement voltage switching callback
> - Enable mmc regulator framework integration
> 
> Signed-off-by: Iker Pedrosa <ikerpedrosam@gmail.com>
> ---
>  drivers/mmc/host/sdhci-of-k1.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci-of-k1.c b/drivers/mmc/host/sdhci-of-k1.c
> index b703b78282ed8d89183c816477c149c0a565618a..c260cb89704ae7a25bec0f07831d495553405bbd 100644
> --- a/drivers/mmc/host/sdhci-of-k1.c
> +++ b/drivers/mmc/host/sdhci-of-k1.c
> @@ -216,6 +216,12 @@ static void spacemit_sdhci_pre_hs400_to_hs200(struct mmc_host *mmc)
>  			       SPACEMIT_SDHC_PHY_CTRL_REG);
>  }
>  
> +static int spacemit_sdhci_start_signal_voltage_switch(struct mmc_host *mmc,
> +						      struct mmc_ios *ios)
> +{
> +	return sdhci_start_signal_voltage_switch(mmc, ios);
> +}
I'd suggest to implement voltage_switch() instead of start_signal_voltage_switch(),
and put the pinctrl state switch here, which will be called by
start_signal_voltage_switch(), see drivers/mmc/host/sdhci.c for more detail

sdhci_start_signal_voltage_switch() -> voltage_switch()

static const struct sdhci_ops spacemit_sdhci_ops = {
..
	.voltage_switch         = spacemit_sdhci_voltage_switch,
..

> +
>  static inline int spacemit_sdhci_get_clocks(struct device *dev,
>  					    struct sdhci_pltfm_host *pltfm_host)
>  {
> @@ -291,6 +297,12 @@ static int spacemit_sdhci_probe(struct platform_device *pdev)
>  
>  	host->mmc->caps |= MMC_CAP_NEED_RSP_BUSY;
>  
..
> +	ret = mmc_regulator_get_supply(host->mmc);
I think this is unnecessary which already handled in core framework, see
spacemit_sdhci_probbe() -> sdhci_add_host() -> sdhci_setup_host()

https://github.com/torvalds/linux/blob/v7.0-rc3/drivers/mmc/host/sdhci.c#L4289

> +	if (ret)
> +		dev_warn(dev, "Failed to get regulators: %d\n", ret);
> +
> +	host->mmc_host_ops.start_signal_voltage_switch = spacemit_sdhci_start_signal_voltage_switch;
> +
with above, this line can be dropped too

>  	ret = spacemit_sdhci_get_clocks(dev, pltfm_host);
>  	if (ret)
>  		goto err_pltfm;
> 
> -- 
> 2.53.0
> 

-- 
Yixun Lan (dlan)

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  parent reply	other threads:[~2026-03-09  6:34 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-02 15:13 [PATCH 00/10] riscv: spacemit: enable SD card support with UHS modes for OrangePi RV2 Iker Pedrosa
2026-03-02 15:13 ` Iker Pedrosa
2026-03-02 15:13 ` [PATCH 01/10] dt-bindings: mmc: spacemit,sdhci: add AIB voltage switching registers Iker Pedrosa
2026-03-02 15:13   ` Iker Pedrosa
2026-03-02 18:25   ` Conor Dooley
2026-03-02 18:25     ` Conor Dooley
2026-03-02 22:38     ` Yixun Lan
2026-03-02 22:38       ` Yixun Lan
2026-03-03 13:51       ` Iker Pedrosa
2026-03-03 13:51         ` Iker Pedrosa
2026-03-03 22:28         ` Yixun Lan
2026-03-03 22:28           ` Yixun Lan
2026-03-04  8:10           ` Iker Pedrosa
2026-03-04  8:10             ` Iker Pedrosa
2026-03-02 15:13 ` [PATCH 02/10] mmc: sdhci-of-k1: enable essential clock infrastructure for SD operation Iker Pedrosa
2026-03-02 15:13   ` Iker Pedrosa
2026-03-07  2:29   ` Yixun Lan
2026-03-07  2:29     ` Yixun Lan
2026-03-09 10:32     ` Iker Pedrosa
2026-03-09 10:32       ` Iker Pedrosa
2026-03-02 15:13 ` [PATCH 03/10] mmc: sdhci-of-k1: add regulator framework support Iker Pedrosa
2026-03-02 15:13   ` Iker Pedrosa
2026-03-03  4:11   ` Yao Zi
2026-03-03  4:11     ` Yao Zi
2026-03-03 13:58     ` Iker Pedrosa
2026-03-03 13:58       ` Iker Pedrosa
2026-03-09  6:34   ` Yixun Lan [this message]
2026-03-09  6:34     ` Yixun Lan
2026-03-02 15:13 ` [PATCH 04/10] mmc: sdhci-of-k1: add pinctrl state switching for voltage changes Iker Pedrosa
2026-03-02 15:13   ` Iker Pedrosa
2026-03-02 15:13 ` [PATCH 05/10] mmc: sdhci-of-k1: add AIB register support for voltage switching Iker Pedrosa
2026-03-02 15:13   ` Iker Pedrosa
2026-03-02 15:13 ` [PATCH 06/10] mmc: sdhci-of-k1: add SDR tuning infrastructure Iker Pedrosa
2026-03-02 15:13   ` Iker Pedrosa
2026-03-02 15:13 ` [PATCH 07/10] mmc: sdhci-of-k1: add comprehensive SDR tuning support Iker Pedrosa
2026-03-02 15:13   ` Iker Pedrosa
2026-03-02 15:13 ` [PATCH 08/10] riscv: dts: spacemit: k1: add SD card controller and pinctrl support Iker Pedrosa
2026-03-02 15:13   ` Iker Pedrosa
2026-03-02 15:13 ` [PATCH 09/10] riscv: dts: spacemit: k1-orangepi-rv2: add PMIC and power infrastructure Iker Pedrosa
2026-03-02 15:13   ` Iker Pedrosa
2026-03-02 15:13 ` [PATCH 10/10] riscv: dts: spacemit: k1-orangepi-rv2: add SD card support with UHS modes Iker Pedrosa
2026-03-02 15:13   ` Iker Pedrosa
2026-03-04 14:06 ` [PATCH 00/10] riscv: spacemit: enable SD card support with UHS modes for OrangePi RV2 Michael Opdenacker
2026-03-04 14:06   ` Michael Opdenacker

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=20260309063416-GYB318052@gentoo.org \
    --to=dlan@gentoo.org \
    --cc=adrian.hunter@intel.com \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=ikerpedrosam@gmail.com \
    --cc=javierm@redhat.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=michael.opdenacker@rootcommit.com \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    --cc=robh@kernel.org \
    --cc=spacemit@lists.linux.dev \
    --cc=ulf.hansson@linaro.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.