summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Chiu <Kevin.Chiu@quantatw.com>2017-09-12 09:13:41 +0800
committerAaron Durbin <adurbin@chromium.org>2017-09-13 17:03:34 +0000
commite2bb059187cb98d9c7e21294e54089cbbcde0311 (patch)
tree24cb021ad0b4dad10512c59a258dc31176b5daff
parent461797e3ed8451f7d542af0b721ef1e1f2d9e00a (diff)
downloadcoreboot-e2bb059187cb98d9c7e21294e54089cbbcde0311.tar.xz
ec/google: Add command to set APU SKU ID to EC
EC needs to have command to set SKU ID from APU to support specific feature (ex: keyboard backlight) for variant board. BUG=b:65359225 BRANCH=reef TEST=emerge-snappy coreboot Change-Id: I8cd3b8f646d4134d6bfff2869f6df2d9c615c157 Signed-off-by: Kevin Chiu <Kevin.Chiu@quantatw.com> Reviewed-on: https://review.coreboot.org/21504 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
-rw-r--r--src/ec/google/chromeec/ec.c23
-rw-r--r--src/ec/google/chromeec/ec.h1
-rw-r--r--src/ec/google/chromeec/ec_commands.h5
3 files changed, 27 insertions, 2 deletions
diff --git a/src/ec/google/chromeec/ec.c b/src/ec/google/chromeec/ec.c
index 4d47982aa6..03d4c3bc6d 100644
--- a/src/ec/google/chromeec/ec.c
+++ b/src/ec/google/chromeec/ec.c
@@ -263,6 +263,27 @@ int google_chromeec_check_feature(int feature)
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 @@ u16 google_chromeec_get_board_version(void)
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 60d5a323b7..3a7cadd506 100644
--- a/src/ec/google/chromeec/ec.h
+++ b/src/ec/google/chromeec/ec.h
@@ -50,6 +50,7 @@ int google_chromeec_check_feature(int feature);
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 46ab905e8f..c5d27d2149 100644
--- a/src/ec/google/chromeec/ec_commands.h
+++ b/src/ec/google/chromeec/ec_commands.h
@@ -1124,7 +1124,10 @@ struct __ec_align4 ec_response_get_features {
/* 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;
};