diff options
author | Vincent Palatin <vpalatin@chromium.org> | 2014-05-13 13:02:26 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-05-17 20:14:23 +0000 |
commit | 5fd33410770fbc9b29432fe6ca81a763e6b47ec4 (patch) | |
tree | ed81c35caa3cf5f5dd39f9c5eb245dbbd8b9c8d6 /common | |
parent | 00cf95783210c5b94565b0e0d480271dcef490ca (diff) | |
download | chrome-ec-5fd33410770fbc9b29432fe6ca81a763e6b47ec4.tar.gz |
zinger: add support to flash RW firmware
Allow flashing the RW firmware by sending Vendor-Defined Messages over
the USB-PD link.
This is not the secure update whose design is still under discussion,
it's a simple update with integrity check.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BRANCH=none
BUG=chrome-os-partner:28330
TEST=using the following CLs,
./util/flash_pd.py ./build/zinger/ec.RW.flat
and see Zinger booting on RW, repeat the operations with different
builds of the RW firmware.
Change-Id: Icd90eb92f7321ccd66341a50b9dabd73c59c68c1
Reviewed-on: https://chromium-review.googlesource.com/197948
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/usb_pd_protocol.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index d9eb6259d6..0fc93539c0 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -395,8 +395,23 @@ static int send_bist(void *ctxt) static void handle_vdm_request(void *ctxt, int cnt, uint32_t *payload) { - CPRINTF("[%T PD Unhandled VDM VID %04x CMD %04x]\n", payload[0] >> 16, - payload[0] & 0xFFFF); + uint16_t vid = PD_VDO_VID(payload[0]); +#ifdef CONFIG_USB_PD_CUSTOM_VDM + int rlen; + uint32_t *rdata; + + if (vid == USB_VID_GOOGLE) { + rlen = pd_custom_vdm(ctxt, cnt, payload, &rdata); + if (rlen > 0) { + uint16_t header = PD_HEADER(PD_DATA_VENDOR_DEF, + pd_role, pd_message_id, rlen); + send_validate_message(ctxt, header, rlen, rdata); + } + return; + } +#endif + CPRINTF("[%T PD Unhandled VDM VID %04x CMD %04x]\n", + vid, payload[0] & 0xFFFF); } static void handle_data_request(void *ctxt, uint16_t head, uint32_t *payload) |