tegra: i2c: re-init i2c controller after reset
This serves as supplemental patch to CL:197732. After clearing bus, we should also redo controller init (because controller has been reset before bus clear). On the upper layer, upon receiving error return status, it should just retry instead of simply call cpu_reset(). BUG=chrome-os-partner:28323 BRANCH=nyan TEST=Built and tested on nyan and nyan_big. Original-Change-Id: Ib526bc730cb73ffef8696fc2a6a2769d6e71eb9e Original-Signed-off-by: Jimmy Zhang <jimmzhang@nvidia.com> Original-Reviewed-on: https://chromium-review.googlesource.com/202784 Original-Reviewed-by: Julius Werner <jwerner@chromium.org> (cherry picked from commit 06f8917c70ddca88c847d0f15ebe7f286a3f6338) Signed-off-by: Marc Jones <marc.jones@se-eng.com> Change-Id: I1d8bc43d730b53fe7f2dad8713831311e96e3984 Reviewed-on: http://review.coreboot.org/8145 Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Tested-by: build bot (Jenkins)
This commit is contained in:
parent
b26fd99087
commit
f4ef77e844
|
@ -112,12 +112,14 @@ static int tegra_i2c_send_recv(int bus, int read,
|
||||||
"%s: The address was not acknowledged.\n",
|
"%s: The address was not acknowledged.\n",
|
||||||
__func__);
|
__func__);
|
||||||
info->reset_func(info->reset_bit);
|
info->reset_func(info->reset_bit);
|
||||||
|
i2c_init(bus);
|
||||||
return -1;
|
return -1;
|
||||||
} else if (transfer_status & I2C_PKT_STATUS_NOACK_DATA) {
|
} else if (transfer_status & I2C_PKT_STATUS_NOACK_DATA) {
|
||||||
printk(BIOS_ERR,
|
printk(BIOS_ERR,
|
||||||
"%s: The data was not acknowledged.\n",
|
"%s: The data was not acknowledged.\n",
|
||||||
__func__);
|
__func__);
|
||||||
info->reset_func(info->reset_bit);
|
info->reset_func(info->reset_bit);
|
||||||
|
i2c_init(bus);
|
||||||
return -1;
|
return -1;
|
||||||
} else if (transfer_status & I2C_PKT_STATUS_ARB_LOST) {
|
} else if (transfer_status & I2C_PKT_STATUS_ARB_LOST) {
|
||||||
printk(BIOS_ERR,
|
printk(BIOS_ERR,
|
||||||
|
@ -128,6 +130,9 @@ static int tegra_i2c_send_recv(int bus, int read,
|
||||||
/* Use Tegra bus clear registers to unlock SDA */
|
/* Use Tegra bus clear registers to unlock SDA */
|
||||||
do_bus_clear(bus);
|
do_bus_clear(bus);
|
||||||
|
|
||||||
|
/* re-init i2c controller */
|
||||||
|
i2c_init(bus);
|
||||||
|
|
||||||
/* Return w/error, let caller decide what to do */
|
/* Return w/error, let caller decide what to do */
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue