summaryrefslogtreecommitdiff
path: root/board/quiche/board.c
diff options
context:
space:
mode:
authorScott Collyer <scollyer@google.com>2021-02-16 10:18:08 -0800
committerCommit Bot <commit-bot@chromium.org>2021-03-24 04:49:27 +0000
commita6200934f5a9c01d37cffb9fc1e170234f60863e (patch)
treef1891eaffd01da4f3de227fab736bb43dfe95006 /board/quiche/board.c
parent7c931ff4a420dba06ca6528610aecdb963c76634 (diff)
downloadchrome-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/quiche/board.c')
-rw-r--r--board/quiche/board.c63
1 files changed, 61 insertions, 2 deletions
diff --git a/board/quiche/board.c b/board/quiche/board.c
index f569611c55..69ca1e91a0 100644
--- a/board/quiche/board.c
+++ b/board/quiche/board.c
@@ -10,12 +10,14 @@
#include "driver/tcpm/ps8xxx.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"
@@ -77,6 +79,30 @@ 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("Quiche"),
+ [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
+/* USB-C PPC Configuration */
+struct ppc_config_t ppc_chips[] = {
+ [USB_PD_PORT_HOST] = {
+ .i2c_port = I2C_PORT_I2C1,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
+ },
+};
+#endif
+
#ifdef SECTION_IS_RW
/* TCPCs */
const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
@@ -97,7 +123,7 @@ const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
/* USB-C PPC Configuration */
struct ppc_config_t ppc_chips[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_HOST] = {
- .i2c_port = I2C_PORT_USBC,
+ .i2c_port = I2C_PORT_I2C1,
.i2c_addr_flags = SN5S330_ADDR0_FLAGS,
.drv = &sn5s330_drv
},
@@ -142,7 +168,40 @@ void board_overcurrent_event(int port, int is_overcurrented)
static void board_init(void)
{
#ifdef SECTION_IS_RW
- hook_call_deferred(&board_select_drp_mode_data, 50 * MSEC);
+
#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;
+ }
+}