summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/servo_v4p1/board.c4
-rw-r--r--board/servo_v4p1/board.h12
-rw-r--r--board/servo_v4p1/chg_control.c4
-rw-r--r--board/servo_v4p1/ioexpanders.c2
-rw-r--r--board/servo_v4p1/pathsel.c2
-rw-r--r--board/servo_v4p1/pathsel.h4
-rw-r--r--board/servo_v4p1/usb_pd_config.h19
7 files changed, 23 insertions, 24 deletions
diff --git a/board/servo_v4p1/board.c b/board/servo_v4p1/board.c
index d6e409ab18..6e83f20a09 100644
--- a/board/servo_v4p1/board.c
+++ b/board/servo_v4p1/board.c
@@ -423,6 +423,10 @@ static void board_init(void)
usleep(MSEC);
init_ioexpanders();
+ CPRINTS("Board ID is %d", board_id_det());
+
+ vbus_dischrg_en(0);
+
init_dacs();
init_pi3usb9201();
diff --git a/board/servo_v4p1/board.h b/board/servo_v4p1/board.h
index 25a63c34bf..8d930fe0d8 100644
--- a/board/servo_v4p1/board.h
+++ b/board/servo_v4p1/board.h
@@ -194,6 +194,7 @@
#define CONFIG_USB_PD_TCPC
#define CONFIG_USB_PD_TCPM_STUB
#undef CONFIG_USB_PD_PULLUP
+/* Default pull-up should not be Rp3a0 due to Cr50 */
#define CONFIG_USB_PD_PULLUP TYPEC_RP_USB
#define CONFIG_USB_PD_VBUS_MEASURE_NOT_PRESENT
#define CONFIG_USB_PD_ALT_MODE
@@ -208,12 +209,13 @@
#define CC_RA(port, cc, sel) (pd_tcpc_cc_ra(port, cc, sel))
/*
- * 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.
+ * These power-supply timing values are now set towards maximum spec limit,
+ * to give the upstream charger the maximum time to respond.
+ *
+ * Currently tuned with the Apple 96W adapter.
*/
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 50000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 50000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY (161*MSEC)
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY (461*MSEC)
/* Define typical operating power and max power */
#define PD_OPERATING_POWER_MW 15000
diff --git a/board/servo_v4p1/chg_control.c b/board/servo_v4p1/chg_control.c
index cddd8efc69..19be03a755 100644
--- a/board/servo_v4p1/chg_control.c
+++ b/board/servo_v4p1/chg_control.c
@@ -8,6 +8,7 @@
#include "ioexpanders.h"
#include "registers.h"
#include "timer.h"
+#include "usb_pd.h"
#define CHG_P5V_POWER 0
#define CHG_VBUS_POWER 1
@@ -20,7 +21,8 @@ void chg_reset(void)
/* Disconnect CHG CC1(Rd) and CC2(Rd) */
chg_attach_cc_rds(0);
- msleep(100);
+ /* Give time for CHG to detach, use tErrorRecovery. */
+ msleep(PD_T_ERROR_RECOVERY);
/* Connect CHG CC1(Rd) and CC2(Rd) to detect charger */
chg_attach_cc_rds(1);
diff --git a/board/servo_v4p1/ioexpanders.c b/board/servo_v4p1/ioexpanders.c
index 6d3bb6c728..b55c8647a9 100644
--- a/board/servo_v4p1/ioexpanders.c
+++ b/board/servo_v4p1/ioexpanders.c
@@ -155,7 +155,7 @@ static void ioexpanders_irq(void)
ccprintf("FAULT: USB3 A1 port load switch\n");
if (!(fault & USB_DUTCHG_FLT_ODL))
- ccprintf("FAULT: Overcurrent on Charger or DUB CC/SBU lines\n");
+ ccprintf("FAULT: Overcurrent on Charger or DUT CC/SBU lines\n");
if (!(fault & PP3300_DP_FAULT_L))
ccprintf("FAULT: Overcurrent on DisplayPort\n");
diff --git a/board/servo_v4p1/pathsel.c b/board/servo_v4p1/pathsel.c
index 40100ce22a..5121d69ac6 100644
--- a/board/servo_v4p1/pathsel.c
+++ b/board/servo_v4p1/pathsel.c
@@ -46,7 +46,7 @@ void usb3_a1_to_host(void)
usb3_a1_mux_sel(0);
}
-void host_to_dut(void)
+void dut_to_host(void)
{
gpio_set_level(GPIO_FASTBOOT_DUTHUB_MUX_SEL, 0);
uservo_fastboot_mux_sel(MUX_SEL_FASTBOOT);
diff --git a/board/servo_v4p1/pathsel.h b/board/servo_v4p1/pathsel.h
index d2f71be024..7365d3adf3 100644
--- a/board/servo_v4p1/pathsel.h
+++ b/board/servo_v4p1/pathsel.h
@@ -32,9 +32,9 @@ void usb3_a0_to_host(void);
void usb3_a1_to_host(void);
/**
- * Routes the HOST to the DUT. Used for fastboot
+ * Routes the DUT to the HOST. Used for fastboot
*/
-void host_to_dut(void);
+void dut_to_host(void);
/**
* Routes the Micro Servo to the Host
diff --git a/board/servo_v4p1/usb_pd_config.h b/board/servo_v4p1/usb_pd_config.h
index 7946ea5a6e..baf2914727 100644
--- a/board/servo_v4p1/usb_pd_config.h
+++ b/board/servo_v4p1/usb_pd_config.h
@@ -15,15 +15,6 @@
#ifndef __CROS_EC_USB_PD_CONFIG_H
#define __CROS_EC_USB_PD_CONFIG_H
-/* NOTES: Servo V4 and glados equivalents:
- * Glados Servo V4
- * C0 CHG
- * C1 DUT
- *
- */
-#define CHG 0
-#define DUT 1
-
/* Timer selection for baseband PD communication */
#define TIM_CLOCK_PD_TX_CHG 16
#define TIM_CLOCK_PD_RX_CHG 1
@@ -80,7 +71,7 @@
#define SPI_REGS(p) ((p) ? STM32_SPI2_REGS : STM32_SPI1_REGS)
static inline void spi_enable_clock(int port)
{
- if (port == 0)
+ if (port == CHG)
STM32_RCC_APB2ENR |= STM32_RCC_PB2_SPI1;
else
STM32_RCC_APB1ENR |= STM32_RCC_PB1_SPI2;
@@ -116,7 +107,7 @@ static inline void spi_enable_clock(int port)
/* the pins used for communication need to be hi-speed */
static inline void pd_set_pins_speed(int port)
{
- if (port == 0) {
+ if (port == CHG) {
/* 40 MHz pin speed on SPI PB3&4,
* (USB_CHG_TX_CLKIN & USB_CHG_CC1_TX_DATA)
*/
@@ -138,7 +129,7 @@ static inline void pd_set_pins_speed(int port)
/* Reset SPI peripheral used for TX */
static inline void pd_tx_spi_reset(int port)
{
- if (port == 0) {
+ if (port == CHG) {
/* Reset SPI1 */
STM32_RCC_APB2RSTR |= BIT(12);
STM32_RCC_APB2RSTR &= ~BIT(12);
@@ -193,7 +184,7 @@ static inline void pd_select_polarity(int port, int polarity)
/* Use window mode so that COMP1 and COMP2 share non-inverting input */
val |= STM32_COMP_CMP1EN | STM32_COMP_CMP2EN | STM32_COMP_WNDWEN;
- if (port == 0) {
+ if (port == CHG) {
/* CHG use the right comparator inverted input for COMP2 */
STM32_COMP_CSR = (val & ~STM32_COMP_CMP2INSEL_MASK) |
(polarity ? STM32_COMP_CMP2INSEL_INM4 /* PA4: C0_CC2 */
@@ -237,7 +228,7 @@ static inline void pd_set_host_mode(int port, int enable)
* present as a SNK device. If port != DUT (port == 1), then nothing to
* do in this function.
*/
- if (!port)
+ if (port != DUT)
return;
if (enable) {