Skip to content

Commit cb13aa1

Browse files
lucastanurewsakernel
authored andcommitted
i2c: meson: Fix wrong speed use from probe
Having meson_i2c_set_clk_div after i2c_add_adapter causes issues for client drivers that try to use the bus before the requested speed is applied. The bus can be used just after i2c_add_adapter, so move i2c_add_adapter to the final step as meson_i2c_set_clk_div needs to be called before the bus is used. Fixes: 09af1c2 ("i2c: meson: set clock divider in probe instead of setting it for each transfer") Signed-off-by: Lucas Tanure <[email protected]> Reviewed-by: Neil Armstrong <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent d714fb2 commit cb13aa1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/i2c/busses/i2c-meson.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -465,18 +465,18 @@ static int meson_i2c_probe(struct platform_device *pdev)
465465
*/
466466
meson_i2c_set_mask(i2c, REG_CTRL, REG_CTRL_START, 0);
467467

468-
ret = i2c_add_adapter(&i2c->adap);
469-
if (ret < 0) {
470-
clk_disable_unprepare(i2c->clk);
471-
return ret;
472-
}
473-
474468
/* Disable filtering */
475469
meson_i2c_set_mask(i2c, REG_SLAVE_ADDR,
476470
REG_SLV_SDA_FILTER | REG_SLV_SCL_FILTER, 0);
477471

478472
meson_i2c_set_clk_div(i2c, timings.bus_freq_hz);
479473

474+
ret = i2c_add_adapter(&i2c->adap);
475+
if (ret < 0) {
476+
clk_disable_unprepare(i2c->clk);
477+
return ret;
478+
}
479+
480480
return 0;
481481
}
482482

0 commit comments

Comments
 (0)