Skip to content

Commit 83df5bf

Browse files
Marek Vasutbebarino
authored andcommitted
clk: si521xx: Fix regmap write accessor
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: edc1276 ("clk: si521xx: Clock driver for Skyworks Si521xx I2C PCIe clock generators") Signed-off-by: Marek Vasut <marex@denx.de> Link: https://lore.kernel.org/r/20230831181656.154750-2-marex@denx.de Signed-off-by: Stephen Boyd <sboyd@kernel.org>
1 parent f03a562 commit 83df5bf

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/clk/clk-si521xx.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ static int si521xx_regmap_i2c_write(void *context, unsigned int reg,
9696
unsigned int val)
9797
{
9898
struct i2c_client *i2c = context;
99-
const u8 data[3] = { reg, 1, val };
99+
const u8 data[2] = { reg, val };
100100
const int count = ARRAY_SIZE(data);
101101
int ret;
102102

@@ -281,9 +281,10 @@ static int si521xx_probe(struct i2c_client *client)
281281
{
282282
const u16 chip_info = (u16)(uintptr_t)device_get_match_data(&client->dev);
283283
const struct clk_parent_data clk_parent_data = { .index = 0 };
284-
struct si521xx *si;
284+
const u8 data[3] = { SI521XX_REG_BC, 1, 1 };
285285
unsigned char name[6] = "DIFF0";
286286
struct clk_init_data init = {};
287+
struct si521xx *si;
287288
int i, ret;
288289

289290
if (!chip_info)
@@ -308,7 +309,7 @@ static int si521xx_probe(struct i2c_client *client)
308309
"Failed to allocate register map\n");
309310

310311
/* Always read back 1 Byte via I2C */
311-
ret = regmap_write(si->regmap, SI521XX_REG_BC, 1);
312+
ret = i2c_master_send(client, data, ARRAY_SIZE(data));
312313
if (ret < 0)
313314
return ret;
314315

0 commit comments

Comments
 (0)