mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] mci: cadence: fix device tree override of host_caps
@ 2026-04-09 14:15 Michael Tretter
  2026-04-10  7:19 ` Ahmad Fatoum
  2026-04-13  7:03 ` Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Tretter @ 2026-04-09 14:15 UTC (permalink / raw)
  To: Sascha Hauer, Steffen Trumtrar, BAREBOX; +Cc: Michael Tretter

The host_caps setting in the device tree shall override the default
host_caps set by the driver to allow board specific overrides.

Move the configuration of the driver default host_caps before the call
to mci_of_parse().

mci_of_parse() still has to be called in the middle of the mci
configuration, because f_max may be set in the device tree, but is used
to calculate f_min.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
---
 drivers/mci/cadence-sdhci.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/mci/cadence-sdhci.c b/drivers/mci/cadence-sdhci.c
index ccd0f36cb033..b76c04f5e087 100644
--- a/drivers/mci/cadence-sdhci.c
+++ b/drivers/mci/cadence-sdhci.c
@@ -471,13 +471,14 @@ static int sdhci_cdns_probe(struct device *dev)
 
 	dev->priv = priv;
 
+	priv->mci.voltages = MMC_VDD_32_33 | MMC_VDD_33_34;
+	priv->mci.host_caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA;
+	priv->mci.host_caps |= MMC_CAP_MMC_HIGHSPEED_52MHZ;
+
 	priv->mci.f_max = clk_get_rate(priv->biu_clk);
 	mci_of_parse(mci);
 	priv->mci.f_min = priv->mci.f_max / SDHCI_MAX_DIV_SPEC_300;
 
-	priv->mci.voltages = MMC_VDD_32_33 | MMC_VDD_33_34;
-	priv->mci.host_caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA;
-	priv->mci.host_caps |= MMC_CAP_MMC_HIGHSPEED_52MHZ;
 	if (is_sd4hc) {
 		ret = sdhci_cdns4_phy_probe(dev, priv);
 	} else {

---
base-commit: 86269eff785a915cfb96f09d9c7ec81a89d33012
change-id: 20260409-socfpga-agilex5-sdhci-d4179764d02f

Best regards,
-- 
Michael Tretter <m.tretter@pengutronix.de>




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mci: cadence: fix device tree override of host_caps
  2026-04-09 14:15 [PATCH] mci: cadence: fix device tree override of host_caps Michael Tretter
@ 2026-04-10  7:19 ` Ahmad Fatoum
  2026-04-13  7:03 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2026-04-10  7:19 UTC (permalink / raw)
  To: Michael Tretter, Sascha Hauer, Steffen Trumtrar, BAREBOX

On 4/9/26 4:15 PM, Michael Tretter wrote:
> The host_caps setting in the device tree shall override the default
> host_caps set by the driver to allow board specific overrides.
> 
> Move the configuration of the driver default host_caps before the call
> to mci_of_parse().
> 
> mci_of_parse() still has to be called in the middle of the mci
> configuration, because f_max may be set in the device tree, but is used
> to calculate f_min.
> 
> Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>

Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

> ---
>  drivers/mci/cadence-sdhci.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mci/cadence-sdhci.c b/drivers/mci/cadence-sdhci.c
> index ccd0f36cb033..b76c04f5e087 100644
> --- a/drivers/mci/cadence-sdhci.c
> +++ b/drivers/mci/cadence-sdhci.c
> @@ -471,13 +471,14 @@ static int sdhci_cdns_probe(struct device *dev)
>  
>  	dev->priv = priv;
>  
> +	priv->mci.voltages = MMC_VDD_32_33 | MMC_VDD_33_34;
> +	priv->mci.host_caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA;
> +	priv->mci.host_caps |= MMC_CAP_MMC_HIGHSPEED_52MHZ;
> +
>  	priv->mci.f_max = clk_get_rate(priv->biu_clk);
>  	mci_of_parse(mci);
>  	priv->mci.f_min = priv->mci.f_max / SDHCI_MAX_DIV_SPEC_300;
>  
> -	priv->mci.voltages = MMC_VDD_32_33 | MMC_VDD_33_34;
> -	priv->mci.host_caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA;
> -	priv->mci.host_caps |= MMC_CAP_MMC_HIGHSPEED_52MHZ;
>  	if (is_sd4hc) {
>  		ret = sdhci_cdns4_phy_probe(dev, priv);
>  	} else {
> 
> ---
> base-commit: 86269eff785a915cfb96f09d9c7ec81a89d33012
> change-id: 20260409-socfpga-agilex5-sdhci-d4179764d02f
> 
> Best regards,

-- 
Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mci: cadence: fix device tree override of host_caps
  2026-04-09 14:15 [PATCH] mci: cadence: fix device tree override of host_caps Michael Tretter
  2026-04-10  7:19 ` Ahmad Fatoum
@ 2026-04-13  7:03 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2026-04-13  7:03 UTC (permalink / raw)
  To: Steffen Trumtrar, BAREBOX, Michael Tretter


On Thu, 09 Apr 2026 16:15:09 +0200, Michael Tretter wrote:
> The host_caps setting in the device tree shall override the default
> host_caps set by the driver to allow board specific overrides.
> 
> Move the configuration of the driver default host_caps before the call
> to mci_of_parse().
> 
> mci_of_parse() still has to be called in the middle of the mci
> configuration, because f_max may be set in the device tree, but is used
> to calculate f_min.
> 
> [...]

Applied, thanks!

[1/1] mci: cadence: fix device tree override of host_caps
      https://git.pengutronix.de/cgit/barebox/commit/?id=dc5f6b53a25c (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-04-13  7:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-04-09 14:15 [PATCH] mci: cadence: fix device tree override of host_caps Michael Tretter
2026-04-10  7:19 ` Ahmad Fatoum
2026-04-13  7:03 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox