From: Tanmay Kathpalia Date: Wed, 3 Dec 2025 12:21:36 +0000 (-0800) Subject: mmc: sdhci-cadence: Use hardware version field for Cadence SDHCI controller X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7d52b66b9b8e00815ef968c4ad0f2f704228fb69;p=thirdparty%2Fu-boot.git mmc: sdhci-cadence: Use hardware version field for Cadence SDHCI controller Replace device tree compatible string checks with hardware version field detection to determine SDHCI controller capabilities. This approach is more robust and aligns with standard SDHCI specification practices. Controllers with SDHCI version 4.2 and above will automatically use the enhanced PHY adjustment, and tuning v6-specific procedures. Signed-off-by: Tanmay Kathpalia Reviewed-by: Balsundar Ponnusamy Acked-by: Peng Fan Signed-off-by: Peng Fan --- diff --git a/drivers/mmc/sdhci-cadence.c b/drivers/mmc/sdhci-cadence.c index 5e2a4037605..a0b9434e4f0 100644 --- a/drivers/mmc/sdhci-cadence.c +++ b/drivers/mmc/sdhci-cadence.c @@ -151,7 +151,7 @@ static void sdhci_cdns_set_control_reg(struct sdhci_host *host) if (IS_SD(mmc)) sdhci_set_control_reg(host); - if (device_is_compatible(mmc->dev, "cdns,sd6hc")) + if (SDHCI_GET_VERSION(host) >= SDHCI_SPEC_420) sdhci_cdns6_phy_adj(mmc->dev, plat, mmc->selected_mode); } @@ -162,11 +162,13 @@ static const struct sdhci_ops sdhci_cdns_ops = { static int sdhci_cdns_set_tune_val(struct sdhci_cdns_plat *plat, unsigned int val) { + struct mmc *mmc = &plat->mmc; + struct sdhci_host *host = dev_get_priv(mmc->dev); void __iomem *reg = plat->hrs_addr + SDHCI_CDNS_HRS06; u32 tmp; int i, ret; - if (device_is_compatible(plat->mmc.dev, "cdns,sd6hc")) + if (SDHCI_GET_VERSION(host) >= SDHCI_SPEC_420) return sdhci_cdns6_set_tune_val(plat, val); if (WARN_ON(!FIELD_FIT(SDHCI_CDNS_HRS06_TUNE, val)))