* [PATCH 1/2] clk: si521xx: Use REGCACHE_FLAT instead of NONE
@ 2023-08-31 18:16 Marek Vasut
2023-08-31 18:16 ` [PATCH 2/2] clk: si521xx: Fix regmap write accessor Marek Vasut
2023-09-11 20:49 ` [PATCH 1/2] clk: si521xx: Use REGCACHE_FLAT instead of NONE Stephen Boyd
0 siblings, 2 replies; 4+ messages in thread
From: Marek Vasut @ 2023-08-31 18:16 UTC (permalink / raw)
To: linux-clk; +Cc: Marek Vasut, Michael Turquette, Stephen Boyd
In order to reload registers into the clock generator on resume using
regcache_sync(), it is necessary to select one of the regcache types
which are not NONE. Since this device has some 7 registers, use the
simplest one, FLAT. The regcache code complains about REGCACHE_NONE
being selected and generates a WARNING, this fixes that warning.
Fixes: edc12763a3a2 ("clk: si521xx: Clock driver for Skyworks Si521xx I2C PCIe clock generators")
Signed-off-by: Marek Vasut <marex@denx.de>
---
Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: linux-clk@vger.kernel.org
---
drivers/clk/clk-si521xx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/clk/clk-si521xx.c b/drivers/clk/clk-si521xx.c
index 4eaf1b53f06bd..0b9e2edbbe67c 100644
--- a/drivers/clk/clk-si521xx.c
+++ b/drivers/clk/clk-si521xx.c
@@ -146,7 +146,7 @@ static int si521xx_regmap_i2c_read(void *context, unsigned int reg,
static const struct regmap_config si521xx_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
- .cache_type = REGCACHE_NONE,
+ .cache_type = REGCACHE_FLAT,
.max_register = SI521XX_REG_DA,
.rd_table = &si521xx_readable_table,
.wr_table = &si521xx_writeable_table,
--
2.40.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/2] clk: si521xx: Fix regmap write accessor
2023-08-31 18:16 [PATCH 1/2] clk: si521xx: Use REGCACHE_FLAT instead of NONE Marek Vasut
@ 2023-08-31 18:16 ` Marek Vasut
2023-09-11 20:50 ` Stephen Boyd
2023-09-11 20:49 ` [PATCH 1/2] clk: si521xx: Use REGCACHE_FLAT instead of NONE Stephen Boyd
1 sibling, 1 reply; 4+ messages in thread
From: Marek Vasut @ 2023-08-31 18:16 UTC (permalink / raw)
To: linux-clk; +Cc: Marek Vasut, Michael Turquette, Stephen Boyd
Rework the write operation such that the Byte Count register is written with
a single raw i2c write outside of regmap using transfer which does specify
the number of bytes to be transfered, one in this case, and which makes the
expected subsequent write transfer look like address+register+data, and then
make use of this method. Without this change, the Byte Count register write
in probe() would succeed as it would provide the byte count as part of its
write payload, but any subsequent writes would fail due to this Byte Count
register programming. Such failing writes happens e.g. during resume, when
restoring the regmap content.
Fixes: edc12763a3a2 ("clk: si521xx: Clock driver for Skyworks Si521xx I2C PCIe clock generators")
Signed-off-by: Marek Vasut <marex@denx.de>
---
Cc: Michael Turquette <mturquette@baylibre.com>
Cc: Stephen Boyd <sboyd@kernel.org>
Cc: linux-clk@vger.kernel.org
---
drivers/clk/clk-si521xx.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/clk/clk-si521xx.c b/drivers/clk/clk-si521xx.c
index 0b9e2edbbe67c..ef4ba467e747b 100644
--- a/drivers/clk/clk-si521xx.c
+++ b/drivers/clk/clk-si521xx.c
@@ -96,7 +96,7 @@ static int si521xx_regmap_i2c_write(void *context, unsigned int reg,
unsigned int val)
{
struct i2c_client *i2c = context;
- const u8 data[3] = { reg, 1, val };
+ const u8 data[2] = { reg, val };
const int count = ARRAY_SIZE(data);
int ret;
@@ -281,9 +281,10 @@ static int si521xx_probe(struct i2c_client *client)
{
const u16 chip_info = (u16)(uintptr_t)device_get_match_data(&client->dev);
const struct clk_parent_data clk_parent_data = { .index = 0 };
- struct si521xx *si;
+ const u8 data[3] = { SI521XX_REG_BC, 1, 1 };
unsigned char name[6] = "DIFF0";
struct clk_init_data init = {};
+ struct si521xx *si;
int i, ret;
if (!chip_info)
@@ -308,7 +309,7 @@ static int si521xx_probe(struct i2c_client *client)
"Failed to allocate register map\n");
/* Always read back 1 Byte via I2C */
- ret = regmap_write(si->regmap, SI521XX_REG_BC, 1);
+ ret = i2c_master_send(client, data, ARRAY_SIZE(data));
if (ret < 0)
return ret;
--
2.40.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH 2/2] clk: si521xx: Fix regmap write accessor
2023-08-31 18:16 ` [PATCH 2/2] clk: si521xx: Fix regmap write accessor Marek Vasut
@ 2023-09-11 20:50 ` Stephen Boyd
0 siblings, 0 replies; 4+ messages in thread
From: Stephen Boyd @ 2023-09-11 20:50 UTC (permalink / raw)
To: Marek Vasut, linux-clk; +Cc: Marek Vasut, Michael Turquette
Quoting Marek Vasut (2023-08-31 11:16:56)
> Rework the write operation such that the Byte Count register is written with
> a single raw i2c write outside of regmap using transfer which does specify
> the number of bytes to be transfered, one in this case, and which makes the
> expected subsequent write transfer look like address+register+data, and then
> make use of this method. Without this change, the Byte Count register write
> in probe() would succeed as it would provide the byte count as part of its
> write payload, but any subsequent writes would fail due to this Byte Count
> register programming. Such failing writes happens e.g. during resume, when
> restoring the regmap content.
>
> Fixes: edc12763a3a2 ("clk: si521xx: Clock driver for Skyworks Si521xx I2C PCIe clock generators")
> Signed-off-by: Marek Vasut <marex@denx.de>
> ---
Applied to clk-fixes
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] clk: si521xx: Use REGCACHE_FLAT instead of NONE
2023-08-31 18:16 [PATCH 1/2] clk: si521xx: Use REGCACHE_FLAT instead of NONE Marek Vasut
2023-08-31 18:16 ` [PATCH 2/2] clk: si521xx: Fix regmap write accessor Marek Vasut
@ 2023-09-11 20:49 ` Stephen Boyd
1 sibling, 0 replies; 4+ messages in thread
From: Stephen Boyd @ 2023-09-11 20:49 UTC (permalink / raw)
To: Marek Vasut, linux-clk; +Cc: Marek Vasut, Michael Turquette
Quoting Marek Vasut (2023-08-31 11:16:55)
> In order to reload registers into the clock generator on resume using
> regcache_sync(), it is necessary to select one of the regcache types
> which are not NONE. Since this device has some 7 registers, use the
> simplest one, FLAT. The regcache code complains about REGCACHE_NONE
> being selected and generates a WARNING, this fixes that warning.
>
> Fixes: edc12763a3a2 ("clk: si521xx: Clock driver for Skyworks Si521xx I2C PCIe clock generators")
> Signed-off-by: Marek Vasut <marex@denx.de>
> ---
Applied to clk-fixes
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-09-12 3:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-31 18:16 [PATCH 1/2] clk: si521xx: Use REGCACHE_FLAT instead of NONE Marek Vasut
2023-08-31 18:16 ` [PATCH 2/2] clk: si521xx: Fix regmap write accessor Marek Vasut
2023-09-11 20:50 ` Stephen Boyd
2023-09-11 20:49 ` [PATCH 1/2] clk: si521xx: Use REGCACHE_FLAT instead of NONE Stephen Boyd
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox