diff options
author | Tom Warren <twarren@nvidia.com> | 2014-04-30 14:51:38 -0700 |
---|---|---|
committer | Marc Jones <marc.jones@se-eng.com> | 2014-12-26 19:39:16 +0100 |
commit | bb932c56f0ba7890697fe2666cc63d2a215d95f1 (patch) | |
tree | d5cbde42d3efadf3417d6b4a1073f925f8f62e1d /src/mainboard/google/nyan/pmic.c | |
parent | fa95a6fb60ccb0a94a041fbad5a2b6fd8cf809fa (diff) |
nyan*: I2C: Implement bus clear when 'ARB_LOST' error occurs
This is a fix for the 'Lost arb' we're seeing on Nyan* during
reboot stress testing. It occurs when we are slamming the
default PMIC registers with pmic_write_reg().
Currently, I've only captured this a few times, and the bus
clear seemed to work, as the PMIC writes continued (where
they'd hang the system before bus clear) for a couple of regs,
then it hangs hard, no messages, no 2nd lost arb, etc. So
I've added code to the PMIC write function that will reset the
SoC if any I2C error occurs. That seems to recover OK, i.e. on
the next reboot the PMIC writes all go thru, boot is OK, kernel
loads, etc.
BUG=chrome-os-partner:28323
BRANCH=nyan
TEST=Tested on nyan. Built for nyan and nyan_big.
Original-Change-Id: I1ac5e3023ae22c015105b7f0fb7849663b4aa982
Original-Signed-off-by: Tom Warren <twarren@nvidia.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/197732
Original-Reviewed-by: Julius Werner <jwerner@chromium.org>
Original-Reviewed-by: Jimmy Zhang <jimmzhang@nvidia.com>
(cherry picked from commit f445127e2d9e223a5ef9117008a7ac7631a7980c)
Signed-off-by: Marc Jones <marc.jones@se-eng.com>
Change-Id: I584d55b99d65f1e278961db6bdde1845cb01f3bc
Reviewed-on: http://review.coreboot.org/7897
Tested-by: build bot (Jenkins)
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Diffstat (limited to 'src/mainboard/google/nyan/pmic.c')
-rw-r--r-- | src/mainboard/google/nyan/pmic.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/mainboard/google/nyan/pmic.c b/src/mainboard/google/nyan/pmic.c index a6e881d10f..dc5f7447a6 100644 --- a/src/mainboard/google/nyan/pmic.c +++ b/src/mainboard/google/nyan/pmic.c @@ -18,6 +18,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include <console/console.h> #include <delay.h> #include <device/i2c.h> #include <stdint.h> @@ -25,6 +26,7 @@ #include "boardid.h" #include "pmic.h" +#include "reset.h" enum { AS3722_I2C_ADDR = 0x40 @@ -59,9 +61,15 @@ static struct as3722_init_reg init_list[] = { static void pmic_write_reg(unsigned bus, uint8_t reg, uint8_t val, int do_delay) { - i2c_writeb(bus, AS3722_I2C_ADDR, reg, val); - if (do_delay) - udelay(500); + if (i2c_writeb(bus, AS3722_I2C_ADDR, reg, val)) { + printk(BIOS_ERR, "%s: reg = 0x%02X, value = 0x%02X failed!\n", + __func__, reg, val); + /* Reset the SoC on any PMIC write error */ + cpu_reset(); + } else { + if (do_delay) + udelay(500); + } } static void pmic_slam_defaults(unsigned bus) |