diff options
author | Scott Collyer <scollyer@google.com> | 2020-11-04 16:39:19 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-12-11 16:30:42 +0000 |
commit | d7bf71b42b78fa09da12f764bd3571d0cc446765 (patch) | |
tree | 6aa24fd11dd4f5b909b8a05c46bc2875aef95b65 /baseboard | |
parent | e1058a41ca850c8d1513021390defc5a4e5c4b07 (diff) | |
download | chrome-ec-d7bf71b42b78fa09da12f764bd3571d0cc446765.tar.gz |
honeybuns: Enable usbc support
This CL adds boards specific parts required to enable TCPMv2.0 for
both quiche and gingerbread. TCPMv2 configs are included, though, only
type-c support is being selected.
The reason for this intermediate point is an attempt to have more
manageable amounts of changes for CL reviews.
BUG=b:167601672
BRANCH=None
TEST=verfied type-c attaches properly on quiche
Signed-off-by: Scott Collyer <scollyer@google.com>
Change-Id: I2a4c3bf4089fb3e167d06921b177d8c4e61a021f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2215424
Tested-by: Scott Collyer <scollyer@chromium.org>
Commit-Queue: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Diana Z <dzigterman@chromium.org>
Auto-Submit: Scott Collyer <scollyer@chromium.org>
Diffstat (limited to 'baseboard')
-rw-r--r-- | baseboard/honeybuns/baseboard.h | 50 | ||||
-rw-r--r-- | baseboard/honeybuns/build.mk | 1 | ||||
-rw-r--r-- | baseboard/honeybuns/usb_pd_policy.c | 73 |
3 files changed, 123 insertions, 1 deletions
diff --git a/baseboard/honeybuns/baseboard.h b/baseboard/honeybuns/baseboard.h index 4e2af658c5..a5c64b7402 100644 --- a/baseboard/honeybuns/baseboard.h +++ b/baseboard/honeybuns/baseboard.h @@ -42,6 +42,47 @@ /* USB Type C and USB PD defines */ +#define CONFIG_USB_POWER_DELIVERY +#define CONFIG_USB_PD_TCPMV2 +#define CONFIG_USB_DRP_ACC_TRYSRC +/* No AP on any honeybuns variants */ +#undef CONFIG_USB_PD_HOST_CMD + +/* TODO(b/167711550): Temporarily support type-c mode only */ +#undef CONFIG_USB_PRL_SM +#undef CONFIG_USB_PE_SM + +#define CONFIG_USB_PD_DUAL_ROLE +#define CONFIG_USB_PD_PORT_MAX_COUNT 1 +#define CONFIG_USB_PD_TCPM_MUX +#define CONFIG_USB_PD_TCPM_STM32GX +#define CONFIG_USB_PD_TCPM_TCPCI +#define CONFIG_USB_PD_DECODE_SOP +#define CONFIG_USB_PID 0x5048 + +#define CONFIG_USB_PD_VBUS_DETECT_PPC +#define CONFIG_USB_PD_DISCHARGE_PPC +#define CONFIG_USBC_PPC_SN5S330 +#define CONFIG_USBC_PPC_VCONN +#define CONFIG_USBC_PPC_DEDICATED_INT +#define CONFIG_CMD_PPC_DUMP + +/* TODO(b/167711550): Temporary, will be replaced by correct mux config */ +#define CONFIG_USBC_SS_MUX +#define CONFIG_USB_MUX_VIRTUAL + + +/* Define typical operating power and max power. */ +#define PD_MAX_VOLTAGE_MV 20000 +#define PD_MAX_CURRENT_MA 3000 +#define PD_MAX_POWER_MW 45000 +#define PD_OPERATING_POWER_MW 15000 + +/* TODO(b:147314141): Verify these timings */ +#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */ +#define PD_POWER_SUPPLY_TURN_OFF_DELAY 250000 /* us */ +#define PD_VCONN_SWAP_DELAY 5000 /* us */ + /* BC 1.2 */ @@ -52,7 +93,6 @@ #define I2C_PORT_MST 1 #define I2C_PORT_EEPROM 2 - /* * Macros for GPIO signals used in common code that don't match the * schematic names. Signal names in gpio.inc match the schematic and are @@ -73,6 +113,14 @@ struct power_seq { unsigned int delay_ms; /* delay (in msec) after setting gpio_signal */ }; +/* + * This is required as adc_channel is included in adc.h which ends up being + * included when TCPMv2 functions are included + */ +enum adc_channel { + ADC_CH_COUNT +}; + extern const struct power_seq board_power_seq[]; extern const size_t board_power_seq_count; diff --git a/baseboard/honeybuns/build.mk b/baseboard/honeybuns/build.mk index 2a572df114..ca13fcff46 100644 --- a/baseboard/honeybuns/build.mk +++ b/baseboard/honeybuns/build.mk @@ -7,3 +7,4 @@ # baseboard-y=baseboard.o +baseboard-$(CONFIG_USB_POWER_DELIVERY)+=usb_pd_policy.o diff --git a/baseboard/honeybuns/usb_pd_policy.c b/baseboard/honeybuns/usb_pd_policy.c new file mode 100644 index 0000000000..0bf90995de --- /dev/null +++ b/baseboard/honeybuns/usb_pd_policy.c @@ -0,0 +1,73 @@ +/* Copyright 2020 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. + */ + +#include "common.h" +#include "console.h" +#include "driver/tcpm/tcpci.h" +#include "usb_pd.h" +#include "usbc_ppc.h" + +#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args) +#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args) + +/* + * TODO(b/167711550): These 4 functions need to be implemented for honeybuns + * and are required to build with TCPMv2 enabled. Currently, they only allow the + * build to work. They will be implemented in a subsequent CL. + */ + +int pd_check_vconn_swap(int port) +{ + /*TODO: Dock is the Vconn source */ + return 1; +} + +void pd_power_supply_reset(int port) +{ + int prev_en; + + if (port < 0 || port >= CONFIG_USB_PD_PORT_MAX_COUNT) + return; + + prev_en = ppc_is_sourcing_vbus(port); + + /* Disable VBUS. */ + ppc_vbus_source_enable(port, 0); + + /* Enable discharge if we were previously sourcing 5V */ + if (prev_en) + pd_set_vbus_discharge(port, 1); +} + +int pd_set_power_supply_ready(int port) +{ + int rv; + + /* + * Default operation of buck-boost is 5v/3.6A. + * Turn on the PPC Provide Vbus. + */ + rv = ppc_vbus_source_enable(port, 1); + if (rv) + return rv; + + return EC_SUCCESS; +} + +int pd_snk_is_vbus_provided(int port) +{ + return ppc_is_vbus_present(port); +} + +int board_vbus_source_enabled(int port) +{ + return ppc_is_sourcing_vbus(port); +} + +void pd_set_input_current_limit(int port, uint32_t max_ma, + uint32_t supply_voltage) +{ + +} |