mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-14 16:46:23 +00:00
servo_v4: add USB updater
This adds a Google FW update endpoint to servo v4. BUG=chromium:571476 TEST=successfully update servo v4 via usb BRANCH=None Change-Id: I79cb46364d416300e430708db25814f861a6d7c9 Signed-off-by: Nick Sanders <nsanders@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/361833 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
#include "spi.h"
|
||||
#include "task.h"
|
||||
#include "timer.h"
|
||||
#include "update_fw.h"
|
||||
#include "usart-stm32f0.h"
|
||||
#include "usart_tx_dma.h"
|
||||
#include "usart_rx_dma.h"
|
||||
@@ -176,6 +177,7 @@ const void *const usb_strings[] = {
|
||||
[USB_STR_CONSOLE_NAME] = USB_STRING_DESC("Servo EC Shell"),
|
||||
[USB_STR_USART3_STREAM_NAME] = USB_STRING_DESC("DUT UART"),
|
||||
[USB_STR_USART4_STREAM_NAME] = USB_STRING_DESC("Atmega UART"),
|
||||
[USB_STR_UPDATE_NAME] = USB_STRING_DESC("Firmware update"),
|
||||
};
|
||||
|
||||
BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT);
|
||||
@@ -197,6 +199,27 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
|
||||
USB_I2C_CONFIG(usb_i2c, USB_IFACE_I2C, USB_EP_I2C);
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* Support firmware upgrade over USB. We can update whichever section is not
|
||||
* the current section.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This array defines possible sections available for the firmware update.
|
||||
* The section which does not map the current executing code is picked as the
|
||||
* valid update area. The values are offsets into the flash space.
|
||||
*/
|
||||
const struct section_descriptor board_rw_sections[] = {
|
||||
{CONFIG_RO_MEM_OFF,
|
||||
CONFIG_RO_MEM_OFF + CONFIG_RO_SIZE},
|
||||
{CONFIG_RW_MEM_OFF,
|
||||
CONFIG_RW_MEM_OFF + CONFIG_RW_SIZE},
|
||||
};
|
||||
const struct section_descriptor * const rw_sections = board_rw_sections;
|
||||
const int num_rw_sections = ARRAY_SIZE(board_rw_sections);
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* Initialize board.
|
||||
*/
|
||||
|
||||
@@ -27,26 +27,29 @@
|
||||
#define CONFIG_USB
|
||||
#define CONFIG_USB_PID 0x501b
|
||||
#define CONFIG_USB_CONSOLE
|
||||
#define CONFIG_USB_UPDATE
|
||||
|
||||
#define CONFIG_USB_SERIALNO
|
||||
#define DEFAULT_SERIALNO "Uninitialized"
|
||||
|
||||
/* USB interface indexes (use define rather than enum to expand them) */
|
||||
#define USB_IFACE_CONSOLE 0
|
||||
#define USB_IFACE_GPIO 1
|
||||
#define USB_IFACE_I2C 2
|
||||
#define USB_IFACE_USART3_STREAM 3
|
||||
#define USB_IFACE_USART4_STREAM 4
|
||||
#define USB_IFACE_COUNT 5
|
||||
#define USB_IFACE_CONSOLE 0
|
||||
#define USB_IFACE_GPIO 1
|
||||
#define USB_IFACE_I2C 2
|
||||
#define USB_IFACE_USART3_STREAM 3
|
||||
#define USB_IFACE_USART4_STREAM 4
|
||||
#define USB_IFACE_UPDATE 5
|
||||
#define USB_IFACE_COUNT 6
|
||||
|
||||
/* USB endpoint indexes (use define rather than enum to expand them) */
|
||||
#define USB_EP_CONTROL 0
|
||||
#define USB_EP_CONSOLE 1
|
||||
#define USB_EP_GPIO 2
|
||||
#define USB_EP_I2C 3
|
||||
#define USB_EP_USART3_STREAM 4
|
||||
#define USB_EP_USART4_STREAM 5
|
||||
#define USB_EP_COUNT 6
|
||||
#define USB_EP_CONTROL 0
|
||||
#define USB_EP_CONSOLE 1
|
||||
#define USB_EP_GPIO 2
|
||||
#define USB_EP_I2C 3
|
||||
#define USB_EP_USART3_STREAM 4
|
||||
#define USB_EP_USART4_STREAM 5
|
||||
#define USB_EP_UPDATE 6
|
||||
#define USB_EP_COUNT 7
|
||||
|
||||
/* Enable control of GPIOs over USB */
|
||||
#define CONFIG_USB_GPIO
|
||||
@@ -91,6 +94,7 @@ enum usb_strings {
|
||||
USB_STR_CONSOLE_NAME,
|
||||
USB_STR_USART3_STREAM_NAME,
|
||||
USB_STR_USART4_STREAM_NAME,
|
||||
USB_STR_UPDATE_NAME,
|
||||
|
||||
USB_STR_COUNT
|
||||
};
|
||||
|
||||
@@ -17,5 +17,5 @@
|
||||
* 's' is the stack size in bytes; must be a multiple of 8
|
||||
*/
|
||||
#define CONFIG_TASK_LIST \
|
||||
TASK_ALWAYS(HOOKS, hook_task, NULL, TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(HOOKS, hook_task, NULL, VENTI_TASK_STACK_SIZE) \
|
||||
TASK_ALWAYS(CONSOLE, console_task, NULL, TASK_STACK_SIZE)
|
||||
|
||||
Reference in New Issue
Block a user