Skip to content

Commit b610c4b

Browse files
NXP-CarlosSongwsakernel
authored andcommitted
i2c: imx-lpi2c: return -EINVAL when i2c peripheral clk doesn't work
On MX8X platforms, the default clock rate is 0 if without explicit clock setting in dts nodes. I2c can't work when i2c peripheral clk rate is 0. Add a i2c peripheral clk rate check before configuring the clock register. When i2c peripheral clk rate is 0 and directly return -EINVAL. Signed-off-by: Carlos Song <carlos.song@nxp.com> Acked-by: Dong Aisheng <Aisheng.dong@nxp.com> Reviewed-by: Andi Shyti <andi.shyti@kernel.org> Signed-off-by: Wolfram Sang <wsa@kernel.org>
1 parent 2ccdd1b commit b610c4b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/i2c/busses/i2c-imx-lpi2c.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,9 @@ static int lpi2c_imx_config(struct lpi2c_imx_struct *lpi2c_imx)
209209
lpi2c_imx_set_mode(lpi2c_imx);
210210

211211
clk_rate = clk_get_rate(lpi2c_imx->clks[0].clk);
212+
if (!clk_rate)
213+
return -EINVAL;
214+
212215
if (lpi2c_imx->mode == HS || lpi2c_imx->mode == ULTRA_FAST)
213216
filt = 0;
214217
else

0 commit comments

Comments
 (0)