summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNick Sanders <nsanders@chromium.org>2016-07-19 15:13:50 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-07-21 13:13:35 -0700
commit14dbcb829e2c676cb2325445f7e3b9f352833050 (patch)
tree0e6a1aa974b7f9a3a9286a3339fd9a8b8f9656d0 /include
parent63bd3feaabb95562c1051a718ac88305126c3ead (diff)
downloadchrome-ec-14dbcb829e2c676cb2325445f7e3b9f352833050.tar.gz
servo_v4: copypasta usb updater code into common
This copies the generic USB update code into common so it can be used on other platforms. There should be no functional change. cr50 folks want no change to their code so vbendeb@chomium.org will refactor this back together at a later date. BUG=chromium:571476 TEST=none BRANCH=none Change-Id: I710afb22940013e7db5d8694898b90c0ae245777 Signed-off-by: Nick Sanders <nsanders@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/362131 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/config.h2
-rw-r--r--include/update_fw.h36
-rw-r--r--include/usb_descriptor.h6
3 files changed, 43 insertions, 1 deletions
diff --git a/include/config.h b/include/config.h
index 3cd443a3a3..d868d5671e 100644
--- a/include/config.h
+++ b/include/config.h
@@ -2199,6 +2199,8 @@
/* Firmware updates using other than HC channel(s). */
#undef CONFIG_NON_HC_FW_UPDATE
#undef CONFIG_USB_FW_UPDATE
+/* A different config for the same update. TODO(vbendeb): dedup these */
+#undef CONFIG_USB_UPDATE
/*****************************************************************************/
/*
diff --git a/include/update_fw.h b/include/update_fw.h
new file mode 100644
index 0000000000..f1b76e1033
--- /dev/null
+++ b/include/update_fw.h
@@ -0,0 +1,36 @@
+/* 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_UPDATE_FW_H
+#define __CROS_EC_UPDATE_FW_H
+
+#include <stddef.h>
+
+/* TODO: Handle this in update_fw.c, not usb_update.c */
+#define UPDATE_DONE 0xB007AB1E
+
+/*
+ * This array defines possible sections available for the firmare update.
+ * The section which does not map the current execting code is picked as the
+ * valid update area. The values are offsets into the flash space.
+ *
+ * This should be defined in board.c, with each entry containing:
+ * {CONFIG_RW_MEM_OFF, CONFIG_RW_MEM_OFF + CONFIG_RW_SIZE}
+ * for its relevant section.
+ */
+struct section_descriptor {
+ uint32_t sect_base_offset;
+ uint32_t sect_top_offset;
+};
+
+extern const struct section_descriptor * const rw_sections;
+extern const int num_rw_sections;
+
+
+void fw_update_command_handler(void *body,
+ size_t cmd_size,
+ size_t *response_size);
+
+#endif /* ! __CROS_EC_UPDATE_FW_H */
diff --git a/include/usb_descriptor.h b/include/usb_descriptor.h
index a29b9eda76..22f2c08257 100644
--- a/include/usb_descriptor.h
+++ b/include/usb_descriptor.h
@@ -167,11 +167,15 @@ struct usb_endpoint_descriptor {
#define USB_SUBCLASS_GOOGLE_I2C 0x52
#define USB_PROTOCOL_GOOGLE_I2C 0x01
+#define USB_SUBCLASS_GOOGLE_UPDATE 0x53
+#define USB_PROTOCOL_GOOGLE_UPDATE 0xff
+
+/* Double define for cr50 code freeze.
+ * TODO(vbendeb): dedup this. */
#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 */
/* bRequestType fields */