Commit 77c48c76 authored by Gwendal Grignou's avatar Gwendal Grignou Committed by Lee Jones

mfd: cros_ec: Add Smart Battery Firmware update API

Add API to update battery firmware.
Signed-off-by: default avatarGwendal Grignou <gwendal@chromium.org>
Acked-by: default avatarEnric Balletbo i Serra <enric.balletbo@collabora.com>
Acked-by: default avatarBenson Leung <bleung@chromium.org>
Reviewed-by: default avatarFabien Lahoudere <fabien.lahoudere@collabora.com>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent b92be99f
......@@ -4243,6 +4243,79 @@ struct ec_response_battery_vendor_param {
uint32_t value;
} __ec_align4;
/*****************************************************************************/
/*
* Smart Battery Firmware Update Commands
*/
#define EC_CMD_SB_FW_UPDATE 0x00B5
enum ec_sb_fw_update_subcmd {
EC_SB_FW_UPDATE_PREPARE = 0x0,
EC_SB_FW_UPDATE_INFO = 0x1, /*query sb info */
EC_SB_FW_UPDATE_BEGIN = 0x2, /*check if protected */
EC_SB_FW_UPDATE_WRITE = 0x3, /*check if protected */
EC_SB_FW_UPDATE_END = 0x4,
EC_SB_FW_UPDATE_STATUS = 0x5,
EC_SB_FW_UPDATE_PROTECT = 0x6,
EC_SB_FW_UPDATE_MAX = 0x7,
};
#define SB_FW_UPDATE_CMD_WRITE_BLOCK_SIZE 32
#define SB_FW_UPDATE_CMD_STATUS_SIZE 2
#define SB_FW_UPDATE_CMD_INFO_SIZE 8
struct ec_sb_fw_update_header {
uint16_t subcmd; /* enum ec_sb_fw_update_subcmd */
uint16_t fw_id; /* firmware id */
} __ec_align4;
struct ec_params_sb_fw_update {
struct ec_sb_fw_update_header hdr;
union {
/* EC_SB_FW_UPDATE_PREPARE = 0x0 */
/* EC_SB_FW_UPDATE_INFO = 0x1 */
/* EC_SB_FW_UPDATE_BEGIN = 0x2 */
/* EC_SB_FW_UPDATE_END = 0x4 */
/* EC_SB_FW_UPDATE_STATUS = 0x5 */
/* EC_SB_FW_UPDATE_PROTECT = 0x6 */
/* Those have no args */
/* EC_SB_FW_UPDATE_WRITE = 0x3 */
struct __ec_align4 {
uint8_t data[SB_FW_UPDATE_CMD_WRITE_BLOCK_SIZE];
} write;
};
} __ec_align4;
struct ec_response_sb_fw_update {
union {
/* EC_SB_FW_UPDATE_INFO = 0x1 */
struct __ec_align1 {
uint8_t data[SB_FW_UPDATE_CMD_INFO_SIZE];
} info;
/* EC_SB_FW_UPDATE_STATUS = 0x5 */
struct __ec_align1 {
uint8_t data[SB_FW_UPDATE_CMD_STATUS_SIZE];
} status;
};
} __ec_align1;
/*
* Entering Verified Boot Mode Command
* Default mode is VBOOT_MODE_NORMAL if EC did not receive this command.
* Valid Modes are: normal, developer, and recovery.
*/
#define EC_CMD_ENTERING_MODE 0x00B6
struct ec_params_entering_mode {
int vboot_mode;
} __ec_align4;
#define VBOOT_MODE_NORMAL 0
#define VBOOT_MODE_DEVELOPER 1
#define VBOOT_MODE_RECOVERY 2
/*****************************************************************************/
/*
* HDMI CEC commands
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment