Skip to contentSkip to conversation

mmc: fsl_esdhc_imx: drop redundant clock settings

PATCH New Peng Fan 1 participant 2 messages Nov 4, 2019

Subsystems (2)
lore
Share & tools
lore

Peng Fan

author
#0 lore raw

PATCH 1/2 mmc: fsl_esdhc_imx: drop redundant clock settings

During mmc initialization, there are several calls to mmc_set_clock and mmc_set_ios. When mmc_power_off, the mmc->clock will be set, but the imx driver will use 400KHz. So the following calls to mmc_set_ios will set the clock several times which is redundant in fsl_esdhc_imx driver. So let's simplify to remove redundant clock settings.

---
 drivers/mmc/fsl_esdhc_imx.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/mmc/fsl_esdhc_imx.c +7 -5
index 43106dec75..67549036d4 100644
@@ -627,9 +627,6 @@ static void set_sysctl(struct fsl_esdhc_priv *priv, struct mmc *mmc, uint clock)
 	int sdhc_clk = priv->sdhc_clk;
 	uint clk;
 
-	if (clock < mmc->cfg->f_min)
-		clock = mmc->cfg->f_min;
-
 	while (sdhc_clk / (16 * pre_div * ddr_pre_div) > clock && pre_div < 256)
 		pre_div *= 2;
 
@@ -958,6 +955,7 @@ static int esdhc_set_ios_common(struct fsl_esdhc_priv *priv, struct mmc *mmc)
 {
 	struct fsl_esdhc *regs = priv->esdhc_regs;
 	int ret __maybe_unused;
+	u32 clock;
 
 #ifdef CONFIG_FSL_ESDHC_USE_PERIPHERAL_CLK
 	/* Select to use peripheral clock */
@@ -966,8 +964,12 @@ static int esdhc_set_ios_common(struct fsl_esdhc_priv *priv, struct mmc *mmc)
 	esdhc_clock_control(priv, true);
 #endif
 	/* Set the clock speed */
-	if (priv->clock != mmc->clock)
-		set_sysctl(priv, mmc, mmc->clock);
+	clock = mmc->clock;
+	if (clock < mmc->cfg->f_min)
+		clock = mmc->cfg->f_min;
+
+	if (priv->clock != clock)
+		set_sysctl(priv, mmc, clock);
 
 #ifdef MMC_SUPPORTS_TUNING
 	if (mmc->clk_disable) {
Signature · 1 line
2.16.4
author
#1 lore raw

PATCH 2/2 mmc: fsl_esdhc_imx: Update compatible string for imx8m

To enable HS400(ES) and UHS for imx8m platforms, update the driver data to share with imx8qm esdhc_soc_data.

---
 drivers/mmc/fsl_esdhc_imx.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/mmc/fsl_esdhc_imx.c +3 -0
index 67549036d4..4099386313 100644
@@ -1647,6 +1647,9 @@ static const struct udevice_id fsl_esdhc_ids[] = {
 	{ .compatible = "fsl,imx7d-usdhc", .data = (ulong)&usdhc_imx7d_data,},
 	{ .compatible = "fsl,imx7ulp-usdhc", },
 	{ .compatible = "fsl,imx8qm-usdhc", .data = (ulong)&usdhc_imx8qm_data,},
+	{ .compatible = "fsl,imx8mm-usdhc", .data = (ulong)&usdhc_imx8qm_data,},
+	{ .compatible = "fsl,imx8mn-usdhc", .data = (ulong)&usdhc_imx8qm_data,},
+	{ .compatible = "fsl,imx8mq-usdhc", .data = (ulong)&usdhc_imx8qm_data,},
 	{ .compatible = "fsl,esdhc", },
 	{ /* sentinel */ }
 };
Signature · 1 line
2.16.4