summaryrefslogtreecommitdiff
path: root/common/ccd_config.c
diff options
context:
space:
mode:
authorMary Ruthven <mruthven@google.com>2018-05-22 15:55:23 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-05-30 20:38:53 -0700
commit5a23e3f49ac76e854b51279bc4c2a922ef24339c (patch)
tree541be148b982c8d54267fa6fe60ca05168ce22ea /common/ccd_config.c
parent7b0018521683070cfa5beda948a8ea5278d802cc (diff)
downloadchrome-ec-5a23e3f49ac76e854b51279bc4c2a922ef24339c.tar.gz
cr50: refactor rma mode into factory mode
We're doing a bit of refactoring to break out factory mode into its own file. Now factory reset and rma reset will be two methods of entering factory mode. Factory mode can be disabled with the disable_factory vendor command. Factory mode means all ccd capabilities are set to Always and WP is permanently disabled. When factory mode is disabled, all capabilities are reset to Default and WP is reset to follow battery presence. This adds 56 bytes. BUG=none BRANCH=cr50 TEST=verify rma reset will enable factory mode. Change-Id: I21c6f7b4341e3a18e213e438bbd17c67739b85fa Signed-off-by: Mary Ruthven <mruthven@google.com> Reviewed-on: https://chromium-review.googlesource.com/1069789 Commit-Ready: Mary Ruthven <mruthven@chromium.org> Tested-by: Mary Ruthven <mruthven@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'common/ccd_config.c')
-rw-r--r--common/ccd_config.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/common/ccd_config.c b/common/ccd_config.c
index 5866da0b8f..c356d0a04e 100644
--- a/common/ccd_config.c
+++ b/common/ccd_config.c
@@ -338,9 +338,9 @@ static void ccd_load_config(void)
/* Use defaults if config data is not present */
if (!t) {
if (board_is_first_factory_boot()) {
- /* Give factory RMA access */
+ /* Give factory/RMA access */
CPRINTS("CCD using factory config");
- ccd_reset_config(CCD_RESET_RMA);
+ ccd_reset_config(CCD_RESET_FACTORY);
} else {
/* Somehow we lost our config; normal defaults */
CPRINTS("CCD using default config");
@@ -443,8 +443,8 @@ int ccd_reset_config(unsigned int flags)
config.version = CCD_CONFIG_VERSION;
}
- if (flags & CCD_RESET_RMA) {
- /* Force RMA settings */
+ if (flags & CCD_RESET_FACTORY) {
+ /* Force factory mode settings */
int i;
/* Allow all capabilities all the time */
@@ -690,16 +690,16 @@ static int command_ccd_reset(int argc, char **argv)
int flags = 0;
if (argc > 1) {
- if (!strcasecmp(argv[1], "rma"))
- flags = CCD_RESET_RMA;
+ if (!strcasecmp(argv[1], "factory"))
+ flags = CCD_RESET_FACTORY;
else
return EC_ERROR_PARAM1;
}
switch (ccd_state) {
case CCD_STATE_OPENED:
- ccprintf("%sResetting all settings.\n",
- flags & CCD_RESET_RMA ? "RMA " : "");
+ ccprintf("%s settings.\n", flags & CCD_RESET_FACTORY ?
+ "Opening factory " : "Resetting all");
/* Note that this does not reset the testlab flag */
return ccd_reset_config(flags);
@@ -1115,7 +1115,7 @@ static int command_ccd_help(void)
"\tSet capability to state\n\n"
"password [<new password> | clear]\n"
"\tSet or clear CCD password\n\n"
- "reset [rma]\n"
+ "reset [factory]\n"
"\tReset CCD config\n\n"
"testlab [enable | disable | open]\n"
"\tToggle testlab mode or force CCD open\n\n");
@@ -1409,10 +1409,10 @@ static enum vendor_cmd_rc ccd_vendor(struct vendor_cmd_params *p)
}
DECLARE_VENDOR_COMMAND_P(VENDOR_CC_CCD, ccd_vendor);
-static enum vendor_cmd_rc ccd_disable_rma(enum vendor_cmd_cc code,
- void *buf,
- size_t input_size,
- size_t *response_size)
+static enum vendor_cmd_rc ccd_disable_factory_mode(enum vendor_cmd_cc code,
+ void *buf,
+ size_t input_size,
+ size_t *response_size)
{
int rv = EC_SUCCESS;
int error_line;
@@ -1464,9 +1464,9 @@ static enum vendor_cmd_rc ccd_disable_rma(enum vendor_cmd_cc code,
ccd_lock(NULL);
/*
- * We do it here to make sure that the device comes out of RMA
- * with WP enabled, but in general CCD reset needs to enforce
- * WP state.
+ * We do it here to make sure that the device comes out of
+ * factory mode with WP enabled, but in general CCD reset needs
+ * to enforce WP state.
*
* TODO(rspangler): sort out CCD state and WP correlation,
* b/73075443.
@@ -1483,4 +1483,4 @@ static enum vendor_cmd_rc ccd_disable_rma(enum vendor_cmd_cc code,
*response_size = 1;
return VENDOR_RC_INTERNAL_ERROR;
}
-DECLARE_VENDOR_COMMAND(VENDOR_CC_DISABLE_RMA, ccd_disable_rma);
+DECLARE_VENDOR_COMMAND(VENDOR_CC_DISABLE_FACTORY, ccd_disable_factory_mode);