]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
mmc: fsl_esdhc_imx: Use esdhc_soc_data flags to set host caps
authorAdam Ford <aford173@gmail.com>
Wed, 12 Jan 2022 13:53:56 +0000 (07:53 -0600)
committerStefano Babic <sbabic@denx.de>
Sat, 19 Feb 2022 13:46:54 +0000 (14:46 +0100)
The Linux driver automatically can detect and enable UHS, HS200, HS400
and HS400_ES automatically without extra flags being placed into the
device tree.

Right now, for U-Boot to use UHS, HS200 or HS400, the extra flags are
needed in the device tree.  Instead, go through the esdhc_soc_data
flags and enable the host caps where applicable to automatically
enable higher speeds.

Suggested-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Adam Ford <aford173@gmail.com>
drivers/mmc/fsl_esdhc_imx.c

index 32b42c3fd5cb8be7b153b5c94224ed3c25e2d3d8..fcfbaa7d4043a662727af3a2cf667ad0b7cad228 100644 (file)
@@ -1224,8 +1224,29 @@ static int fsl_esdhc_init(struct fsl_esdhc_priv *priv,
                        val |= ESDHC_TUNING_CMD_CRC_CHECK_DISABLE;
                        esdhc_write32(&regs->tuning_ctrl, val);
                }
-       }
 
+               /*
+                * UHS doesn't have explicit ESDHC flags, so if it's
+                * not supported, disable it in config.
+                */
+               if (CONFIG_IS_ENABLED(MMC_UHS_SUPPORT))
+                       cfg->host_caps |= UHS_CAPS;
+
+               if (CONFIG_IS_ENABLED(MMC_HS200_SUPPORT)) {
+                       if (priv->flags & ESDHC_FLAG_HS200)
+                               cfg->host_caps |= MMC_CAP(MMC_HS_200);
+               }
+
+               if (CONFIG_IS_ENABLED(MMC_HS400_SUPPORT)) {
+                       if (priv->flags & ESDHC_FLAG_HS400)
+                               cfg->host_caps |= MMC_CAP(MMC_HS_400);
+               }
+
+               if (CONFIG_IS_ENABLED(MMC_HS400_ES_SUPPORT)) {
+                       if (priv->flags & ESDHC_FLAG_HS400_ES)
+                               cfg->host_caps |= MMC_CAP(MMC_HS_400_ES);
+               }
+       }
        return 0;
 }