mtd: rawnand: gpmi: Fix suspend/resume problem
PATCH 1/2 mtd: rawnand: gpmi: Fix suspend/resume problem
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
--- drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +6 -0
@@ -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; }
Signature · 6 lines
2.24.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
PATCH 2/2 mtd: rawnand: gpmi: Restore nfc timing setup after suspend/resume
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.
--- drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +4 -0
@@ -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) {
Signature · 6 lines
2.24.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Re: [PATCH 2/2] mtd: rawnand: gpmi: Restore nfc timing setup after suspend/resume
Quoted 15 lines · Esben Haabendal
As we reset the GPMI block at resume, the timing parameters setup by a previous
exec_opis lost. Rewriting GPMI timing registers on firstexec_opafter resume fixes the problem.Signed-off-by Esben Haabendal <[email protected]>--- drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +0
-0
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c static int gpmi_pm_resume(struct device *dev) · line 2734
Quoted 7 lines
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +4
-0@@ -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; +
Quoted 10 lines
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +0
-1/* 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/
Signature · 7 lines
Sincerely, Han XU ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Re: [PATCH 2/2] mtd: rawnand: gpmi: Restore nfc timing setup after suspend/resume
In reply to Esben HaabendalQuoted 6 lines · Esben Haabendal
As we reset the GPMI block at resume, the timing parameters setup by a previous
exec_opis lost. Rewriting GPMI timing registers on firstexec_opafter resume fixes the problem.Signed-off-by Esben Haabendal <[email protected]>Acked-by Han Xu <[email protected]>
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/
Quoted 30 lines · Esben Haabendal
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 -110Signed-off-by Esben Haabendal <[email protected]>--- drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 6 ++++++ 1 file changed, 6 insertions(+)drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +4
-0@@ -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;
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c static int gpmi_init(struct gpmi_nand_data *this) · line 191
Quoted 7 lines
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +2
-0@@ -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.
Quoted 8 lines
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +0
-1--2.24.1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Signature · 7 lines
Sincerely, Han XU ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Miquel Raynal
maintainerHi Han,
Han Xu <[email protected]> wrote on Tue, 7 Jan 2020 13:31:27 -0600:
Quoted 32 lines · Esben Haabendal
Quoted 31 lines
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 -110Signed-off-by Esben Haabendal <[email protected]>--- drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 6 ++++++ 1 file changed, 6 insertions(+)drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +4
-0@@ -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)
Quoted 8 lines
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c static int gpmi_init(struct gpmi_nand_data *this) · line 191
Quoted 6 lines
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +2
-0return 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/
Quoted 46 lines · Miquel Raynal
Hi Han,
Han Xu <[email protected]> wrote on Tue, 7 Jan 2020 13:31:27 -0600:
Quoted 32 lines · Esben Haabendal
Quoted 31 lines
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 -110Signed-off-by Esben Haabendal <[email protected]>--- drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 6 ++++++ 1 file changed, 6 insertions(+)drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +4
-0@@ -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)Quoted 8 lines
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c static int gpmi_init(struct gpmi_nand_data *this) · line 191
Quoted 6 lines
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +2
-0return 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.
Quoted 3 lines
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.
Quoted 3 lines
Thanks,
Miquèl
Signature · 7 lines
Sincerely, Han XU ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Quoted 30 lines · Esben Haabendal
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 -110Signed-off-by Esben Haabendal <[email protected]>--- drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 6 ++++++ 1 file changed, 6 insertions(+)drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +4
-0@@ -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;
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c static int gpmi_init(struct gpmi_nand_data *this) · line 191
Quoted 7 lines
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +2
-0@@ -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; }
Quoted 8 lines
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +0
-1--2.24.1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Signature · 7 lines
Sincerely, Han XU ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Quoted 10 lines · Esben Haabendal
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 -110Signed-off-by Esben Haabendal <[email protected]>Acked-by Han Xu <[email protected]>
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/
Quoted 5 lines · Miquel Raynal
Quoted 3 lines · Esben Haabendal
On system resume, the gpmi clock must be enabled before accessing gpmi block. Without this, resume causes something like
Quoted 7 lines
Quoted 7 lines
[ 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 -110Signed-off-by Esben Haabendal <[email protected]>Acked-by Han Xu <[email protected]>
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/
Miquel Raynal
maintainerHi Fabio,
Fabio Estevam <[email protected]> wrote on Tue, 14 Jan 2020 14:09:21 -0300:
Quoted 11 lines · Miquel Raynal
Quoted 10 lines · Esben Haabendal
Quoted 8 lines
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
Quoted 4 lines
Quoted 2 lines
Quoted 2 lines
Signed-off-by Esben Haabendal <[email protected]>Acked-by Han Xu <[email protected]>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/
Hi Miquel,
Quoted 1 line · Miquel Raynal
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/
Hi Esben,
Quoted 18 lines · Esben Haabendal
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 -110Signed-off-by Esben Haabendal <[email protected]>--- drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 6 ++++++ 1 file changed, 6 insertions(+)drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +0
-0
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c static int gpmi_init(struct gpmi_nand_data *this) · line 153
Quoted 6 lines
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +3
-0@@ -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...
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c static int gpmi_init(struct gpmi_nand_data *this) · line 186
Quoted 7 lines
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +1
-0+ 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.
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c static int gpmi_init(struct gpmi_nand_data *this) · line 190
Quoted 4 lines
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +2
-0err_out: +pm_runtime_mark_last_busy (this->dev); +pm_runtime_put_autosuspend (this->dev);return ret;
Sascha
Signature · 8 lines
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/
Miquel Raynal
maintainerHi Esben,
Sascha Hauer <[email protected]> wrote on Wed, 15 Jan 2020 08:46:22 +0100:
Quoted 24 lines
Hi Esben,
Quoted 21 lines · Esben Haabendal
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 -110Signed-off-by Esben Haabendal <[email protected]>--- drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 6 ++++++ 1 file changed, 6 insertions(+)drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +0
-0@@ -148,6 +148,10 @@ static int gpmi_init(struct gpmi_nand_data *this)struct resources *r = &this->resources;int ret;
Quoted 5 lines
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c static int gpmi_init(struct gpmi_nand_data *this) · line 153
Quoted 3 lines
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +3
-0+ 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.
Quoted 12 lines
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c static int gpmi_init(struct gpmi_nand_data *this) · line 186
Quoted 7 lines
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +1
-0+ 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.
Quoted 7 lines
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c static int gpmi_init(struct gpmi_nand_data *this) · line 190
Quoted 4 lines
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +2
-0err_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/
Quoted 35 lines · Miquel Raynal
Hi Esben,
Sascha Hauer <[email protected]> wrote on Wed, 15 Jan 2020 08:46:22 +0100:
Quoted 24 lines
Hi Esben,
Quoted 21 lines · Esben Haabendal
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 -110Signed-off-by Esben Haabendal <[email protected]>--- drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 6 ++++++ 1 file changed, 6 insertions(+)drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +0
-0@@ -148,6 +148,10 @@ static int gpmi_init(struct gpmi_nand_data *this)struct resources *r = &this->resources;int ret;Quoted 5 lines
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c static int gpmi_init(struct gpmi_nand_data *this) · line 153
Quoted 3 lines
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +3
-0+ ret =pm_runtime_get_sync (this->dev); +if (ret <0 ) +return ret;This increases the devices usage counter...
Quoted 4 lines
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/