]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
mmc: sdhci-cadence: Use hardware version field for Cadence SDHCI controller
authorTanmay Kathpalia <tanmay.kathpalia@altera.com>
Wed, 3 Dec 2025 12:21:36 +0000 (04:21 -0800)
committerPeng Fan <peng.fan@nxp.com>
Thu, 11 Dec 2025 12:53:52 +0000 (20:53 +0800)
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 <tanmay.kathpalia@altera.com>
Reviewed-by: Balsundar Ponnusamy <balsundar.ponnusamy@altera.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
drivers/mmc/sdhci-cadence.c

index 5e2a4037605054fe006ddaf1578a59b3699e37ba..a0b9434e4f01871b95e2d3e7e5fe6a3d848d4ccd 100644 (file)
@@ -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)))