linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] clk: rs9: Fix suspend/resume
@ 2023-03-10  7:49 Alexander Stein
  2023-03-13 22:26 ` Stephen Boyd
  2023-03-21 17:47 ` Stephen Boyd
  0 siblings, 2 replies; 6+ messages in thread
From: Alexander Stein @ 2023-03-10  7:49 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Marek Vasut; +Cc: Alexander Stein, linux-clk

Disabling the cache in commit 2ff4ba9e3702 ("clk: rs9: Fix I2C accessors")
without removing cache synchronization in resume path results in a
kernel panic as map->cache_ops is unset, due to REGCACHE_NONE.
Enable flat cache again to support resume again. num_reg_defaults_raw
is necessary to read the cache defaults from hardware. Some registers
are strapped in hardware and cannot be provided in software.

Fixes: 2ff4ba9e3702 ("clk: rs9: Fix I2C accessors")
Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
There is also a series to not panic when using regcache_sync on
REGCACHE_NONE maps at [1].

[1] https://lore.kernel.org/lkml/20230310073911.3470892-1-alexander.stein@ew.tq-group.com/T/#u

 drivers/clk/clk-renesas-pcie.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk-renesas-pcie.c b/drivers/clk/clk-renesas-pcie.c
index 1e8b196e36f3..3377ee55c4f0 100644
--- a/drivers/clk/clk-renesas-pcie.c
+++ b/drivers/clk/clk-renesas-pcie.c
@@ -149,8 +149,9 @@ static int rs9_regmap_i2c_read(void *context,
 static const struct regmap_config rs9_regmap_config = {
 	.reg_bits = 8,
 	.val_bits = 8,
-	.cache_type = REGCACHE_NONE,
+	.cache_type = REGCACHE_FLAT,
 	.max_register = RS9_REG_BCP,
+	.num_reg_defaults_raw = 0x8,
 	.rd_table = &rs9_readable_table,
 	.wr_table = &rs9_writeable_table,
 	.reg_write = rs9_regmap_i2c_write,
-- 
2.34.1


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

* Re: [PATCH 1/1] clk: rs9: Fix suspend/resume
  2023-03-10  7:49 [PATCH 1/1] clk: rs9: Fix suspend/resume Alexander Stein
@ 2023-03-13 22:26 ` Stephen Boyd
  2023-03-14  7:22   ` Alexander Stein
  2023-03-21 17:47 ` Stephen Boyd
  1 sibling, 1 reply; 6+ messages in thread
From: Stephen Boyd @ 2023-03-13 22:26 UTC (permalink / raw)
  To: Alexander Stein, Marek Vasut, Michael Turquette
  Cc: Alexander Stein, linux-clk

Quoting Alexander Stein (2023-03-09 23:49:40)
> Disabling the cache in commit 2ff4ba9e3702 ("clk: rs9: Fix I2C accessors")
> without removing cache synchronization in resume path results in a
> kernel panic as map->cache_ops is unset, due to REGCACHE_NONE.
> Enable flat cache again to support resume again. num_reg_defaults_raw
> is necessary to read the cache defaults from hardware. Some registers
> are strapped in hardware and cannot be provided in software.
> 
> Fixes: 2ff4ba9e3702 ("clk: rs9: Fix I2C accessors")
> Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> ---
> There is also a series to not panic when using regcache_sync on
> REGCACHE_NONE maps at [1].

And it was rejected?

> 
> [1] https://lore.kernel.org/lkml/20230310073911.3470892-1-alexander.stein@ew.tq-group.com/T/#u
>

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

* Re: [PATCH 1/1] clk: rs9: Fix suspend/resume
  2023-03-13 22:26 ` Stephen Boyd
@ 2023-03-14  7:22   ` Alexander Stein
  2023-03-20 19:35     ` Stephen Boyd
  0 siblings, 1 reply; 6+ messages in thread
From: Alexander Stein @ 2023-03-14  7:22 UTC (permalink / raw)
  To: Marek Vasut, Michael Turquette, Stephen Boyd; +Cc: linux-clk

Am Montag, 13. März 2023, 23:26:54 CET schrieb Stephen Boyd:
> Quoting Alexander Stein (2023-03-09 23:49:40)
> 
> > Disabling the cache in commit 2ff4ba9e3702 ("clk: rs9: Fix I2C accessors")
> > without removing cache synchronization in resume path results in a
> > kernel panic as map->cache_ops is unset, due to REGCACHE_NONE.
> > Enable flat cache again to support resume again. num_reg_defaults_raw
> > is necessary to read the cache defaults from hardware. Some registers
> > are strapped in hardware and cannot be provided in software.
> > 
> > Fixes: 2ff4ba9e3702 ("clk: rs9: Fix I2C accessors")
> > Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> > ---
> > There is also a series to not panic when using regcache_sync on
> > REGCACHE_NONE maps at [1].
> 
> And it was rejected?

v2 has been accepted and is available at [1] in regmap's for-next branch.

Best regards,
Alexander

[1] https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git/
commit/?id=fd883d79e4dcd2417c2b80756f22a2ff03b0f6e0
-- 
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/



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

* Re: [PATCH 1/1] clk: rs9: Fix suspend/resume
  2023-03-14  7:22   ` Alexander Stein
@ 2023-03-20 19:35     ` Stephen Boyd
  2023-03-21  6:20       ` Alexander Stein
  0 siblings, 1 reply; 6+ messages in thread
From: Stephen Boyd @ 2023-03-20 19:35 UTC (permalink / raw)
  To: Alexander Stein, Marek Vasut, Michael Turquette; +Cc: linux-clk

Quoting Alexander Stein (2023-03-14 00:22:07)
> Am Montag, 13. M�rz 2023, 23:26:54 CET schrieb Stephen Boyd:
> > Quoting Alexander Stein (2023-03-09 23:49:40)
> > 
> > > Disabling the cache in commit 2ff4ba9e3702 ("clk: rs9: Fix I2C accessors")
> > > without removing cache synchronization in resume path results in a
> > > kernel panic as map->cache_ops is unset, due to REGCACHE_NONE.
> > > Enable flat cache again to support resume again. num_reg_defaults_raw
> > > is necessary to read the cache defaults from hardware. Some registers
> > > are strapped in hardware and cannot be provided in software.
> > > 
> > > Fixes: 2ff4ba9e3702 ("clk: rs9: Fix I2C accessors")
> > > Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> > > ---
> > > There is also a series to not panic when using regcache_sync on
> > > REGCACHE_NONE maps at [1].
> > 
> > And it was rejected?
> 
> v2 has been accepted and is available at [1] in regmap's for-next branch.
> 

So this still needs to be applied and backported to fix stable kernels?

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

* Re: [PATCH 1/1] clk: rs9: Fix suspend/resume
  2023-03-20 19:35     ` Stephen Boyd
@ 2023-03-21  6:20       ` Alexander Stein
  0 siblings, 0 replies; 6+ messages in thread
From: Alexander Stein @ 2023-03-21  6:20 UTC (permalink / raw)
  To: Marek Vasut, Michael Turquette, Stephen Boyd; +Cc: linux-clk

Am Montag, 20. März 2023, 20:35:41 CET schrieb Stephen Boyd:
> Quoting Alexander Stein (2023-03-14 00:22:07)
> 
> > Am Montag, 13. M�rz 2023, 23:26:54 CET schrieb Stephen Boyd:
> > > Quoting Alexander Stein (2023-03-09 23:49:40)
> > > 
> > > > Disabling the cache in commit 2ff4ba9e3702 ("clk: rs9: Fix I2C
> > > > accessors")
> > > > without removing cache synchronization in resume path results in a
> > > > kernel panic as map->cache_ops is unset, due to REGCACHE_NONE.
> > > > Enable flat cache again to support resume again. num_reg_defaults_raw
> > > > is necessary to read the cache defaults from hardware. Some registers
> > > > are strapped in hardware and cannot be provided in software.
> > > > 
> > > > Fixes: 2ff4ba9e3702 ("clk: rs9: Fix I2C accessors")
> > > > Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> > > > ---
> > > > There is also a series to not panic when using regcache_sync on
> > > > REGCACHE_NONE maps at [1].
> > > 
> > > And it was rejected?
> > 
> > v2 has been accepted and is available at [1] in regmap's for-next branch.
> 
> So this still needs to be applied and backported to fix stable kernels?

IMHO yes, because without cache nothing will be stored/restored upon suspend/
resume. The other patch in regcache was just to ensure broken drivers (like 
this one in the current state) do not crash the kernel.

Best regards,
Alexander

-- 
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/



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

* Re: [PATCH 1/1] clk: rs9: Fix suspend/resume
  2023-03-10  7:49 [PATCH 1/1] clk: rs9: Fix suspend/resume Alexander Stein
  2023-03-13 22:26 ` Stephen Boyd
@ 2023-03-21 17:47 ` Stephen Boyd
  1 sibling, 0 replies; 6+ messages in thread
From: Stephen Boyd @ 2023-03-21 17:47 UTC (permalink / raw)
  To: Alexander Stein, Marek Vasut, Michael Turquette
  Cc: Alexander Stein, linux-clk

Quoting Alexander Stein (2023-03-09 23:49:40)
> Disabling the cache in commit 2ff4ba9e3702 ("clk: rs9: Fix I2C accessors")
> without removing cache synchronization in resume path results in a
> kernel panic as map->cache_ops is unset, due to REGCACHE_NONE.
> Enable flat cache again to support resume again. num_reg_defaults_raw
> is necessary to read the cache defaults from hardware. Some registers
> are strapped in hardware and cannot be provided in software.
> 
> Fixes: 2ff4ba9e3702 ("clk: rs9: Fix I2C accessors")
> Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> ---

Applied to clk-fixes

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

end of thread, other threads:[~2023-03-21 17:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-10  7:49 [PATCH 1/1] clk: rs9: Fix suspend/resume Alexander Stein
2023-03-13 22:26 ` Stephen Boyd
2023-03-14  7:22   ` Alexander Stein
2023-03-20 19:35     ` Stephen Boyd
2023-03-21  6:20       ` Alexander Stein
2023-03-21 17:47 ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).