Cr50: Update the USB VID:PID:subclass constants

The device-specific subclass used for Non-HC firmware updates is
in the spreadsheet now, so we can rename the macros to be
"official".

BUG=chrome-os-partner:49962
BRANCH=none
TEST=make buildall; test on cr50

  make BOARD=cr50 (plus whatever signing magic works for you)
  make -C extra/usb_updater
  ./extra/usb_updater/usb_updater build/cr50/ec.bin  (sudo if needed)

Note that you may need to rebuild ec.bin in order to see any
difference after the update. If the A & B images are identical,
the RO bootloader always picks A.

Change-Id: I385ce89a9abe2059d52da2d82a0b92b9b3e3c93f
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/339220
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
This commit is contained in:
Bill Richardson
2016-04-13 17:26:36 -07:00
committed by chrome-bot
parent de45353bbd
commit b28ed970c4
6 changed files with 30 additions and 29 deletions

View File

@@ -8,6 +8,9 @@
#include <stddef.h>
/* TODO: Handle this in upgrade_fw.c, not usb_upgrade.c */
#define UPGRADE_DONE 0xB007AB1E
void fw_upgrade_command_handler(void *body,
size_t cmd_size,
size_t *response_size);

View File

@@ -12,7 +12,6 @@
#include "system.h"
#include "upgrade_fw.h"
#include "usb-stream.h"
#include "usb_upgrade.h"
#define CPRINTS(format, args...) cprints(CC_USB, format, ## args)
@@ -49,8 +48,8 @@ static struct queue const usb_to_upgrade = QUEUE_DIRECT(64, uint8_t,
USB_STREAM_CONFIG_FULL(usb_upgrade,
USB_IFACE_UPGRADE,
USB_CLASS_VENDOR_SPEC,
UNOFFICIAL_USB_SUBCLASS_GOOGLE_CR50,
0xff, /* vendor-specific protocol */
USB_SUBCLASS_GOOGLE_CR50,
USB_PROTOCOL_GOOGLE_CR50_NON_HC_FW_UPDATE,
USB_STR_UPGRADE_NAME,
USB_EP_UPGRADE,
USB_MAX_PACKET_SIZE,

View File

@@ -1,14 +0,0 @@
/* Copyright 2016 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef __CROS_EC_USB_UPGRADE_H
#define __CROS_EC_USB_UPGRADE_H
#define UNOFFICIAL_USB_SUBCLASS_GOOGLE_CR50 0x53
/* Commands from host */
#define UPGRADE_DONE 0xB007AB1E
#endif /* __CROS_EC_USB_UPGRADE_H */

View File

@@ -25,7 +25,9 @@ CFLAGS := -std=gnu99 \
LIBS += $(shell pkg-config --libs libusb-1.0) -lcrypto
CFLAGS += $(shell pkg-config --cflags libusb-1.0)
CFLAGS += -I../../board/cr50 -I ../../chip/g -I../../util
# NOTE: This may be board-specific
BOARD ?= cr50
CFLAGS += -I../../include -I../../board/$(BOARD) -I ../../chip/g -I../../util
$(PROGRAM): $(SOURCE) Makefile
gcc $(CFLAGS) $(SOURCE) $(LFLAGS) $(LIBS) -o $@

View File

@@ -15,15 +15,22 @@
#include <sys/types.h>
#include <unistd.h>
#include "misc_util.h"
#include "usb_upgrade.h"
#include "config_chip.h"
/* Google Cr50 */
#define VID 0x18d1
#define PID 0x5014
#define SUBCLASS UNOFFICIAL_USB_SUBCLASS_GOOGLE_CR50
#define PROTOCOL 0xff
#ifndef __packed
#define __packed __attribute__((packed))
#endif
#include "misc_util.h"
#include "usb_descriptor.h"
#include "upgrade_fw.h"
#include "config_chip.h"
#include "board.h"
/* Look for Cr50 FW update interface */
#define VID USB_VID_GOOGLE
#define PID CONFIG_USB_PID
#define SUBCLASS USB_SUBCLASS_GOOGLE_CR50
#define PROTOCOL USB_PROTOCOL_GOOGLE_CR50_NON_HC_FW_UPDATE
/* Globals */
static char *progname;
@@ -211,8 +218,8 @@ static int parse_vidpid(const char *input, uint16_t *vid_ptr, uint16_t *pid_ptr)
}
static struct libusb_device_handle *usb_connect(uint16_t vid, uint16_t pid,
uint8_t *ep_num, int *chunk_len)
static struct libusb_device_handle *usb_findit(uint16_t vid, uint16_t pid,
uint8_t *ep_num, int *chunk_len)
{
struct libusb_device_handle *devh;
int iface_num, r;
@@ -442,7 +449,7 @@ int main(int argc, char *argv[])
exit(1);
}
devh = usb_connect(vid, pid, &ep_num, &chunk_len);
devh = usb_findit(vid, pid, &ep_num, &chunk_len);
transfer_and_reboot(devh, data, data_len, ep_num, chunk_len);

View File

@@ -167,6 +167,10 @@ struct usb_endpoint_descriptor {
#define USB_SUBCLASS_GOOGLE_I2C 0x52
#define USB_PROTOCOL_GOOGLE_I2C 0x01
#define USB_SUBCLASS_GOOGLE_CR50 0x53
/* We can use any protocol we want */
#define USB_PROTOCOL_GOOGLE_CR50_NON_HC_FW_UPDATE 0xff
/* Control requests */