summaryrefslogtreecommitdiff
path: root/driver
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 05:38:20 +0000
commit23c692b43cbe0d8cd11fcb3e80583abd1533a121 (patch)
treef116e71fc7e7b90831d71669e9d793c055d9c3e6 /driver
parent14575473de1b0e3bd481305df412b76ca833eb8b (diff)
downloadchrome-ec-23c692b43cbe0d8cd11fcb3e80583abd1533a121.tar.gz
bq25710: Do not soft reset when running out of RW image
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>
Diffstat (limited to 'driver')
-rw-r--r--driver/charger/bq25710.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/driver/charger/bq25710.c b/driver/charger/bq25710.c
index a9e58a7f51..c258b0d7c6 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"
#include "util.h"
@@ -200,22 +201,26 @@ static void bq25710_init(int chgnum)
* 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(chgnum, 0);
- /* Allow enough time for VDDA to be powered */
- msleep(BQ25710_VDDA_STARTUP_DELAY_MSEC);
- rv |= raw_read16(chgnum, BQ25710_REG_MIN_SYSTEM_VOLTAGE, &vsys);
- rv |= raw_read16(chgnum, BQ25710_REG_CHARGE_OPTION_3, &reg);
- if (!rv) {
- reg |= BQ25710_CHARGE_OPTION_3_RESET_REG;
- /* Set all registers to default values */
- raw_write16(chgnum, BQ25710_REG_CHARGE_OPTION_3, reg);
- /* Restore VSYS_MIN voltage to POR reset value */
- raw_write16(chgnum, BQ25710_REG_MIN_SYSTEM_VOLTAGE, vsys);
+ if (!system_is_in_rw()) {
+ rv = bq25710_set_low_power_mode(chgnum, 0);
+ /* Allow enough time for VDDA to be powered */
+ msleep(BQ25710_VDDA_STARTUP_DELAY_MSEC);
+ rv |= raw_read16(chgnum, BQ25710_REG_MIN_SYSTEM_VOLTAGE, &vsys);
+ rv |= raw_read16(chgnum, BQ25710_REG_CHARGE_OPTION_3, &reg);
+ if (!rv) {
+ reg |= BQ25710_CHARGE_OPTION_3_RESET_REG;
+ /* Set all registers to default values */
+ raw_write16(chgnum, BQ25710_REG_CHARGE_OPTION_3, reg);
+ /* Restore VSYS_MIN voltage to POR reset value */
+ raw_write16(chgnum, BQ25710_REG_MIN_SYSTEM_VOLTAGE,
+ vsys);
+ }
+ /* Reenable low power mode */
+ bq25710_set_low_power_mode(chgnum, 1);
}
- /* Reenable low power mode */
- bq25710_set_low_power_mode(chgnum, 1);
if (!raw_read16(chgnum, BQ25710_REG_PROCHOT_OPTION_1, &reg)) {
/* Disable VDPM prochot profile at initialization */