From 8d8f2401a20e1bc59aa9a05b41246d618d534399 Mon Sep 17 00:00:00 2001 From: Dino Li Date: Tue, 16 Aug 2016 18:17:30 +0800 Subject: TCPM: it83xx: support Rp 1.5/3.0A pullup configuration Signed-off-by: Dino Li BRANCH=none BUG=chrome-os-partner:54452 TEST=1. To check appropriate register setting. 2. Measure the CC voltage by connecting USB-C to DP cable to EVB. Default : 433mV CONFIG_USB_PD_PULLUP_1_5A: 951mV CONFIG_USB_PD_PULLUP_3A : 1.72V Change-Id: Id5a36ded94121db4343c48ecea19a5a533244f43 Reviewed-on: https://chromium-review.googlesource.com/371020 Commit-Ready: Dino Li Tested-by: Dino Li Reviewed-by: Vincent Palatin --- driver/tcpm/it83xx.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/driver/tcpm/it83xx.c b/driver/tcpm/it83xx.c index 1be2367458..f7bdf5b60b 100644 --- a/driver/tcpm/it83xx.c +++ b/driver/tcpm/it83xx.c @@ -273,8 +273,24 @@ static void it83xx_init(enum usbpd_port port, int role) IT83XX_USBPD_PDMSR(port) = USBPD_REG_MASK_SOP_ENABLE; /* W/C status */ IT83XX_USBPD_ISR(port) = 0xff; - /* enable cc, select cc1 and Rd (80uA output when Rp selected) */ + /* enable cc, select cc1 and Rd. */ + /* + * bit[3-2]: CC output current (when Rp selected) + * 00: reserved + * 01: 330uA outpt (3.0A) + * 10: 180uA outpt (1.5A) + * 11: 80uA outpt (USB default) + */ +#ifdef CONFIG_USB_PD_PULLUP_1_5A + /* (Rp 1.5A when selected) */ + IT83XX_USBPD_CCGCR(port) = 0x9; +#elif defined(CONFIG_USB_PD_PULLUP_3A) + /* (Rp 3.0A when selected) */ + IT83XX_USBPD_CCGCR(port) = 0x5; +#else + /* (Rp default when selected) */ IT83XX_USBPD_CCGCR(port) = 0xd; +#endif /* change data role as the same power role */ it83xx_set_data_role(port, role); /* set power role */ @@ -311,12 +327,6 @@ static void it83xx_select_polarity(enum usbpd_port port, static void it83xx_set_cc(enum usbpd_port port, int pull) { - /* - * TODO(crosbug.com/p/54452): Add configuration of Rp strength - * values for presenting desired current to port partner. - * This value will depend on config flags - * CONFIG_USB_PD_PULLUP_* in the board file - */ if (pull == TYPEC_CC_RD) it83xx_set_power_role(port, PD_ROLE_SINK); else if (pull == TYPEC_CC_RP) -- cgit v1.2.1