diff options
author | Sheng-Liang Song <ssl@chromium.org> | 2015-02-14 14:29:52 -0800 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-02-20 08:33:08 +0000 |
commit | 036482b6b84b3c216bb83e3627ced560fd3da822 (patch) | |
tree | 6bae878e7ce82e61b776f87c6b0f4565da52bfeb /util/ec_sb_firmware_update.h | |
parent | 279e2c6386e24dbbe8d9d8ad83556f065b4b1a20 (diff) | |
download | chrome-ec-036482b6b84b3c216bb83e3627ced560fd3da822.tar.gz |
EC: Support firmware updater to auto select a battery fw image
Auto select a battery firmware image based on the current "battery info."
sprintf(auto_image_name,"/lib/firmware/battery/maker.%04X.hwid.%04X.bin"
maker_id, hardware_id);
BUG=chrome-os-partner:24741
BRANCH=glimmer
TEST=Verified Simplo Battery Update on glimmer
Change-Id: Ie6b2f797a4629fdde3a45e9a6a83c4568655db7a
Signed-off-by: Sheng-Liang Song <ssl@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/250130
Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'util/ec_sb_firmware_update.h')
-rw-r--r-- | util/ec_sb_firmware_update.h | 41 |
1 files changed, 14 insertions, 27 deletions
diff --git a/util/ec_sb_firmware_update.h b/util/ec_sb_firmware_update.h index 8737756cd4..7dcd6802fa 100644 --- a/util/ec_sb_firmware_update.h +++ b/util/ec_sb_firmware_update.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2014 The Chromium OS Authors. All rights reserved. +/* Copyright 2014 The Chromium OS Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. * @@ -108,32 +108,19 @@ enum sb_maker_id { sb_maker_id_celxpert = 0x0006, }; -/* if permanent error:b5,b3; go to setp8 */ -#define SB_FW_UPDATE_PERMANENT_ERROR_MASK 0x0028 - -/* if firmware update fatal error:b12; go to step2 */ -#define SB_FW_UPDATE_FW_FATAL_ERROR_MASK 0x1000 -#define SB_FW_UPDATE_FW_FATAL_ERROR_RETRY_CNT 1 /* Retry Error cnt*/ - -/* if error:b11,b10,b9 b2,b1,b0; go to step1 */ -#define SB_FW_UPDATE_ERROR_MASK 0x0E07 -#define SB_FW_UPDATE_ERROR_RETRY_CNT 1 /* Retry Error cnt*/ - -/* if FEC.b13=1, go to step6 */ -#define SB_FW_UPDATE_FEC_ERROR_MASK 0x2000 /* b13 */ -#define SB_FW_UPDATE_FEC_ERROR_RETRY_CNT 1 /* b13.FEC retry cnt*/ - -/* if busy; retry 10 times */ -#define SB_FW_UPDATE_BUSY_ERROR_MASK 0x4000 /* b14 */ -#define SB_FW_UPDATE_BUSY_ERROR_RETRY_CNT 1 /* b14.busy retry cnt*/ - -/** - * Update Smart Battery Firmware - * - * @param fw_image_name firmware image name - * - * @return 0 if success, negative if error. +/* + * Ref: Common Smart Battery System Interface Specification v8.0 page 21-24. + * case 1. If permanent error:b5,b3, go to setp8. + * case 2. If error:b11,b10,b9 b2,b1,b0, go to step1. Retry < 3 times. + * case 3. If firmware update fatal error:b12, go to step2. Retry < 3 times. + * In order to simply the implementation, I merged case 2 and 3. + * If firmware update fatal error:b12, go to step1 as well. + * case 4. If error.FEC.b13=1, go to step6. Retry < 3 times. + * case 5. If battery interface is busy, retry < 10 times. + * Delay 1 second between retries. */ -int ec_sb_firmware_update(const char *fw_image_name); +#define SB_FW_UPDATE_ERROR_RETRY_CNT 2 +#define SB_FW_UPDATE_FEC_ERROR_RETRY_CNT 2 +#define SB_FW_UPDATE_BUSY_ERROR_RETRY_CNT 9 #endif |