Linux-mtd Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 1/2] mtd: rawnand: gpmi: Fix suspend/resume problem
@ 2020-01-02 13:08 Esben Haabendal
  2020-01-02 13:08 ` [PATCH 2/2] mtd: rawnand: gpmi: Restore nfc timing setup after suspend/resume Esben Haabendal
                   ` (4 more replies)
  0 siblings, 5 replies; 15+ messages in thread
From: Esben Haabendal @ 2020-01-02 13:08 UTC (permalink / raw)
  To: linux-mtd, Sascha Hauer, Boris Brezillon, Han Xu, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra
  Cc: martin, sean

On system resume, the gpmi clock must be enabled before accessing gpmi
block.  Without this, resume causes something like

[  661.348790] gpmi_reset_block(5cbb0f7e): module reset timeout
[  661.348889] gpmi-nand 1806000.gpmi-nand: Error setting GPMI : -110
[  661.348928] PM: dpm_run_callback(): platform_pm_resume+0x0/0x44 returns -110
[  661.348961] PM: Device 1806000.gpmi-nand failed to resume: error -110

Signed-off-by: Esben Haabendal <esben@geanix.com>
---
 drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
index 334fe3130285..7ac8c8b95afc 100644
--- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
+++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
@@ -148,6 +148,10 @@ static int gpmi_init(struct gpmi_nand_data *this)
 	struct resources *r = &this->resources;
 	int ret;
 
+	ret = pm_runtime_get_sync(this->dev);
+	if (ret < 0)
+		return ret;
+
 	ret = gpmi_reset_block(r->gpmi_regs, false);
 	if (ret)
 		goto err_out;
@@ -181,6 +185,8 @@ static int gpmi_init(struct gpmi_nand_data *this)
 
 	return 0;
 err_out:
+	pm_runtime_mark_last_busy(this->dev);
+	pm_runtime_put_autosuspend(this->dev);
 	return ret;
 }
 
-- 
2.24.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* [PATCH 2/2] mtd: rawnand: gpmi: Restore nfc timing setup after suspend/resume
  2020-01-02 13:08 [PATCH 1/2] mtd: rawnand: gpmi: Fix suspend/resume problem Esben Haabendal
@ 2020-01-02 13:08 ` Esben Haabendal
  2020-01-13 17:34   ` Han Xu
  2020-01-14 17:03   ` Miquel Raynal
  2020-01-07 19:31 ` [PATCH 1/2] mtd: rawnand: gpmi: Fix suspend/resume problem Han Xu
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 15+ messages in thread
From: Esben Haabendal @ 2020-01-02 13:08 UTC (permalink / raw)
  To: linux-mtd, Sascha Hauer, Boris Brezillon, Han Xu, Miquel Raynal,
	Richard Weinberger, Vignesh Raghavendra
  Cc: martin, sean

As we reset the GPMI block at resume, the timing parameters setup by a
previous exec_op is lost.  Rewriting GPMI timing registers on first exec_op
after resume fixes the problem.

Signed-off-by: Esben Haabendal <esben@geanix.com>
---
 drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
index 7ac8c8b95afc..fcc7325f2a10 100644
--- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
+++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
@@ -2728,6 +2728,10 @@ static int gpmi_pm_resume(struct device *dev)
 		return ret;
 	}
 
+	/* Set flag to get timing setup restored for next exec_op */
+	if (this->hw.clk_rate)
+		this->hw.must_apply_timings = true;
+
 	/* re-init the BCH registers */
 	ret = bch_set_geometry(this);
 	if (ret) {
-- 
2.24.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 1/2] mtd: rawnand: gpmi: Fix suspend/resume problem
  2020-01-02 13:08 [PATCH 1/2] mtd: rawnand: gpmi: Fix suspend/resume problem Esben Haabendal
  2020-01-02 13:08 ` [PATCH 2/2] mtd: rawnand: gpmi: Restore nfc timing setup after suspend/resume Esben Haabendal
@ 2020-01-07 19:31 ` Han Xu
  2020-01-09 15:15   ` Miquel Raynal
  2020-01-13 17:32 ` Han Xu
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 15+ messages in thread
From: Han Xu @ 2020-01-07 19:31 UTC (permalink / raw)
  To: Esben Haabendal
  Cc: Vignesh Raghavendra, Richard Weinberger, Sascha Hauer, sean,
	martin, Boris Brezillon, linux-mtd, Miquel Raynal, Han Xu

On Thu, Jan 2, 2020 at 7:09 AM Esben Haabendal <esben@geanix.com> wrote:
>
> On system resume, the gpmi clock must be enabled before accessing gpmi
> block.  Without this, resume causes something like
>
> [  661.348790] gpmi_reset_block(5cbb0f7e): module reset timeout
> [  661.348889] gpmi-nand 1806000.gpmi-nand: Error setting GPMI : -110
> [  661.348928] PM: dpm_run_callback(): platform_pm_resume+0x0/0x44 returns -110
> [  661.348961] PM: Device 1806000.gpmi-nand failed to resume: error -110
>
> Signed-off-by: Esben Haabendal <esben@geanix.com>
> ---
>  drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> index 334fe3130285..7ac8c8b95afc 100644
> --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> @@ -148,6 +148,10 @@ static int gpmi_init(struct gpmi_nand_data *this)
>         struct resources *r = &this->resources;
>         int ret;
>
> +       ret = pm_runtime_get_sync(this->dev);
> +       if (ret < 0)
> +               return ret;
> +
>         ret = gpmi_reset_block(r->gpmi_regs, false);
>         if (ret)
>                 goto err_out;
> @@ -181,6 +185,8 @@ static int gpmi_init(struct gpmi_nand_data *this)
>
>         return 0;
>  err_out:
> +       pm_runtime_mark_last_busy(this->dev);
> +       pm_runtime_put_autosuspend(this->dev);
>         return ret;
>  }

I have a similar patch with more fixes, will send out tonight for review.

>
> --
> 2.24.1
>
>
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/



-- 
Sincerely,

Han XU

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 1/2] mtd: rawnand: gpmi: Fix suspend/resume problem
  2020-01-07 19:31 ` [PATCH 1/2] mtd: rawnand: gpmi: Fix suspend/resume problem Han Xu
@ 2020-01-09 15:15   ` Miquel Raynal
  2020-01-09 17:11     ` Han Xu
  0 siblings, 1 reply; 15+ messages in thread
From: Miquel Raynal @ 2020-01-09 15:15 UTC (permalink / raw)
  To: Han Xu
  Cc: Vignesh Raghavendra, Richard Weinberger, Esben Haabendal, sean,
	Boris Brezillon, linux-mtd, martin, Han Xu, Sascha Hauer

Hi Han,

Han Xu <xhnjupt@gmail.com> wrote on Tue, 7 Jan 2020 13:31:27 -0600:

> On Thu, Jan 2, 2020 at 7:09 AM Esben Haabendal <esben@geanix.com> wrote:
> >
> > On system resume, the gpmi clock must be enabled before accessing gpmi
> > block.  Without this, resume causes something like
> >
> > [  661.348790] gpmi_reset_block(5cbb0f7e): module reset timeout
> > [  661.348889] gpmi-nand 1806000.gpmi-nand: Error setting GPMI : -110
> > [  661.348928] PM: dpm_run_callback(): platform_pm_resume+0x0/0x44 returns -110
> > [  661.348961] PM: Device 1806000.gpmi-nand failed to resume: error -110
> >
> > Signed-off-by: Esben Haabendal <esben@geanix.com>
> > ---
> >  drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 6 ++++++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> > index 334fe3130285..7ac8c8b95afc 100644
> > --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> > +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> > @@ -148,6 +148,10 @@ static int gpmi_init(struct gpmi_nand_data *this)
> >         struct resources *r = &this->resources;
> >         int ret;
> >
> > +       ret = pm_runtime_get_sync(this->dev);
> > +       if (ret < 0)
> > +               return ret;
> > +
> >         ret = gpmi_reset_block(r->gpmi_regs, false);
> >         if (ret)
> >                 goto err_out;
> > @@ -181,6 +185,8 @@ static int gpmi_init(struct gpmi_nand_data *this)
> >
> >         return 0;
> >  err_out:
> > +       pm_runtime_mark_last_busy(this->dev);
> > +       pm_runtime_put_autosuspend(this->dev);
> >         return ret;
> >  }  
> 
> I have a similar patch with more fixes, will send out tonight for review.

What should I do with this patch? It seems okay to me, what is your
plan? May I take this one for this release and you'll build above with
your series, is this fine for you?

Thanks,
Miquèl

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 1/2] mtd: rawnand: gpmi: Fix suspend/resume problem
  2020-01-09 15:15   ` Miquel Raynal
@ 2020-01-09 17:11     ` Han Xu
  0 siblings, 0 replies; 15+ messages in thread
From: Han Xu @ 2020-01-09 17:11 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Vignesh Raghavendra, Richard Weinberger, Esben Haabendal, sean,
	Boris Brezillon, linux-mtd, martin, Han Xu, Sascha Hauer

On Thu, Jan 9, 2020 at 9:15 AM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
>
> Hi Han,
>
> Han Xu <xhnjupt@gmail.com> wrote on Tue, 7 Jan 2020 13:31:27 -0600:
>
> > On Thu, Jan 2, 2020 at 7:09 AM Esben Haabendal <esben@geanix.com> wrote:
> > >
> > > On system resume, the gpmi clock must be enabled before accessing gpmi
> > > block.  Without this, resume causes something like
> > >
> > > [  661.348790] gpmi_reset_block(5cbb0f7e): module reset timeout
> > > [  661.348889] gpmi-nand 1806000.gpmi-nand: Error setting GPMI : -110
> > > [  661.348928] PM: dpm_run_callback(): platform_pm_resume+0x0/0x44 returns -110
> > > [  661.348961] PM: Device 1806000.gpmi-nand failed to resume: error -110
> > >
> > > Signed-off-by: Esben Haabendal <esben@geanix.com>
> > > ---
> > >  drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 6 ++++++
> > >  1 file changed, 6 insertions(+)
> > >
> > > diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> > > index 334fe3130285..7ac8c8b95afc 100644
> > > --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> > > +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> > > @@ -148,6 +148,10 @@ static int gpmi_init(struct gpmi_nand_data *this)
> > >         struct resources *r = &this->resources;
> > >         int ret;
> > >
> > > +       ret = pm_runtime_get_sync(this->dev);
> > > +       if (ret < 0)
> > > +               return ret;
> > > +
> > >         ret = gpmi_reset_block(r->gpmi_regs, false);
> > >         if (ret)
> > >                 goto err_out;
> > > @@ -181,6 +185,8 @@ static int gpmi_init(struct gpmi_nand_data *this)
> > >
> > >         return 0;
> > >  err_out:
> > > +       pm_runtime_mark_last_busy(this->dev);
> > > +       pm_runtime_put_autosuspend(this->dev);
> > >         return ret;
> > >  }
> >
> > I have a similar patch with more fixes, will send out tonight for review.
>
> What should I do with this patch? It seems okay to me, what is your
> plan? May I take this one for this release and you'll build above with
> your series, is this fine for you?

Sorry for late, just sent out the patch for review.

>
> Thanks,
> Miquèl



-- 
Sincerely,

Han XU

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 1/2] mtd: rawnand: gpmi: Fix suspend/resume problem
  2020-01-02 13:08 [PATCH 1/2] mtd: rawnand: gpmi: Fix suspend/resume problem Esben Haabendal
  2020-01-02 13:08 ` [PATCH 2/2] mtd: rawnand: gpmi: Restore nfc timing setup after suspend/resume Esben Haabendal
  2020-01-07 19:31 ` [PATCH 1/2] mtd: rawnand: gpmi: Fix suspend/resume problem Han Xu
@ 2020-01-13 17:32 ` Han Xu
  2020-01-14 17:03 ` Miquel Raynal
  2020-01-15  7:46 ` Sascha Hauer
  4 siblings, 0 replies; 15+ messages in thread
From: Han Xu @ 2020-01-13 17:32 UTC (permalink / raw)
  To: Esben Haabendal
  Cc: Vignesh Raghavendra, Richard Weinberger, Sascha Hauer, sean,
	martin, Boris Brezillon, linux-mtd, Miquel Raynal, Han Xu

On Thu, Jan 2, 2020 at 7:09 AM Esben Haabendal <esben@geanix.com> wrote:
>
> On system resume, the gpmi clock must be enabled before accessing gpmi
> block.  Without this, resume causes something like
>
> [  661.348790] gpmi_reset_block(5cbb0f7e): module reset timeout
> [  661.348889] gpmi-nand 1806000.gpmi-nand: Error setting GPMI : -110
> [  661.348928] PM: dpm_run_callback(): platform_pm_resume+0x0/0x44 returns -110
> [  661.348961] PM: Device 1806000.gpmi-nand failed to resume: error -110
>
> Signed-off-by: Esben Haabendal <esben@geanix.com>
> ---
>  drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> index 334fe3130285..7ac8c8b95afc 100644
> --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> @@ -148,6 +148,10 @@ static int gpmi_init(struct gpmi_nand_data *this)
>         struct resources *r = &this->resources;
>         int ret;
>
> +       ret = pm_runtime_get_sync(this->dev);
> +       if (ret < 0)
> +               return ret;
> +
>         ret = gpmi_reset_block(r->gpmi_regs, false);
>         if (ret)
>                 goto err_out;
> @@ -181,6 +185,8 @@ static int gpmi_init(struct gpmi_nand_data *this)
>
>         return 0;
>  err_out:
> +       pm_runtime_mark_last_busy(this->dev);
> +       pm_runtime_put_autosuspend(this->dev);
>         return ret;
>  }

Acked-by: Han Xu <han.xu@nxp.com>

>
> --
> 2.24.1
>
>
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/



-- 
Sincerely,

Han XU

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 2/2] mtd: rawnand: gpmi: Restore nfc timing setup after suspend/resume
  2020-01-02 13:08 ` [PATCH 2/2] mtd: rawnand: gpmi: Restore nfc timing setup after suspend/resume Esben Haabendal
@ 2020-01-13 17:34   ` Han Xu
  2020-01-14 17:03   ` Miquel Raynal
  1 sibling, 0 replies; 15+ messages in thread
From: Han Xu @ 2020-01-13 17:34 UTC (permalink / raw)
  To: Esben Haabendal
  Cc: Vignesh Raghavendra, Richard Weinberger, Sascha Hauer, sean,
	martin, Boris Brezillon, linux-mtd, Miquel Raynal, Han Xu

On Thu, Jan 2, 2020 at 7:08 AM Esben Haabendal <esben@geanix.com> wrote:
>
> As we reset the GPMI block at resume, the timing parameters setup by a
> previous exec_op is lost.  Rewriting GPMI timing registers on first exec_op
> after resume fixes the problem.
>
> Signed-off-by: Esben Haabendal <esben@geanix.com>
> ---
>  drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> index 7ac8c8b95afc..fcc7325f2a10 100644
> --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> @@ -2728,6 +2728,10 @@ static int gpmi_pm_resume(struct device *dev)
>                 return ret;
>         }
>
> +       /* Set flag to get timing setup restored for next exec_op */
> +       if (this->hw.clk_rate)
> +               this->hw.must_apply_timings = true;
> +

Acked-by: Han Xu <han.xu@nxp.com>

>         /* re-init the BCH registers */
>         ret = bch_set_geometry(this);
>         if (ret) {
> --
> 2.24.1
>
>
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/



-- 
Sincerely,

Han XU

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 2/2] mtd: rawnand: gpmi: Restore nfc timing setup after suspend/resume
  2020-01-02 13:08 ` [PATCH 2/2] mtd: rawnand: gpmi: Restore nfc timing setup after suspend/resume Esben Haabendal
  2020-01-13 17:34   ` Han Xu
@ 2020-01-14 17:03   ` Miquel Raynal
  1 sibling, 0 replies; 15+ messages in thread
From: Miquel Raynal @ 2020-01-14 17:03 UTC (permalink / raw)
  To: Esben Haabendal, linux-mtd, Sascha Hauer, Boris Brezillon,
	Han Xu, Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
  Cc: martin, sean

On Thu, 2020-01-02 at 13:08:26 UTC, Esben Haabendal wrote:
> As we reset the GPMI block at resume, the timing parameters setup by a
> previous exec_op is lost.  Rewriting GPMI timing registers on first exec_op
> after resume fixes the problem.
> 
> Signed-off-by: Esben Haabendal <esben@geanix.com>
> Acked-by: Han Xu <han.xu@nxp.com>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Miquel

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 1/2] mtd: rawnand: gpmi: Fix suspend/resume problem
  2020-01-02 13:08 [PATCH 1/2] mtd: rawnand: gpmi: Fix suspend/resume problem Esben Haabendal
                   ` (2 preceding siblings ...)
  2020-01-13 17:32 ` Han Xu
@ 2020-01-14 17:03 ` Miquel Raynal
  2020-01-14 17:09   ` Fabio Estevam
  2020-01-15  7:46 ` Sascha Hauer
  4 siblings, 1 reply; 15+ messages in thread
From: Miquel Raynal @ 2020-01-14 17:03 UTC (permalink / raw)
  To: Esben Haabendal, linux-mtd, Sascha Hauer, Boris Brezillon,
	Han Xu, Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
  Cc: martin, sean

On Thu, 2020-01-02 at 13:08:25 UTC, Esben Haabendal wrote:
> On system resume, the gpmi clock must be enabled before accessing gpmi
> block.  Without this, resume causes something like
> 
> [  661.348790] gpmi_reset_block(5cbb0f7e): module reset timeout
> [  661.348889] gpmi-nand 1806000.gpmi-nand: Error setting GPMI : -110
> [  661.348928] PM: dpm_run_callback(): platform_pm_resume+0x0/0x44 returns -110
> [  661.348961] PM: Device 1806000.gpmi-nand failed to resume: error -110
> 
> Signed-off-by: Esben Haabendal <esben@geanix.com>
> Acked-by: Han Xu <han.xu@nxp.com>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Miquel

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 1/2] mtd: rawnand: gpmi: Fix suspend/resume problem
  2020-01-14 17:03 ` Miquel Raynal
@ 2020-01-14 17:09   ` Fabio Estevam
  2020-01-14 17:25     ` Miquel Raynal
  0 siblings, 1 reply; 15+ messages in thread
From: Fabio Estevam @ 2020-01-14 17:09 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Vignesh Raghavendra, Richard Weinberger, Esben Haabendal, sean,
	Boris Brezillon, linux-mtd, martin, Han Xu, Sascha Hauer

On Tue, Jan 14, 2020 at 2:04 PM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
>
> On Thu, 2020-01-02 at 13:08:25 UTC, Esben Haabendal wrote:
> > On system resume, the gpmi clock must be enabled before accessing gpmi
> > block.  Without this, resume causes something like
> >
> > [  661.348790] gpmi_reset_block(5cbb0f7e): module reset timeout
> > [  661.348889] gpmi-nand 1806000.gpmi-nand: Error setting GPMI : -110
> > [  661.348928] PM: dpm_run_callback(): platform_pm_resume+0x0/0x44 returns -110
> > [  661.348961] PM: Device 1806000.gpmi-nand failed to resume: error -110
> >
> > Signed-off-by: Esben Haabendal <esben@geanix.com>
> > Acked-by: Han Xu <han.xu@nxp.com>

Shouldn't this one contain a Fixes tag and be backported to stable?

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 1/2] mtd: rawnand: gpmi: Fix suspend/resume problem
  2020-01-14 17:09   ` Fabio Estevam
@ 2020-01-14 17:25     ` Miquel Raynal
  2020-01-14 17:29       ` Fabio Estevam
  0 siblings, 1 reply; 15+ messages in thread
From: Miquel Raynal @ 2020-01-14 17:25 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Vignesh Raghavendra, Richard Weinberger, Esben Haabendal, sean,
	Boris Brezillon, linux-mtd, martin, Han Xu, Sascha Hauer

Hi Fabio,

Fabio Estevam <festevam@gmail.com> wrote on Tue, 14 Jan 2020 14:09:21
-0300:

> On Tue, Jan 14, 2020 at 2:04 PM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> >
> > On Thu, 2020-01-02 at 13:08:25 UTC, Esben Haabendal wrote:  
> > > On system resume, the gpmi clock must be enabled before accessing gpmi
> > > block.  Without this, resume causes something like
> > >
> > > [  661.348790] gpmi_reset_block(5cbb0f7e): module reset timeout
> > > [  661.348889] gpmi-nand 1806000.gpmi-nand: Error setting GPMI : -110
> > > [  661.348928] PM: dpm_run_callback(): platform_pm_resume+0x0/0x44 returns -110
> > > [  661.348961] PM: Device 1806000.gpmi-nand failed to resume: error -110
> > >
> > > Signed-off-by: Esben Haabendal <esben@geanix.com>
> > > Acked-by: Han Xu <han.xu@nxp.com>  
> 
> Shouldn't this one contain a Fixes tag and be backported to stable?

Does this has ever worked in the past? If yes can someone -Esben, Han-
provide a Fixes tag? I'll edit the patch by hand. I plan to send the PR
at the end of the week.


Thanks,
Miquèl

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 1/2] mtd: rawnand: gpmi: Fix suspend/resume problem
  2020-01-14 17:25     ` Miquel Raynal
@ 2020-01-14 17:29       ` Fabio Estevam
  0 siblings, 0 replies; 15+ messages in thread
From: Fabio Estevam @ 2020-01-14 17:29 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Vignesh Raghavendra, Richard Weinberger, Esben Haabendal, sean,
	Boris Brezillon, linux-mtd, martin, Han Xu, Sascha Hauer

Hi Miquel,

On Tue, Jan 14, 2020 at 2:26 PM Miquel Raynal <miquel.raynal@bootlin.com> wrote:

> Does this has ever worked in the past? If yes can someone -Esben, Han-

Yes, it works.

Adding "Cc: stable" plus the Fixes tag makes it to go to stable
kernels automatically after it reaches Linus' tree.

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 1/2] mtd: rawnand: gpmi: Fix suspend/resume problem
  2020-01-02 13:08 [PATCH 1/2] mtd: rawnand: gpmi: Fix suspend/resume problem Esben Haabendal
                   ` (3 preceding siblings ...)
  2020-01-14 17:03 ` Miquel Raynal
@ 2020-01-15  7:46 ` Sascha Hauer
  2020-01-15  8:46   ` Miquel Raynal
  4 siblings, 1 reply; 15+ messages in thread
From: Sascha Hauer @ 2020-01-15  7:46 UTC (permalink / raw)
  To: Esben Haabendal
  Cc: Vignesh Raghavendra, Richard Weinberger, sean, martin,
	Boris Brezillon, linux-mtd, Miquel Raynal, Han Xu

Hi Esben,

On Thu, Jan 02, 2020 at 02:08:25PM +0100, Esben Haabendal wrote:
> On system resume, the gpmi clock must be enabled before accessing gpmi
> block.  Without this, resume causes something like
> 
> [  661.348790] gpmi_reset_block(5cbb0f7e): module reset timeout
> [  661.348889] gpmi-nand 1806000.gpmi-nand: Error setting GPMI : -110
> [  661.348928] PM: dpm_run_callback(): platform_pm_resume+0x0/0x44 returns -110
> [  661.348961] PM: Device 1806000.gpmi-nand failed to resume: error -110
> 
> Signed-off-by: Esben Haabendal <esben@geanix.com>
> ---
>  drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> index 334fe3130285..7ac8c8b95afc 100644
> --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> @@ -148,6 +148,10 @@ static int gpmi_init(struct gpmi_nand_data *this)
>  	struct resources *r = &this->resources;
>  	int ret;
>  
> +	ret = pm_runtime_get_sync(this->dev);
> +	if (ret < 0)
> +		return ret;

This increases the devices usage counter...

> +
>  	ret = gpmi_reset_block(r->gpmi_regs, false);
>  	if (ret)
>  		goto err_out;
> @@ -181,6 +185,8 @@ static int gpmi_init(struct gpmi_nand_data *this)
>  
>  	return 0;

... but doesn't decrease it in the success case. This means this patch
effectively disables runtime pm. You should fall through here as fixed
in Han Xus patch.

>  err_out:
> +	pm_runtime_mark_last_busy(this->dev);
> +	pm_runtime_put_autosuspend(this->dev);
>  	return ret;

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 1/2] mtd: rawnand: gpmi: Fix suspend/resume problem
  2020-01-15  7:46 ` Sascha Hauer
@ 2020-01-15  8:46   ` Miquel Raynal
  2020-01-17 19:48     ` Esben Haabendal
  0 siblings, 1 reply; 15+ messages in thread
From: Miquel Raynal @ 2020-01-15  8:46 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: Vignesh Raghavendra, Richard Weinberger, Esben Haabendal, martin,
	Boris Brezillon, linux-mtd, sean, Han Xu

Hi Esben,

Sascha Hauer <s.hauer@pengutronix.de> wrote on Wed, 15 Jan 2020
08:46:22 +0100:

> Hi Esben,
> 
> On Thu, Jan 02, 2020 at 02:08:25PM +0100, Esben Haabendal wrote:
> > On system resume, the gpmi clock must be enabled before accessing gpmi
> > block.  Without this, resume causes something like
> > 
> > [  661.348790] gpmi_reset_block(5cbb0f7e): module reset timeout
> > [  661.348889] gpmi-nand 1806000.gpmi-nand: Error setting GPMI : -110
> > [  661.348928] PM: dpm_run_callback(): platform_pm_resume+0x0/0x44 returns -110
> > [  661.348961] PM: Device 1806000.gpmi-nand failed to resume: error -110
> > 
> > Signed-off-by: Esben Haabendal <esben@geanix.com>
> > ---
> >  drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 6 ++++++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> > index 334fe3130285..7ac8c8b95afc 100644
> > --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> > +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
> > @@ -148,6 +148,10 @@ static int gpmi_init(struct gpmi_nand_data *this)
> >  	struct resources *r = &this->resources;
> >  	int ret;
> >  
> > +	ret = pm_runtime_get_sync(this->dev);
> > +	if (ret < 0)
> > +		return ret;  
> 
> This increases the devices usage counter...

I'm dropping the two patches for now, please resend with this fixed and
the Fixes/Cc:stable tags added.

I'll freeze the PR at the end of the week.

> > +
> >  	ret = gpmi_reset_block(r->gpmi_regs, false);
> >  	if (ret)
> >  		goto err_out;
> > @@ -181,6 +185,8 @@ static int gpmi_init(struct gpmi_nand_data *this)
> >  
> >  	return 0;  
> 
> ... but doesn't decrease it in the success case. This means this patch
> effectively disables runtime pm. You should fall through here as fixed
> in Han Xus patch.
> 
> >  err_out:
> > +	pm_runtime_mark_last_busy(this->dev);
> > +	pm_runtime_put_autosuspend(this->dev);
> >  	return ret;  
> 
> Sascha
> 

Thanks,
Miquèl

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

* Re: [PATCH 1/2] mtd: rawnand: gpmi: Fix suspend/resume problem
  2020-01-15  8:46   ` Miquel Raynal
@ 2020-01-17 19:48     ` Esben Haabendal
  0 siblings, 0 replies; 15+ messages in thread
From: Esben Haabendal @ 2020-01-17 19:48 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Vignesh Raghavendra, Richard Weinberger, Sascha Hauer, sean,
	Boris Brezillon, linux-mtd, martin, Han Xu

Miquel Raynal <miquel.raynal@bootlin.com> writes:

> Hi Esben,
>
> Sascha Hauer <s.hauer@pengutronix.de> wrote on Wed, 15 Jan 2020
> 08:46:22 +0100:
>
>> Hi Esben,
>> 
>> On Thu, Jan 02, 2020 at 02:08:25PM +0100, Esben Haabendal wrote:
>> > On system resume, the gpmi clock must be enabled before accessing gpmi
>> > block.  Without this, resume causes something like
>> > 
>> > [  661.348790] gpmi_reset_block(5cbb0f7e): module reset timeout
>> > [  661.348889] gpmi-nand 1806000.gpmi-nand: Error setting GPMI : -110
>> > [  661.348928] PM: dpm_run_callback(): platform_pm_resume+0x0/0x44 returns -110
>> > [  661.348961] PM: Device 1806000.gpmi-nand failed to resume: error -110
>> > 
>> > Signed-off-by: Esben Haabendal <esben@geanix.com>
>> > ---
>> >  drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 6 ++++++
>> >  1 file changed, 6 insertions(+)
>> > 
>> > diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
>> > index 334fe3130285..7ac8c8b95afc 100644
>> > --- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
>> > +++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
>> > @@ -148,6 +148,10 @@ static int gpmi_init(struct gpmi_nand_data *this)
>> >  	struct resources *r = &this->resources;
>> >  	int ret;
>> >  
>> > +	ret = pm_runtime_get_sync(this->dev);
>> > +	if (ret < 0)
>> > +		return ret;  
>> 
>> This increases the devices usage counter...
>
> I'm dropping the two patches for now, please resend with this fixed and
> the Fixes/Cc:stable tags added.
>
> I'll freeze the PR at the end of the week.

I will send out revised patches tonight.

/Esben

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

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

end of thread, back to index

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-02 13:08 [PATCH 1/2] mtd: rawnand: gpmi: Fix suspend/resume problem Esben Haabendal
2020-01-02 13:08 ` [PATCH 2/2] mtd: rawnand: gpmi: Restore nfc timing setup after suspend/resume Esben Haabendal
2020-01-13 17:34   ` Han Xu
2020-01-14 17:03   ` Miquel Raynal
2020-01-07 19:31 ` [PATCH 1/2] mtd: rawnand: gpmi: Fix suspend/resume problem Han Xu
2020-01-09 15:15   ` Miquel Raynal
2020-01-09 17:11     ` Han Xu
2020-01-13 17:32 ` Han Xu
2020-01-14 17:03 ` Miquel Raynal
2020-01-14 17:09   ` Fabio Estevam
2020-01-14 17:25     ` Miquel Raynal
2020-01-14 17:29       ` Fabio Estevam
2020-01-15  7:46 ` Sascha Hauer
2020-01-15  8:46   ` Miquel Raynal
2020-01-17 19:48     ` Esben Haabendal

Linux-mtd Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-mtd/0 linux-mtd/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-mtd linux-mtd/ https://lore.kernel.org/linux-mtd \
		linux-mtd@lists.infradead.org
	public-inbox-index linux-mtd

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-mtd


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git