diff options
author | Keith Short <keithshort@chromium.org> | 2018-12-19 16:17:28 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-01-08 01:59:12 -0800 |
commit | 90d177e3f0ae729bea7e24934a3c6ef9f2520d45 (patch) | |
tree | da02f562f4d768beb09aaf198c252972347c232b /common/ccd_config.c | |
parent | 5079009d35d8900bb030cbc7d9ebc34cf3ad1696 (diff) | |
download | chrome-ec-90d177e3f0ae729bea7e24934a3c6ef9f2520d45.tar.gz |
cr50: Changes to support closed source EC factory mode
Drives OEM specific GPIOs to enable and disable factory mode to a closed
source EC.
BUG=b:118683718
BRANCH=none
TEST=make buildall. Verified GPIO states with scope in both factory mode
enable and disable conditions. Verified GPIO states are reapplied
correctly after reboot, deep sleep, and power cycle.
Change-Id: I9bc547504478fded5f95c515027e1da0f245d524
Signed-off-by: Keith Short <keithshort@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1358733
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
Diffstat (limited to 'common/ccd_config.c')
-rw-r--r-- | common/ccd_config.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/common/ccd_config.c b/common/ccd_config.c index c6946522c5..8569ab6beb 100644 --- a/common/ccd_config.c +++ b/common/ccd_config.c @@ -474,6 +474,8 @@ int ccd_reset_config(unsigned int flags) for (i = 0; i < CCD_CAP_COUNT; i++) raw_set_cap(i, CCD_CAP_STATE_ALWAYS); + raw_set_flag(CCD_FLAG_FACTORY_MODE_ENABLED, 1); + /* Force WP disabled at boot */ raw_set_flag(CCD_FLAG_OVERRIDE_WP_AT_BOOT, 1); raw_set_flag(CCD_FLAG_OVERRIDE_WP_STATE_ENABLED, 0); @@ -679,6 +681,11 @@ void ccd_disable(void) ccd_set_state(CCD_STATE_LOCKED); } +int ccd_get_factory_mode(void) +{ + return ccd_get_flag(CCD_FLAG_FACTORY_MODE_ENABLED); +} + /******************************************************************************/ /* Console commands */ @@ -1511,6 +1518,13 @@ static enum vendor_cmd_rc ccd_disable_factory_mode(enum vendor_cmd_cc code, */ set_wp_follow_ccd_config(); + /* + * Use raw_set_flag() because the factory mode flag is internal + */ + mutex_lock(&ccd_config_mutex); + raw_set_flag(CCD_FLAG_FACTORY_MODE_ENABLED, 0); + mutex_unlock(&ccd_config_mutex); + *response_size = 0; return VENDOR_RC_SUCCESS; } while (0); |