summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Collyer <scollyer@google.com>2020-03-06 13:49:16 -0800
committerCommit Bot <commit-bot@chromium.org>2020-03-09 16:23:33 +0000
commit1a1b1e9704db2a2639a5c6857327c95a01f5f079 (patch)
tree398fa3cc886e89e043a09efb65daa07f083f4866
parente28e9252c24e30c1cde19b1d968deae36eefa20e (diff)
downloadchrome-ec-firmware-hatch-12672.117.B.tar.gz
bq25710: Do not soft reset when running out of RW imagefirmware-hatch-12672.117.B
The bq25710 does not have a reset pin and therefore it's only following a power on reset that its registers are reset. The driver's init function executes a soft reset of the bq25710 to ensure that register settings following either an EC reboot or power on reset are the same. However, this is happening when the EC is in RO or RW, and there is no need to do this in RW. This CL adds a check around the soft reset so that it's only done in R0. BUG=b:148189096 BRANCH=firmware-hatch-12672.B TEST=Verified that low power mode no longer gets reenabled following the jump to RW. Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I78a7484d3e44147cf350b785889f0f913b03bd06 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2092213 Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Commit-Queue: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2094836 Tested-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
-rw-r--r--driver/charger/bq25710.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/driver/charger/bq25710.c b/driver/charger/bq25710.c
index 9df085d78f..68fb757a72 100644
--- a/driver/charger/bq25710.c
+++ b/driver/charger/bq25710.c
@@ -15,6 +15,7 @@
#include "hooks.h"
#include "i2c.h"
#include "task.h"
+#include "system.h"
#include "timer.h"
#ifndef CONFIG_CHARGER_NARROW_VDC
@@ -194,22 +195,25 @@ static void bq25710_init(void)
* MIN_SYSTEM_VOLTAGE register prior to setting the reset so that the
* correct value is preserved. In order to have the correct value read,
* the bq25710 must not be in low power mode, otherwise the VDDA rail
- * may not be powered if AC is not connected.
+ * may not be powered if AC is not connected. Note, this reset is only
+ * required when running out of RO and not following sysjump to RW.
*/
- rv = bq25710_set_low_power_mode(0);
- /* Allow enough time for VDDA to be powered */
- msleep(BQ25710_VDDA_STARTUP_DELAY_MSEC);
- rv |= raw_read16(BQ25710_REG_MIN_SYSTEM_VOLTAGE, &vsys);
- rv |= raw_read16(BQ25710_REG_CHARGE_OPTION_3, &reg);
- if (!rv) {
- reg |= BQ25710_CHARGE_OPTION_3_RESET_REG;
- /* Set all registers to default values */
- raw_write16(BQ25710_REG_CHARGE_OPTION_3, reg);
- /* Restore VSYS_MIN voltage to POR reset value */
- raw_write16(BQ25710_REG_MIN_SYSTEM_VOLTAGE, vsys);
+ if (!system_is_in_rw()) {
+ rv = bq25710_set_low_power_mode(0);
+ /* Allow enough time for VDDA to be powered */
+ msleep(BQ25710_VDDA_STARTUP_DELAY_MSEC);
+ rv |= raw_read16(BQ25710_REG_MIN_SYSTEM_VOLTAGE, &vsys);
+ rv |= raw_read16(BQ25710_REG_CHARGE_OPTION_3, &reg);
+ if (!rv) {
+ reg |= BQ25710_CHARGE_OPTION_3_RESET_REG;
+ /* Set all registers to default values */
+ raw_write16(BQ25710_REG_CHARGE_OPTION_3, reg);
+ /* Restore VSYS_MIN voltage to POR reset value */
+ raw_write16(BQ25710_REG_MIN_SYSTEM_VOLTAGE, vsys);
+ }
+ /* Reenable low power mode */
+ bq25710_set_low_power_mode(1);
}
- /* Reenable low power mode */
- bq25710_set_low_power_mode(1);
if (!raw_read16(BQ25710_REG_PROCHOT_OPTION_1, &reg)) {
/* Disbale VDPM prochot profile at initialization */