mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-09-21 07:01:57 +00:00
i2c: rockchip: De-initialize the bus after start bit failure
Failure can happen when i2c is used without initializing pinctrl properly, which U-Boot happily allows in SPL. Without this fix, further I2C access would fail, even after proper pinctrl initialization. Signed-off-by: Ondrej Jirman <megi@xff.cz> Cc: Heiko Schocher <hs@denx.de> Reviewed-by: Kever Yang <kever.yang@rock-chips.com> Reviewed-by: Heiko Schocher <hs@denx.de>
This commit is contained in:
parent
26659d4265
commit
ba5b9203f5
1 changed files with 4 additions and 3 deletions
|
@ -342,7 +342,7 @@ static int rockchip_i2c_xfer(struct udevice *bus, struct i2c_msg *msg,
|
||||||
int nmsgs)
|
int nmsgs)
|
||||||
{
|
{
|
||||||
struct rk_i2c *i2c = dev_get_priv(bus);
|
struct rk_i2c *i2c = dev_get_priv(bus);
|
||||||
int ret;
|
int ret = 0;
|
||||||
|
|
||||||
debug("i2c_xfer: %d messages\n", nmsgs);
|
debug("i2c_xfer: %d messages\n", nmsgs);
|
||||||
for (; nmsgs > 0; nmsgs--, msg++) {
|
for (; nmsgs > 0; nmsgs--, msg++) {
|
||||||
|
@ -356,14 +356,15 @@ static int rockchip_i2c_xfer(struct udevice *bus, struct i2c_msg *msg,
|
||||||
}
|
}
|
||||||
if (ret) {
|
if (ret) {
|
||||||
debug("i2c_write: error sending\n");
|
debug("i2c_write: error sending\n");
|
||||||
return -EREMOTEIO;
|
ret = -EREMOTEIO;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rk_i2c_send_stop_bit(i2c);
|
rk_i2c_send_stop_bit(i2c);
|
||||||
rk_i2c_disable(i2c);
|
rk_i2c_disable(i2c);
|
||||||
|
|
||||||
return 0;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int rockchip_i2c_set_bus_speed(struct udevice *bus, unsigned int speed)
|
int rockchip_i2c_set_bus_speed(struct udevice *bus, unsigned int speed)
|
||||||
|
|
Loading…
Reference in a new issue