diff options
author | Scott Collyer <scollyer@google.com> | 2021-02-16 10:18:08 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-03-24 04:49:27 +0000 |
commit | a6200934f5a9c01d37cffb9fc1e170234f60863e (patch) | |
tree | f1891eaffd01da4f3de227fab736bb43dfe95006 /board/gingerbread/board.c | |
parent | 7c931ff4a420dba06ca6528610aecdb963c76634 (diff) | |
download | chrome-ec-a6200934f5a9c01d37cffb9fc1e170234f60863e.tar.gz |
honeybuns: Enable USB-EP support
This CL adds configs/structs required for USB-EP support for both
quiche and gingerbread. This CL also adds usbc support code to RO so
that Rd is being presented on both CC lines in RO.
In addition, there is some clean up for I2C port names and the debug
gpio utility function.
BUG=b:172493899
BRANCH=None
TEST=tested on quiche and verified that the USB-EP was enumerated
RST EP0 3220
RST EP0 3220
RST EP0 3220
RST EP0 3220
SETAD ae
[8.069004 Jumping to image RW]
Signed-off-by: Scott Collyer <scollyer@google.com>
Change-Id: I8d65ba55eecc2b82047a8cd433611f639af0c5ed
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2699453
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Sam Hurst <shurst@google.com>
Commit-Queue: Scott Collyer <scollyer@chromium.org>
Diffstat (limited to 'board/gingerbread/board.c')
-rw-r--r-- | board/gingerbread/board.c | 62 |
1 files changed, 61 insertions, 1 deletions
diff --git a/board/gingerbread/board.c b/board/gingerbread/board.c index 4ae2f70e7f..03d70a69d3 100644 --- a/board/gingerbread/board.c +++ b/board/gingerbread/board.c @@ -9,12 +9,14 @@ #include "driver/ppc/sn5s330.h" #include "driver/tcpm/stm32gx.h" #include "driver/tcpm/tcpci.h" +#include "ec_version.h" #include "gpio.h" #include "hooks.h" #include "switch.h" #include "system.h" #include "task.h" #include "uart.h" +#include "usb_descriptor.h" #include "usb_pd.h" #include "usbc_ppc.h" #include "util.h" @@ -79,6 +81,29 @@ const struct power_seq board_power_seq[] = { const size_t board_power_seq_count = ARRAY_SIZE(board_power_seq); +/* + * Define the strings used in our USB descriptors. + */ +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("Gingerbread"), + [USB_STR_SERIALNO] = 0, + [USB_STR_VERSION] = + USB_STRING_DESC(CROS_EC_SECTION ":" CROS_EC_VERSION32), + [USB_STR_UPDATE_NAME] = USB_STRING_DESC("Firmware update"), +}; +BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT); + +#ifndef SECTION_IS_RW +struct ppc_config_t ppc_chips[] = { + [USB_PD_PORT_HOST] = { + .i2c_port = I2C_PORT_I2C3, + .i2c_addr_flags = SN5S330_ADDR0_FLAGS, + }, +}; +#endif + #ifdef SECTION_IS_RW const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { { @@ -130,6 +155,41 @@ void board_overcurrent_event(int port, int is_overcurrented) static void board_init(void) { - /* TODO */ +#ifdef SECTION_IS_RW + +#endif } DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); + +static void board_debug_gpio_1_pulse(void) +{ + gpio_set_level(GPIO_TRIGGER_1, 0); +} +DECLARE_DEFERRED(board_debug_gpio_1_pulse); + +static void board_debug_gpio_2_pulse(void) +{ + gpio_set_level(GPIO_TRIGGER_2, 0); +} +DECLARE_DEFERRED(board_debug_gpio_2_pulse); + +void board_debug_gpio(int trigger, int enable, int pulse_usec) +{ + switch (trigger) { + case TRIGGER_1: + gpio_set_level(GPIO_TRIGGER_1, enable); + if (pulse_usec) + hook_call_deferred(&board_debug_gpio_1_pulse_data, + pulse_usec); + break; + case TRIGGER_2: + gpio_set_level(GPIO_TRIGGER_2, enable); + if (pulse_usec) + hook_call_deferred(&board_debug_gpio_2_pulse_data, + pulse_usec); + break; + default: + CPRINTS("bad debug gpio selection"); + break; + } +} |