diff options
author | Dominic Chen <ddchen@chromium.org> | 2014-06-30 11:39:02 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-08-15 17:55:08 +0000 |
commit | 5c5f832da90d732d1f26b0862a57fe91d2d82ddb (patch) | |
tree | b19c18902aa785cc16b458cf10d8228f11110b6a | |
parent | c9809547c27037c4d5e30fa9b689a670a5e47c6d (diff) | |
download | chrome-ec-5c5f832da90d732d1f26b0862a57fe91d2d82ddb.tar.gz |
fruitpie: enable usb mass storage
BRANCH=none
BUG=none
TEST=verify that usb mass storage functions
Change-Id: I141afb2f5797db769319a499ad8884be123d6116
Signed-off-by: Dominic Chen <ddchen@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/206304
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r-- | board/fruitpie/board.c | 28 | ||||
-rw-r--r-- | board/fruitpie/board.h | 28 | ||||
-rw-r--r-- | board/fruitpie/ec.tasklist | 1 |
3 files changed, 57 insertions, 0 deletions
diff --git a/board/fruitpie/board.c b/board/fruitpie/board.c index b431c1513d..800fedea96 100644 --- a/board/fruitpie/board.c +++ b/board/fruitpie/board.c @@ -14,6 +14,7 @@ #include "registers.h" #include "task.h" #include "timer.h" +#include "usb.h" #include "usb_pd.h" #include "util.h" @@ -62,6 +63,14 @@ const struct i2c_port_t i2c_ports[] = { }; const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); +const void * const usb_strings[] = { + [USB_STR_DESC] = usb_string_desc, + [USB_STR_VENDOR] = USB_STRING_DESC("Google Inc."), + [USB_STR_PRODUCT] = USB_STRING_DESC("FruitPie"), + [USB_STR_VERSION] = USB_STRING_DESC("v1.0"), +}; +BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT); + int board_set_debug(int enable) { timestamp_t timeout; @@ -154,6 +163,25 @@ int board_set_debug(int enable) return rv; } +static int command_debug(int argc, char **argv) +{ + char *e; + int v; + + if (argc < 2) + return EC_ERROR_PARAM_COUNT; + + v = strtoi(argv[1], &e, 0); + if (*e) + return EC_ERROR_PARAM1; + + ccprintf("Setting debug: %d...\n", v); + board_set_debug(v); + + return EC_SUCCESS; +} +DECLARE_CONSOLE_COMMAND(debugset, command_debug, NULL, "Set debug mode", NULL); + void board_set_usb_mux(int port, enum typec_mux mux, int polarity) { /* reset everything */ diff --git a/board/fruitpie/board.h b/board/fruitpie/board.h index c9924a9ba4..0129872ae8 100644 --- a/board/fruitpie/board.h +++ b/board/fruitpie/board.h @@ -17,6 +17,9 @@ /* Optional features */ #define CONFIG_STM_HWTIMER32 +#define CONFIG_USB +#define CONFIG_USB_MS +#define CONFIG_USB_MS_BUFFER_SIZE SPI_FLASH_MAX_WRITE_SIZE #define CONFIG_USB_POWER_DELIVERY #define CONFIG_USB_PD_CUSTOM_VDM #define CONFIG_USB_PD_DUAL_ROLE @@ -50,6 +53,11 @@ #define CONFIG_CHARGER_INPUT_CURRENT 512 /* mA */ #define CONFIG_CHARGER_ILIM_PIN_DISABLED /* external ILIM pin disabled */ +/* USB configuration */ +#define CONFIG_USB_PID 0x5009 +/* By default, enable all console messages excepted USB */ +#define CC_DEFAULT (CC_ALL & ~CC_MASK(CC_USB)) + /* * Allow dangerous commands all the time, since we don't have a write protect * switch. @@ -84,6 +92,26 @@ enum adc_channel { ADC_CH_COUNT }; +/* USB string indexes */ +enum usb_strings { + USB_STR_DESC = 0, + USB_STR_VENDOR, + USB_STR_PRODUCT, + USB_STR_VERSION, + + USB_STR_COUNT +}; + #endif /* !__ASSEMBLER__ */ +/* USB interface indexes (use define rather than enum to expand them) */ +#define USB_IFACE_MS 0 +#define USB_IFACE_COUNT 1 + +/* USB endpoint indexes (use define rather than enum to expand them) */ +#define USB_EP_CONTROL 0 +#define USB_EP_MS_TX 1 +#define USB_EP_MS_RX 2 +#define USB_EP_COUNT 3 + #endif /* __BOARD_H */ diff --git a/board/fruitpie/ec.tasklist b/board/fruitpie/ec.tasklist index a8250d57c1..4690fb49cb 100644 --- a/board/fruitpie/ec.tasklist +++ b/board/fruitpie/ec.tasklist @@ -19,4 +19,5 @@ #define CONFIG_TASK_LIST \ TASK_ALWAYS(HOOKS, hook_task, NULL, TASK_STACK_SIZE) \ TASK_ALWAYS(CONSOLE, console_task, NULL, LARGER_TASK_STACK_SIZE) \ + TASK_ALWAYS(USB_MS, ms_task, NULL, TASK_STACK_SIZE) \ TASK_ALWAYS(PD, pd_task, NULL, TASK_STACK_SIZE) |