From 7121b003d6d1eae31bd632ac0ac94aa4b352d8d5 Mon Sep 17 00:00:00 2001 From: Todd Broch Date: Fri, 2 Jan 2015 20:58:38 -0800 Subject: [PATCH] pd: remove PD remote flashing console command by default. Add config option, CONFIG_CMD_PD_FLASH, and undef by default. This subcmd in the 'pd' command is large (500 bytes) and can be performed from host via ectool. Additionally the python script, util/flash_pd.py, is likely outdated or needs adjustments for various timing related nuances. Note, as flash command contained subcmd 'version' have added that under 'pd vdm vers' to keep that functionality by default. Signed-off-by: Todd Broch BRANCH=samus BUG=chrome-os-partner:34489 TEST=manual, run 'pd 1 flash signature' get 'parameter 1 invalid' run 'pd 1 vdm vers' w/ zinger in port 1 see version string returned. Change-Id: If282933c1d29febb43b5cf476a121be6b5a1071b Reviewed-on: https://chromium-review.googlesource.com/238291 Reviewed-by: Alec Berg Commit-Queue: Todd Broch Tested-by: Todd Broch --- common/usb_pd_protocol.c | 11 ++++++++--- include/config.h | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index 3e65d4f905..5cb33b1b82 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -2451,7 +2451,7 @@ void pd_set_suspend(int port, int enable) task_wake(PORT_TO_TASK_ID(port)); } -#ifdef CONFIG_CMD_PD +#if defined(CONFIG_CMD_PD) && defined(CONFIG_CMD_PD_FLASH) static int hex8tou32(char *str, uint32_t *val) { char *ptr = str; @@ -2527,7 +2527,7 @@ static int remote_flashing(int argc, char **argv) ccprintf("DONE %d\n", pd[port].vdm_state); return EC_SUCCESS; } -#endif +#endif /* defined(CONFIG_CMD_PD) && defined(CONFIG_CMD_PD_FLASH) */ #if defined(CONFIG_USB_PD_ALT_MODE) && !defined(CONFIG_USB_PD_ALT_MODE_DFP) void pd_send_hpd(int port, enum hpd_event hpd) @@ -2739,11 +2739,16 @@ static int command_pd(int argc, char **argv) } else if (!strncasecmp(argv[3], "curr", 4)) { pd_send_vdm(port, USB_VID_GOOGLE, VDO_CMD_CURRENT, NULL, 0); + } else if (!strncasecmp(argv[3], "vers", 4)) { + pd_send_vdm(port, USB_VID_GOOGLE, VDO_CMD_VERSION, + NULL, 0); } else { return EC_ERROR_PARAM_COUNT; } +#if defined(CONFIG_CMD_PD) && defined(CONFIG_CMD_PD_FLASH) } else if (!strncasecmp(argv[2], "flash", 4)) { return remote_flashing(argc, argv); +#endif } else #endif if (!strncasecmp(argv[2], "state", 5)) { @@ -2793,7 +2798,7 @@ DECLARE_CONSOLE_COMMAND(pd, command_pd, "dualrole|dump|enable [0|1]|rwhashtable|\n\t " "[tx|bist|charger|clock|dev" "|soft|hash|hard|ping|state|swap [power|data]|" - "vdm [ping | curr]]", + "vdm [ping | curr | vers]]", "USB PD", NULL); diff --git a/include/config.h b/include/config.h index 7013a7db0a..d0dbd68d9b 100644 --- a/include/config.h +++ b/include/config.h @@ -332,6 +332,7 @@ #undef CONFIG_CMD_ILIM #undef CONFIG_CMD_JUMPTAGS #define CONFIG_CMD_PD +#undef CONFIG_CMD_PD_FLASH #undef CONFIG_CMD_PLL #undef CONFIG_CMD_PMU #define CONFIG_CMD_POWER_AP