diff options
author | Kyoung Kim <kyoung.il.kim@intel.com> | 2015-12-22 01:58:04 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-01-13 13:01:05 -0800 |
commit | c980765b05273f9f952aabde979452d13649fbb7 (patch) | |
tree | ed77364e71c5695ab997712698e9c5976bd7be32 | |
parent | b1b0e88beb3de5e61eafad813ffa244d936379d8 (diff) | |
download | chrome-ec-c980765b05273f9f952aabde979452d13649fbb7.tar.gz |
Kunimitsu/Lars: for PMIC, check i2c response before further initialization
There is no indication that PMIC is ready for communication
EC should check i2c response from PMIC first before initializing
rest of registers.
BUG=None
BRANCH=master
TEST=check if there is message, "PMIC init failed", in EC log.
Change-Id: Ic790edf3639acfb2b5357e2638c88dc8d59bebf0
Signed-off-by: Kyoung Kim <kyoung.il.kim@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/319631
Commit-Ready: Kyoung Il Kim <kyoung.il.kim@intel.com>
Tested-by: Kyoung Il Kim <kyoung.il.kim@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
-rw-r--r-- | board/kunimitsu/board.c | 13 | ||||
-rw-r--r-- | board/lars/board.c | 13 |
2 files changed, 20 insertions, 6 deletions
diff --git a/board/kunimitsu/board.c b/board/kunimitsu/board.c index fc12d3c521..f4dcd3d1d3 100644 --- a/board/kunimitsu/board.c +++ b/board/kunimitsu/board.c @@ -379,15 +379,22 @@ static void board_pmic_init(void) { int ret; int data; + int error_count = 0; /* No need to re-init PMIC since settings are sticky across sysjump */ if (system_jumped_to_this_image()) return; /* Read vendor ID */ - ret = I2C_PMIC_READ(TPS650830_REG_VENDORID, &data); - if (ret || data != TPS650830_VENDOR_ID) - goto pmic_error; + while (1) { + ret = I2C_PMIC_READ(TPS650830_REG_VENDORID, &data); + if (!ret && data == TPS650830_VENDOR_ID) { + break; + } else if (error_count > 5) + goto pmic_error; + + error_count++; + } /* * VCCIOCNT register setting diff --git a/board/lars/board.c b/board/lars/board.c index 0bad201b47..4c6f653cc3 100644 --- a/board/lars/board.c +++ b/board/lars/board.c @@ -313,15 +313,22 @@ static void board_pmic_init(void) { int ret; int data; + int error_count = 0; /* No need to re-init PMIC since settings are sticky across sysjump */ if (system_jumped_to_this_image()) return; /* Read vendor ID */ - ret = I2C_PMIC_READ(TPS650830_REG_VENDORID, &data); - if (ret || data != TPS650830_VENDOR_ID) - goto pmic_error; + while (1) { + ret = I2C_PMIC_READ(TPS650830_REG_VENDORID, &data); + if (!ret && data == TPS650830_VENDOR_ID) { + break; + } else if (error_count > 5) + goto pmic_error; + + error_count++; + } /* * VCCIOCNT register setting |