[PATCH] MMC:dw_mmc:when enable biu_clk should check whether this clk is normal

ping.gao posted 1 patch 1 month, 2 weeks ago
There is a newer version of this series
drivers/mmc/host/dw_mmc.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
[PATCH] MMC:dw_mmc:when enable biu_clk should check whether this clk is normal
Posted by ping.gao 1 month, 2 weeks ago
exynos doesn't use biu_clk , enable it will panic

Signed-off-by: ping.gao <ping.gao@samsung.com>
---
 drivers/mmc/host/dw_mmc.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index c5db92bbb094..61f6986f15ef 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -3633,9 +3633,15 @@ int dw_mci_runtime_resume(struct device *dev)
 	if (host->slot &&
 	    (mmc_host_can_gpio_cd(host->slot->mmc) ||
 	     !mmc_card_is_removable(host->slot->mmc))) {
-		ret = clk_prepare_enable(host->biu_clk);
-		if (ret)
-			return ret;
+		if (IS_ERR(host->biu_clk)) {
+			dev_dbg(host->dev, "biu clock not available\n");
+		} else {
+			ret = clk_prepare_enable(host->biu_clk);
+			if (ret) {
+				dev_err(host->dev, "failed to enable biu clock\n");
+				goto err;
+			}
+		}
 	}
 
 	ret = clk_prepare_enable(host->ciu_clk);
-- 
2.50.1
Re: [PATCH] MMC:dw_mmc:when enable biu_clk should check whether this clk is normal
Posted by Ulf Hansson 1 month, 1 week ago
On Tue, 23 Dec 2025 at 05:42, ping.gao <ping.gao@samsung.com> wrote:
>
> exynos doesn't use biu_clk , enable it will panic

Please elaborate a bit more on what the patch does.

>
> Signed-off-by: ping.gao <ping.gao@samsung.com>
> ---
>  drivers/mmc/host/dw_mmc.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index c5db92bbb094..61f6986f15ef 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -3633,9 +3633,15 @@ int dw_mci_runtime_resume(struct device *dev)
>         if (host->slot &&
>             (mmc_host_can_gpio_cd(host->slot->mmc) ||
>              !mmc_card_is_removable(host->slot->mmc))) {
> -               ret = clk_prepare_enable(host->biu_clk);
> -               if (ret)
> -                       return ret;
> +               if (IS_ERR(host->biu_clk)) {
> +                       dev_dbg(host->dev, "biu clock not available\n");
> +               } else {
> +                       ret = clk_prepare_enable(host->biu_clk);
> +                       if (ret) {
> +                               dev_err(host->dev, "failed to enable biu clock\n");
> +                               goto err;
> +                       }
> +               }

Rather than making the change in dw_mci_runtime_resume(), I suggest we
set "host->biu_clk = NULL" in dw_mci_probe(), rather than keeping its
error code.

In this way, clk_prepare_enable() will not return an error code above.

>         }
>
>         ret = clk_prepare_enable(host->ciu_clk);
> --
> 2.50.1
>

Kind regards
Uffe