diff mbox series

[v2] mmc: mmci: De-assert reset on probe

Message ID 20210630102408.3543024-1-linus.walleij@linaro.org
State New
Headers show
Series [v2] mmc: mmci: De-assert reset on probe | expand

Commit Message

Linus Walleij June 30, 2021, 10:24 a.m. UTC
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(+)

-- 
2.31.1

Comments

Yann Gautier July 1, 2021, 12:38 p.m. UTC | #1
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);

>
Linus Walleij July 1, 2021, 3:39 p.m. UTC | #2
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
Ulf Hansson July 8, 2021, 12:42 p.m. UTC | #3
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

>
diff mbox series

Patch

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);