All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] mmc: mmci: De-assert reset on probe
@ 2021-06-30 10:24 Linus Walleij
  2021-07-01 12:38 ` Yann Gautier
  2021-07-08 12:42 ` Ulf Hansson
  0 siblings, 2 replies; 4+ messages in thread
From: Linus Walleij @ 2021-06-30 10:24 UTC (permalink / raw)
  To: linux-mmc, Ulf Hansson
  Cc: Linus Walleij, Russell King, Yann Gautier, Ludovic Barre

If we find a reset handle when probing the MMCI block,
make sure the reset is de-asserted. It could happen that
a hardware has reset asserted at boot.

Cc: Russell King <linux@armlinux.org.uk>
Cc: Yann Gautier <yann.gautier@foss.st.com>
Cc: Ludovic Barre <ludovic.barre@st.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLog v1->v2:
- Drop the else {} clause: reset_control_deassert() handles
  NULL just fine.
---
 drivers/mmc/host/mmci.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
index 984d35055156..3765e2f4ad98 100644
--- a/drivers/mmc/host/mmci.c
+++ b/drivers/mmc/host/mmci.c
@@ -2126,6 +2126,9 @@ static int mmci_probe(struct amba_device *dev,
 		ret = PTR_ERR(host->rst);
 		goto clk_disable;
 	}
+	ret = reset_control_deassert(host->rst);
+	if (ret)
+		dev_err(mmc_dev(mmc), "failed to de-assert reset\n");
 
 	/* Get regulators and the supported OCR mask */
 	ret = mmc_regulator_get_supply(mmc);
-- 
2.31.1


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

* Re: [PATCH v2] mmc: mmci: De-assert reset on probe
  2021-06-30 10:24 [PATCH v2] mmc: mmci: De-assert reset on probe Linus Walleij
@ 2021-07-01 12:38 ` Yann Gautier
  2021-07-01 15:39   ` Linus Walleij
  2021-07-08 12:42 ` Ulf Hansson
  1 sibling, 1 reply; 4+ messages in thread
From: Yann Gautier @ 2021-07-01 12:38 UTC (permalink / raw)
  To: Linus Walleij, linux-mmc, Ulf Hansson; +Cc: Russell King, Ludovic Barre

On 6/30/21 12:24 PM, Linus Walleij wrote:
> If we find a reset handle when probing the MMCI block,
> make sure the reset is de-asserted. It could happen that
> a hardware has reset asserted at boot. >
Hi Linus,

I was wondering on which HW you saw this issue?
But I've seen this kind of thing is also done in some other drivers, so 
maybe it is just an alignment?

Anyway I tested it on STM32MP157C-EV1 board, so feel free to add my:
Tested-by: Yann Gautier <yann.gautier@foss.st.com>

Regards,
Yann

> Cc: Russell King <linux@armlinux.org.uk>
> Cc: Yann Gautier <yann.gautier@foss.st.com>
> Cc: Ludovic Barre <ludovic.barre@st.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> ChangeLog v1->v2:
> - Drop the else {} clause: reset_control_deassert() handles
>    NULL just fine.
> ---
>   drivers/mmc/host/mmci.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
> index 984d35055156..3765e2f4ad98 100644
> --- a/drivers/mmc/host/mmci.c
> +++ b/drivers/mmc/host/mmci.c
> @@ -2126,6 +2126,9 @@ static int mmci_probe(struct amba_device *dev,
>   		ret = PTR_ERR(host->rst);
>   		goto clk_disable;
>   	}
> +	ret = reset_control_deassert(host->rst);
> +	if (ret)
> +		dev_err(mmc_dev(mmc), "failed to de-assert reset\n");
>   
>   	/* Get regulators and the supported OCR mask */
>   	ret = mmc_regulator_get_supply(mmc);
> 


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

* Re: [PATCH v2] mmc: mmci: De-assert reset on probe
  2021-07-01 12:38 ` Yann Gautier
@ 2021-07-01 15:39   ` Linus Walleij
  0 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2021-07-01 15:39 UTC (permalink / raw)
  To: Yann Gautier; +Cc: linux-mmc, Ulf Hansson, Russell King, Ludovic Barre

On Thu, Jul 1, 2021 at 2:39 PM Yann Gautier <yann.gautier@foss.st.com> wrote:

> I was wondering on which HW you saw this issue?

Haven't really seen it, but on ux500 we have no less that 6 (!)
mmci blocks and it wouldn't surprise me if some of them are
left in reset. Better safe than sorry.

> But I've seen this kind of thing is also done in some other drivers, so
> maybe it is just an alignment?

It is good to deassert any reset line explicitly if you have them,
I think.

> Anyway I tested it on STM32MP157C-EV1 board, so feel free to add my:
> Tested-by: Yann Gautier <yann.gautier@foss.st.com>

Thanks!

Linus Walleij

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

* Re: [PATCH v2] mmc: mmci: De-assert reset on probe
  2021-06-30 10:24 [PATCH v2] mmc: mmci: De-assert reset on probe Linus Walleij
  2021-07-01 12:38 ` Yann Gautier
@ 2021-07-08 12:42 ` Ulf Hansson
  1 sibling, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2021-07-08 12:42 UTC (permalink / raw)
  To: Linus Walleij; +Cc: linux-mmc, Russell King, Yann Gautier, Ludovic Barre

On Wed, 30 Jun 2021 at 12:26, Linus Walleij <linus.walleij@linaro.org> wrote:
>
> If we find a reset handle when probing the MMCI block,
> make sure the reset is de-asserted. It could happen that
> a hardware has reset asserted at boot.
>
> Cc: Russell King <linux@armlinux.org.uk>
> Cc: Yann Gautier <yann.gautier@foss.st.com>
> Cc: Ludovic Barre <ludovic.barre@st.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Queued for v5.15 on my devel branch, thanks!

Kind regards
Uffe


> ---
> ChangeLog v1->v2:
> - Drop the else {} clause: reset_control_deassert() handles
>   NULL just fine.
> ---
>  drivers/mmc/host/mmci.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
> index 984d35055156..3765e2f4ad98 100644
> --- a/drivers/mmc/host/mmci.c
> +++ b/drivers/mmc/host/mmci.c
> @@ -2126,6 +2126,9 @@ static int mmci_probe(struct amba_device *dev,
>                 ret = PTR_ERR(host->rst);
>                 goto clk_disable;
>         }
> +       ret = reset_control_deassert(host->rst);
> +       if (ret)
> +               dev_err(mmc_dev(mmc), "failed to de-assert reset\n");
>
>         /* Get regulators and the supported OCR mask */
>         ret = mmc_regulator_get_supply(mmc);
> --
> 2.31.1
>

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

end of thread, other threads:[~2021-07-08 12:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-30 10:24 [PATCH v2] mmc: mmci: De-assert reset on probe Linus Walleij
2021-07-01 12:38 ` Yann Gautier
2021-07-01 15:39   ` Linus Walleij
2021-07-08 12:42 ` Ulf Hansson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.