Kevin Chiu has uploaded this change for review. ( https://review.coreboot.org/21504
Change subject: ec/google: Add command to set APU SKU ID to EC ......................................................................
ec/google: Add command to set APU SKU ID to EC
BUG=b:65359225 BRANCH=reef TEST=emerge-snappy coreboot Change-Id: I8cd3b8f646d4134d6bfff2869f6df2d9c615c157 Signed-off-by: Kevin Chiu Kevin.Chiu@quantatw.com --- M src/ec/google/chromeec/ec.c M src/ec/google/chromeec/ec.h M src/ec/google/chromeec/ec_commands.h 3 files changed, 27 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/04/21504/1
diff --git a/src/ec/google/chromeec/ec.c b/src/ec/google/chromeec/ec.c index 4d47982..03d4c3b 100644 --- a/src/ec/google/chromeec/ec.c +++ b/src/ec/google/chromeec/ec.c @@ -263,6 +263,27 @@ return r.flags[feature / 32] & EC_FEATURE_MASK_0(feature); }
+int google_chromeec_set_sku_id(u32 skuid) +{ + struct chromeec_command cmd; + struct ec_sku_id_info set_skuid = { + .sku_id = skuid + }; + + cmd.cmd_code = EC_CMD_SET_SKU_ID; + cmd.cmd_version = 0; + cmd.cmd_size_in = sizeof(set_skuid); + cmd.cmd_data_in = &set_skuid; + cmd.cmd_data_out = NULL; + cmd.cmd_size_out = 0; + cmd.cmd_dev_index = 0; + + if (google_chromeec_command(&cmd) != 0) + return -1; + + return 0; +} + #if IS_ENABLED(CONFIG_EC_GOOGLE_CHROMEEC_RTC) int rtc_get(struct rtc_time *time) { @@ -389,7 +410,7 @@ u32 google_chromeec_get_sku_id(void) { struct chromeec_command cmd; - struct ec_response_sku_id sku_v; + struct ec_sku_id_info sku_v;
cmd.cmd_code = EC_CMD_GET_SKU_ID; cmd.cmd_version = 0; diff --git a/src/ec/google/chromeec/ec.h b/src/ec/google/chromeec/ec.h index 60d5a32..3a7cadd 100644 --- a/src/ec/google/chromeec/ec.h +++ b/src/ec/google/chromeec/ec.h @@ -50,6 +50,7 @@ uint8_t google_chromeec_calc_checksum(const uint8_t *data, int size); u16 google_chromeec_get_board_version(void); u32 google_chromeec_get_sku_id(void); +int google_chromeec_set_sku_id(u32 skuid); u32 google_chromeec_get_events_b(void); int google_chromeec_clear_events_b(u32 mask); int google_chromeec_kbbacklight(int percent); diff --git a/src/ec/google/chromeec/ec_commands.h b/src/ec/google/chromeec/ec_commands.h index 46ab905..c5d27d2 100644 --- a/src/ec/google/chromeec/ec_commands.h +++ b/src/ec/google/chromeec/ec_commands.h @@ -1124,7 +1124,10 @@ /* Get the board's SKU ID from EC */ #define EC_CMD_GET_SKU_ID 0x000E
-struct __ec_align4 ec_response_sku_id { +/* Set SKU ID from AP */ +#define EC_CMD_SET_SKU_ID 0x000F + +struct __ec_align4 ec_sku_id_info { uint32_t sku_id; };