mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] MMC:dw_mmc:when disable biu_clk should check whether this clk is normal
       [not found] <CGME20251218064655epcas5p328ad453941deb1c60ee151b6ba11d8a0@epcas5p3.samsung.com>
@ 2025-12-18  6:50 ` ping.gao
  2025-12-18  6:55   ` Shawn Lin
  0 siblings, 1 reply; 3+ messages in thread
From: ping.gao @ 2025-12-18  6:50 UTC (permalink / raw)
  To: jh80.chung, ulf.hansson, linux-mmc, linux-kernel; +Cc: ping.gao

some vendor not enable biu_clk , disable it will panic

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

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index c5db92bbb094..e737333a0727 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);
@@ -3686,9 +3692,12 @@ int dw_mci_runtime_resume(struct device *dev)
 err:
 	if (host->slot &&
 	    (mmc_host_can_gpio_cd(host->slot->mmc) ||
-	     !mmc_card_is_removable(host->slot->mmc)))
-		clk_disable_unprepare(host->biu_clk);
-
+	     !mmc_card_is_removable(host->slot->mmc))) {
+		if (IS_ERR(host->biu_clk))
+			dev_dbg(host->dev, "biu clock not available\n");
+		else
+			clk_disable_unprepare(host->biu_clk);
+	}
 	return ret;
 }
 EXPORT_SYMBOL(dw_mci_runtime_resume);
-- 
2.50.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] MMC:dw_mmc:when disable biu_clk should check whether this clk is normal
  2025-12-18  6:50 ` [PATCH] MMC:dw_mmc:when disable biu_clk should check whether this clk is normal ping.gao
@ 2025-12-18  6:55   ` Shawn Lin
  0 siblings, 0 replies; 3+ messages in thread
From: Shawn Lin @ 2025-12-18  6:55 UTC (permalink / raw)
  To: ping.gao; +Cc: shawn.lin, jh80.chung, ulf.hansson, linux-kernel, linux-mmc

在 2025/12/18 星期四 14:50, ping.gao 写道:
> some vendor not enable biu_clk , disable it will panic
> 

Sorry, I can't follow the below changes.
Isn't we disable biu_clk in dw_mci_runtime_suspend(()?
How could that work because biu_clk is used for register
access, FIFO access, etc.


> Signed-off-by: ping.gao <ping.gao@samsung.com>
> ---
>   drivers/mmc/host/dw_mmc.c | 21 +++++++++++++++------
>   1 file changed, 15 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index c5db92bbb094..e737333a0727 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);
> @@ -3686,9 +3692,12 @@ int dw_mci_runtime_resume(struct device *dev)
>   err:
>   	if (host->slot &&
>   	    (mmc_host_can_gpio_cd(host->slot->mmc) ||
> -	     !mmc_card_is_removable(host->slot->mmc)))
> -		clk_disable_unprepare(host->biu_clk);
> -
> +	     !mmc_card_is_removable(host->slot->mmc))) {
> +		if (IS_ERR(host->biu_clk))
> +			dev_dbg(host->dev, "biu clock not available\n");
> +		else
> +			clk_disable_unprepare(host->biu_clk);
> +	}
>   	return ret;
>   }
>   EXPORT_SYMBOL(dw_mci_runtime_resume);


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] MMC:dw_mmc:when disable biu_clk should check whether this clk is normal
       [not found] <CGME20251218072711epcas5p454506a0e5cddde54a40b529d6ea3bc1b@epcas5p4.samsung.com>
@ 2025-12-18  7:31 ` ping.gao
  0 siblings, 0 replies; 3+ messages in thread
From: ping.gao @ 2025-12-18  7:31 UTC (permalink / raw)
  To: jh80.chung, ulf.hansson, linux-mmc, linux-kernel; +Cc: ping.gao

some vendor not enable biu_clk , disable it will panic

exynos use ciu_clk ,not use biu_clk

Sorry, I can't follow the below changes.
Isn't we disable biu_clk in dw_mci_runtime_suspend(()?
How could that work because biu_clk is used for register
access, FIFO access, etc.

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

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index c5db92bbb094..e737333a0727 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);
@@ -3686,9 +3692,12 @@ int dw_mci_runtime_resume(struct device *dev)
 err:
 	if (host->slot &&
 	    (mmc_host_can_gpio_cd(host->slot->mmc) ||
-	     !mmc_card_is_removable(host->slot->mmc)))
-		clk_disable_unprepare(host->biu_clk);
-
+	     !mmc_card_is_removable(host->slot->mmc))) {
+		if (IS_ERR(host->biu_clk))
+			dev_dbg(host->dev, "biu clock not available\n");
+		else
+			clk_disable_unprepare(host->biu_clk);
+	}
 	return ret;
 }
 EXPORT_SYMBOL(dw_mci_runtime_resume);
-- 
2.50.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-12-18  7:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20251218064655epcas5p328ad453941deb1c60ee151b6ba11d8a0@epcas5p3.samsung.com>
2025-12-18  6:50 ` [PATCH] MMC:dw_mmc:when disable biu_clk should check whether this clk is normal ping.gao
2025-12-18  6:55   ` Shawn Lin
     [not found] <CGME20251218072711epcas5p454506a0e5cddde54a40b529d6ea3bc1b@epcas5p4.samsung.com>
2025-12-18  7:31 ` ping.gao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®