mcdp28x0: Add info console command.

Would be useful to expose more of the GProbe commands to developers
who have access to boards console (hoho, honeybuns).  This CL adds
a console command and seeds it the 'mcdp info' command.

Signed-off-by: Todd Broch <tbroch@chromium.org>

BRANCH=samus
BUG=chrome-os-partner:35939
TEST=manual, with CONFIG_CMD_MCDP defined in board/hoho/board.h

  - Enter info console command multiple times and see correct
    return value.

      mcdp info
      family:000e chipid:0001 irom:1.0.0 fw:0.0.0

Change-Id: Iaf2c088d5da1af7b2dab11abcfb6e32e289066ea
Reviewed-on: https://chromium-review.googlesource.com/272692
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
This commit is contained in:
Todd Broch
2015-05-20 16:23:11 -07:00
committed by ChromeOS Commit Bot
parent 1a996dc19c
commit c2af47cd37
2 changed files with 33 additions and 6 deletions

View File

@@ -158,11 +158,37 @@ int mcdp_get_info(struct mcdp_info *info)
memcpy(info, &inbuf[2], MCDP_LEN_GETINFO);
#ifdef MCDP_DEBUG
CPRINTF("family:%04x chipid:%04x irom:%d.%d.%d fw:%d.%d.%d\n",
MCDP_FAMILY(info->family), MCDP_CHIPID(info->chipid),
info->irom.major, info->irom.minor, info->irom.build,
info->fw.major, info->fw.minor, info->fw.build);
#endif
return EC_SUCCESS;
}
#ifdef CONFIG_CMD_MCDP
int command_mcdp(int argc, char **argv)
{
int rv = EC_SUCCESS;
if (argc < 2)
return EC_ERROR_PARAM_COUNT;
mcdp_enable();
if (!strncasecmp(argv[1], "info", 4)) {
struct mcdp_info info;
rv = mcdp_get_info(&info);
if (!rv)
ccprintf("family:%04x chipid:%04x irom:%d.%d.%d "
"fw:%d.%d.%d\n",
MCDP_FAMILY(info.family),
MCDP_CHIPID(info.chipid),
info.irom.major, info.irom.minor,
info.irom.build,
info.fw.major, info.fw.minor, info.fw.build);
} else {
rv = EC_ERROR_PARAM1;
}
mcdp_disable();
return rv;
}
DECLARE_CONSOLE_COMMAND(mcdp, command_mcdp,
"info",
"USB PD",
NULL);
#endif /* CONFIG_CMD_MCDP */

View File

@@ -374,6 +374,7 @@
#define CONFIG_CMD_IDLE_STATS
#undef CONFIG_CMD_ILIM
#undef CONFIG_CMD_JUMPTAGS
#undef CONFIG_CMD_MCDP
#define CONFIG_CMD_PD
#undef CONFIG_CMD_PD_DEV_DUMP_INFO
#undef CONFIG_CMD_PD_FLASH