mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mmc: dw_mmc: allow biu and ciu clocks to defer
@ 2024-08-11 21:22 Ben Whitten
  2024-08-20 11:49 ` Ulf Hansson
  0 siblings, 1 reply; 2+ messages in thread
From: Ben Whitten @ 2024-08-11 21:22 UTC (permalink / raw)
  To: Jaehoon Chung, Ulf Hansson, Will Newton, Thomas Abraham,
	Abhilash Kesavan, Chris Ball
  Cc: Hauke Mehrtens, Ben Whitten, linux-mmc, linux-kernel

Fix a race condition if the clock provider comes up after mmc is probed,
this causes mmc to fail without retrying.
When given the DEFER error from the clk source, pass it on up the chain.

Fixes: f90a0612f0e1 ("mmc: dw_mmc: lookup for optional biu and ciu clocks")

Signed-off-by: Ben Whitten <ben.whitten@gmail.com>
---
 drivers/mmc/host/dw_mmc.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 2333ef4893ee..e9f6e4e62290 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -3299,6 +3299,10 @@ int dw_mci_probe(struct dw_mci *host)
 	host->biu_clk = devm_clk_get(host->dev, "biu");
 	if (IS_ERR(host->biu_clk)) {
 		dev_dbg(host->dev, "biu clock not available\n");
+		ret = PTR_ERR(host->biu_clk);
+		if (ret == -EPROBE_DEFER)
+			return ret;
+
 	} else {
 		ret = clk_prepare_enable(host->biu_clk);
 		if (ret) {
@@ -3310,6 +3314,10 @@ int dw_mci_probe(struct dw_mci *host)
 	host->ciu_clk = devm_clk_get(host->dev, "ciu");
 	if (IS_ERR(host->ciu_clk)) {
 		dev_dbg(host->dev, "ciu clock not available\n");
+		ret = PTR_ERR(host->ciu_clk);
+		if (ret == -EPROBE_DEFER)
+			goto err_clk_biu;
+
 		host->bus_hz = host->pdata->bus_hz;
 	} else {
 		ret = clk_prepare_enable(host->ciu_clk);

base-commit: 5189dafa4cf950e675f02ee04b577dfbbad0d9b1
-- 
2.43.0


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

* Re: [PATCH] mmc: dw_mmc: allow biu and ciu clocks to defer
  2024-08-11 21:22 [PATCH] mmc: dw_mmc: allow biu and ciu clocks to defer Ben Whitten
@ 2024-08-20 11:49 ` Ulf Hansson
  0 siblings, 0 replies; 2+ messages in thread
From: Ulf Hansson @ 2024-08-20 11:49 UTC (permalink / raw)
  To: Ben Whitten
  Cc: Jaehoon Chung, Will Newton, Thomas Abraham, Abhilash Kesavan,
	Chris Ball, Hauke Mehrtens, linux-mmc, linux-kernel

On Sun, 11 Aug 2024 at 23:23, Ben Whitten <ben.whitten@gmail.com> wrote:
>
> Fix a race condition if the clock provider comes up after mmc is probed,
> this causes mmc to fail without retrying.
> When given the DEFER error from the clk source, pass it on up the chain.
>
> Fixes: f90a0612f0e1 ("mmc: dw_mmc: lookup for optional biu and ciu clocks")
>
> Signed-off-by: Ben Whitten <ben.whitten@gmail.com>

Applied for fixes and by adding a stable tag, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/host/dw_mmc.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index 2333ef4893ee..e9f6e4e62290 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -3299,6 +3299,10 @@ int dw_mci_probe(struct dw_mci *host)
>         host->biu_clk = devm_clk_get(host->dev, "biu");
>         if (IS_ERR(host->biu_clk)) {
>                 dev_dbg(host->dev, "biu clock not available\n");
> +               ret = PTR_ERR(host->biu_clk);
> +               if (ret == -EPROBE_DEFER)
> +                       return ret;
> +
>         } else {
>                 ret = clk_prepare_enable(host->biu_clk);
>                 if (ret) {
> @@ -3310,6 +3314,10 @@ int dw_mci_probe(struct dw_mci *host)
>         host->ciu_clk = devm_clk_get(host->dev, "ciu");
>         if (IS_ERR(host->ciu_clk)) {
>                 dev_dbg(host->dev, "ciu clock not available\n");
> +               ret = PTR_ERR(host->ciu_clk);
> +               if (ret == -EPROBE_DEFER)
> +                       goto err_clk_biu;
> +
>                 host->bus_hz = host->pdata->bus_hz;
>         } else {
>                 ret = clk_prepare_enable(host->ciu_clk);
>
> base-commit: 5189dafa4cf950e675f02ee04b577dfbbad0d9b1
> --
> 2.43.0
>

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

end of thread, other threads:[~2024-08-20 11:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-11 21:22 [PATCH] mmc: dw_mmc: allow biu and ciu clocks to defer Ben Whitten
2024-08-20 11:49 ` Ulf Hansson

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®