diff mbox series

[PATCHv7,3/9] soc: ti: omap-prm: poll for reset complete during de-assert

Message ID 20191008071913.28740-4-t-kristo@ti.com
State New
Headers show
Series None | expand

Commit Message

Tero Kristo Oct. 8, 2019, 7:19 a.m. UTC
Poll for reset completion status during de-assertion of reset, otherwise
the IP in question might be accessed before it has left reset properly.

Signed-off-by: Tero Kristo <t-kristo@ti.com>

---
 drivers/soc/ti/omap_prm.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

-- 
2.17.1

--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

Comments

Philipp Zabel Oct. 8, 2019, 11:40 a.m. UTC | #1
On Tue, 2019-10-08 at 10:19 +0300, Tero Kristo wrote:
> Poll for reset completion status during de-assertion of reset, otherwise

> the IP in question might be accessed before it has left reset properly.

> 

> Signed-off-by: Tero Kristo <t-kristo@ti.com>

> ---

>  drivers/soc/ti/omap_prm.c | 12 ++++++++++++

>  1 file changed, 12 insertions(+)

> 

> diff --git a/drivers/soc/ti/omap_prm.c b/drivers/soc/ti/omap_prm.c

> index ab0b66ad715d..96fa2aad9b93 100644

> --- a/drivers/soc/ti/omap_prm.c

> +++ b/drivers/soc/ti/omap_prm.c

> @@ -153,6 +153,18 @@ static int omap_reset_deassert(struct reset_controller_dev *rcdev,

>  	writel_relaxed(v, reset->prm->base + reset->prm->data->rstctrl);

>  	spin_unlock_irqrestore(&reset->lock, flags);

>  

> +	if (!has_rstst)

> +		return 0;

> +

> +	/* wait for the status to be set */

> +	ret = readl_relaxed_poll_timeout(reset->prm->base +

> +					 reset->prm->data->rstst,

> +					 v, v & BIT(st_bit), 1,

> +					 OMAP_RESET_MAX_WAIT);

> +	if (ret)

> +		pr_err("%s: timedout waiting for %s:%lu\n", __func__,

> +		       reset->prm->data->name, id);

> +

>  	return 0;

>  }

>  


Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>


regards
Philipp
diff mbox series

Patch

diff --git a/drivers/soc/ti/omap_prm.c b/drivers/soc/ti/omap_prm.c
index ab0b66ad715d..96fa2aad9b93 100644
--- a/drivers/soc/ti/omap_prm.c
+++ b/drivers/soc/ti/omap_prm.c
@@ -153,6 +153,18 @@  static int omap_reset_deassert(struct reset_controller_dev *rcdev,
 	writel_relaxed(v, reset->prm->base + reset->prm->data->rstctrl);
 	spin_unlock_irqrestore(&reset->lock, flags);
 
+	if (!has_rstst)
+		return 0;
+
+	/* wait for the status to be set */
+	ret = readl_relaxed_poll_timeout(reset->prm->base +
+					 reset->prm->data->rstst,
+					 v, v & BIT(st_bit), 1,
+					 OMAP_RESET_MAX_WAIT);
+	if (ret)
+		pr_err("%s: timedout waiting for %s:%lu\n", __func__,
+		       reset->prm->data->name, id);
+
 	return 0;
 }