]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
mmc: stm32_sdmmc2: make reset property optional
authorPatrick Delaunay <patrick.delaunay@foss.st.com>
Fri, 20 May 2022 16:24:51 +0000 (18:24 +0200)
committerPatrick Delaunay <patrick.delaunay@foss.st.com>
Fri, 17 Jun 2022 08:41:16 +0000 (10:41 +0200)
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 <yann.gautier@foss.st.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
drivers/mmc/stm32_sdmmc2.c

index 44bfc911af23e6637f9c0ecb58610de46973d6db..81b07609a912ca890c026d75be856d0c317ca3da 100644 (file)
@@ -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);