diff options
author | Sam Hurst <shurst@google.com> | 2020-05-27 20:26:13 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-06-11 02:06:45 +0000 |
commit | 8a834c60790e232db196032eec905f56032c5515 (patch) | |
tree | 5f2709f4b297cea18aa9de6cf8cb31be063cec94 /board/servo_v4p1/board.h | |
parent | b1ea19da4db8d5ba71f0a8ee66a348cd7b076ef1 (diff) | |
download | chrome-ec-8a834c60790e232db196032eec905f56032c5515.tar.gz |
servo_v4p1: Add IO Expander functionality and board setup code
The IO Expander and board setup functionality are available in
RW and RO
BRANCH=none
BUG=b:146793000
TEST=make -j buildall
Signed-off-by: Sam Hurst <shurst@google.com>
Change-Id: Ic740169607bd1f97be5145caef08715050ece1ad
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2219119
Reviewed-by: Wai-Hong Tam <waihong@google.com>
Diffstat (limited to 'board/servo_v4p1/board.h')
-rw-r--r-- | board/servo_v4p1/board.h | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/board/servo_v4p1/board.h b/board/servo_v4p1/board.h index 17d8f6a7cd..8f7b517695 100644 --- a/board/servo_v4p1/board.h +++ b/board/servo_v4p1/board.h @@ -16,6 +16,15 @@ /* 48 MHz SYSCLK clock frequency */ #define CPU_CLOCK 48000000 +/* Servo V4.1 Ports: + * CHG - port 0 + * DUT - port 1 + * ALT - port 2 + */ +#define CHG 0 +#define DUT 1 +#define ALT 2 + /* * Flash layout: we redefine the sections offsets and sizes as we want to * include a pstate region, and will use RO/RW regions of different sizes. @@ -162,7 +171,26 @@ * can't be processed in time and can't support USB PD messaging. */ #undef CONFIG_TASK_PROFILING + +#define CONFIG_USB_PD_PORT_MAX_COUNT 2 + +#ifdef SECTION_IS_RO +/* + * TODO(crosbug.com/p/60792): The delay values are currently just place holders + * and the delay will need to be relative to the circuitry that allows VBUS to + * be supplied to the DUT port from the CHG port. + */ +#define PD_POWER_SUPPLY_TURN_ON_DELAY 50000 /* us */ +#define PD_POWER_SUPPLY_TURN_OFF_DELAY 50000 /* us */ + +/* Define typical operating power and max power */ +#define PD_OPERATING_POWER_MW 15000 +#define PD_MAX_POWER_MW 60000 +#define PD_MAX_CURRENT_MA 3000 +#define PD_MAX_VOLTAGE_MV 20000 +#else #undef CONFIG_USB_POWER_DELIVERY +#endif /* SECTION_IS_RO */ /* * If task profiling is enabled then the rx falling edge detection interrupts @@ -215,10 +243,58 @@ enum adc_channel { }; /** + * Compare cc_voltage to disconnect threshold + * + * This function can be used for boards that support variable Rp settings and + * require a different voltage threshold based on the Rp value attached to a + * given cc line. + * + * @param port USB-C port number + * @param cc_volt voltage measured in mV of the CC line + * @param cc_sel cc1 or cc2 selection + * @return 1 if voltage is >= threshold value for disconnect + */ +int pd_tcpc_cc_nc(int port, int cc_volt, int cc_sel); + +/** + * Compare cc_voltage to Ra threshold + * + * This function can be used for boards that support variable Rp settings and + * require a different voltage threshold based on the Rp value attached to a + * given cc line. + * + * @param port USB-C port number + * @param cc_volt voltage measured in mV of the CC line + * @param cc_sel cc1 or cc2 selection + * @return 1 if voltage is < threshold value for Ra attach + */ +int pd_tcpc_cc_ra(int port, int cc_volt, int cc_sel); + +/** + * Set Rp or Rd resistor for CC lines + * + * This function is used to configure the CC pullup or pulldown resistor to + * the requested value. + * + * @param port USB-C port number + * @param cc_pull 1 for Rp and 0 for Rd + * @param rp_value If cc_pull == 1, the value of Rp to use + * @return 1 if cc_pull == 1 and Rp is invalid, otherwise 0 + */ +int pd_set_rp_rd(int port, int cc_pull, int rp_value); + +/** * Get board HW ID version * * @return HW ID version */ int board_get_version(void); + +/** + * Enable or disable CCD + * + * @param enable Enable CCD if true, otherwise disable + */ +void ccd_enable(int enable); #endif /* !__ASSEMBLER__ */ #endif /* __CROS_EC_BOARD_H */ |