From 79bdcd882e6d49e81d1c4a2a09d1142431508661 Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Fri, 20 May 2022 18:24:51 +0200 Subject: [PATCH] mmc: stm32_sdmmc2: make reset property optional Although not recommended, the reset property could be made optional. This way the driver will probe even if no reset property is provided in an sdmmc node in DT. This reset is already optional in Linux. Signed-off-by: Yann Gautier Reviewed-by: Jaehoon Chung Reviewed-by: Patrice Chotard Signed-off-by: Patrick Delaunay --- drivers/mmc/stm32_sdmmc2.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/mmc/stm32_sdmmc2.c b/drivers/mmc/stm32_sdmmc2.c index 44bfc911af..81b07609a9 100644 --- a/drivers/mmc/stm32_sdmmc2.c +++ b/drivers/mmc/stm32_sdmmc2.c @@ -514,10 +514,12 @@ retry_cmd: */ static void stm32_sdmmc2_reset(struct stm32_sdmmc2_priv *priv) { - /* Reset */ - reset_assert(&priv->reset_ctl); - udelay(2); - reset_deassert(&priv->reset_ctl); + if (reset_valid(&priv->reset_ctl)) { + /* Reset */ + reset_assert(&priv->reset_ctl); + udelay(2); + reset_deassert(&priv->reset_ctl); + } /* init the needed SDMMC register after reset */ writel(priv->pwr_reg_msk, priv->base + SDMMC_POWER); @@ -735,7 +737,7 @@ static int stm32_sdmmc2_probe(struct udevice *dev) ret = reset_get_by_index(dev, 0, &priv->reset_ctl); if (ret) - goto clk_disable; + dev_dbg(dev, "No reset provided\n"); gpio_request_by_name(dev, "cd-gpios", 0, &priv->cd_gpio, GPIOD_IS_IN); @@ -755,8 +757,6 @@ static int stm32_sdmmc2_probe(struct udevice *dev) stm32_sdmmc2_reset(priv); return 0; -clk_disable: - clk_disable(&priv->clk); clk_free: clk_free(&priv->clk); -- 2.39.5