summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJimmy Zhang <jimmzhang@nvidia.com>2014-06-05 15:20:56 -0700
committerMarc Jones <marc.jones@se-eng.com>2015-01-09 08:19:36 +0100
commitf4ef77e8449338931a990cb35580dad584cc6053 (patch)
tree189fb41dd3fd6efd3107e55ae23708e148cac136
parentb26fd99087049d01920382a5d7875f9c50a07cb0 (diff)
downloadcoreboot-f4ef77e8449338931a990cb35580dad584cc6053.tar.xz
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)
-rw-r--r--src/soc/nvidia/tegra/i2c.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/soc/nvidia/tegra/i2c.c b/src/soc/nvidia/tegra/i2c.c
index 26c2559d84..542d4f0fab 100644
--- a/src/soc/nvidia/tegra/i2c.c
+++ b/src/soc/nvidia/tegra/i2c.c
@@ -112,12 +112,14 @@ static int tegra_i2c_send_recv(int bus, int read,
"%s: The address was not acknowledged.\n",
__func__);
info->reset_func(info->reset_bit);
+ i2c_init(bus);
return -1;
} else if (transfer_status & I2C_PKT_STATUS_NOACK_DATA) {
printk(BIOS_ERR,
"%s: The data was not acknowledged.\n",
__func__);
info->reset_func(info->reset_bit);
+ i2c_init(bus);
return -1;
} else if (transfer_status & I2C_PKT_STATUS_ARB_LOST) {
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 */
do_bus_clear(bus);
+ /* re-init i2c controller */
+ i2c_init(bus);
+
/* Return w/error, let caller decide what to do */
return -1;
}