summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott <scollyer@chromium.org>2017-02-28 19:16:22 -0800
committerchrome-bot <chrome-bot@chromium.org>2017-03-01 09:31:28 -0800
commit6b52c9cf58cf4355dfd3b351b547582f280b8b83 (patch)
tree24804be07cfb17b8702c2f87dcba8f0285f0fb92
parent1de54970e674b3b9fbf617b0c204db881c43091e (diff)
downloadchrome-ec-6b52c9cf58cf4355dfd3b351b547582f280b8b83.tar.gz
eve: Modify 1.5 vs 3.0 current limit setting for P1B boards
P1B adds 2 new GPIO signals to explicitly control the 1.5 vs 3.0 current limit selection. In addition, the use case for the 5V enable gpio changes to on/off and no longer needs to be toggled between input and output. This change is tied to the board version so that the operation for P1 and older boards is unaffected. BUG=chrome-os-partner:61431 BRANCH=none TEST=Manual Connected display adapter into C0 port and verified gpio signals: 1 USB_C0_5V_EN 0* USB_C1_5V_EN 1* EN_USB_C0_3A 0 EN_USB_C1_3A Then connect another adapter to C1: 1 USB_C0_5V_EN 1* USB_C1_5V_EN 0* EN_USB_C0_3A 0 EN_USB_C1_3A Remove adapter from C0: 0* USB_C0_5V_EN 1 USB_C1_5V_EN 0 EN_USB_C0_3A 1* EN_USB_C1_3A Also tested P1 system to verify that the correct board version is read and the signals match the expected value. Change-Id: Iebab84304a33282c766b8963dba4a56052a295c7 Signed-off-by: Scott <scollyer@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/447866 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Todd Broch <tbroch@chromium.org>
-rw-r--r--board/eve/board.h1
-rw-r--r--board/eve/gpio.inc11
-rw-r--r--board/eve/usb_pd_policy.c44
3 files changed, 39 insertions, 17 deletions
diff --git a/board/eve/board.h b/board/eve/board.h
index 4e03e92597..d1ea27e0c6 100644
--- a/board/eve/board.h
+++ b/board/eve/board.h
@@ -195,6 +195,7 @@ enum board_version_list {
BOARD_VERSION_P0,
BOARD_VERSION_P0B,
BOARD_VERSION_P1,
+ BOARD_VERSION_P1B,
BOARD_VERSION_EVT,
BOARD_VERSION_DVT,
BOARD_VERSION_PVT,
diff --git a/board/eve/gpio.inc b/board/eve/gpio.inc
index f994ccb856..2c9d556a99 100644
--- a/board/eve/gpio.inc
+++ b/board/eve/gpio.inc
@@ -70,9 +70,14 @@ GPIO(I2C3_SDA, PIN(D, 0), GPIO_INPUT) /* EC_I2C3_POWER_SDA */
GPIO(TRACKPAD_INT_L, PIN(7, 1), GPIO_INPUT) /* INT# from Trackpad */
GPIO(DSP_WAKE_L, PIN(C, 6), GPIO_INPUT | GPIO_SEL_1P8V) /* INT# from DSP Mic */
-/* 5V enables: INPUT=1.5A, OUT_LOW=OFF, OUT_HIGH=3A */
+/*
+ * For P1 and prior: 5V enables: INPUT=1.5A, OUT_LOW=OFF, OUT_HIGH=3A
+ * For P1B and later: 5V enables: OUT_LOW=VBUS Off, OUT_HIGH=VBUS On
+ */
GPIO(USB_C0_5V_EN, PIN(4, 2), GPIO_OUT_LOW | GPIO_PULL_UP) /* C0 5V Enable */
GPIO(USB_C1_5V_EN, PIN(B, 1), GPIO_OUT_LOW | GPIO_PULL_UP) /* C1 5V Enable */
+GPIO(EN_USB_C0_3A, PIN(6, 6), GPIO_OUT_LOW) /* 1.5/3.0 C0 current limit selection */
+GPIO(EN_USB_C1_3A, PIN(3, 5), GPIO_OUT_LOW) /* 1.5/3.0 C1 current limit selection */
GPIO(USB_C0_PD_RST_L, PIN(0, 3), GPIO_OUT_LOW) /* C0 PD Reset */
GPIO(USB_C1_PD_RST_L, PIN(7, 4), GPIO_OUT_LOW) /* C1 PD Reset */
GPIO(USB_C0_DP_HPD, PIN(9, 4), GPIO_INPUT) /* C0 DP Hotplug Detect */
@@ -87,10 +92,6 @@ GPIO(BOARD_VERSION1, PIN(4, 3), GPIO_INPUT) /* Board ID bit0 */
GPIO(BOARD_VERSION2, PIN(4, 4), GPIO_INPUT) /* Board ID bit1 */
GPIO(BOARD_VERSION3, PIN(4, 5), GPIO_INPUT) /* Board ID bit2 */
-/* Test points */
-GPIO(TP249, PIN(6, 6), GPIO_INPUT | GPIO_PULL_UP) /* EC_GPO66_ARM_L */
-GPIO(TP250, PIN(3, 5), GPIO_INPUT | GPIO_PULL_UP) /* EC_GPIO35_TEST_L */
-
/* Alternate functions GPIO definitions */
ALTERNATE(PIN_MASK(6, 0x30), 1, MODULE_UART, 0) /* GPIO64-65 */ /* UART from EC to Servo */
ALTERNATE(PIN_MASK(8, 0x80), 1, MODULE_I2C, 0) /* GPIO87 */ /* EC_I2C1_GYRO_SDA */
diff --git a/board/eve/usb_pd_policy.c b/board/eve/usb_pd_policy.c
index 112fc9d19d..5829aaff76 100644
--- a/board/eve/usb_pd_policy.c
+++ b/board/eve/usb_pd_policy.c
@@ -66,19 +66,39 @@ int board_vbus_source_enabled(int port)
static void board_vbus_update_source_current(int port)
{
- enum gpio_signal gpio = port ? GPIO_USB_C1_5V_EN : GPIO_USB_C0_5V_EN;
- int flags = (vbus_rp[port] == TYPEC_RP_1A5 && vbus_en[port]) ?
- (GPIO_INPUT | GPIO_PULL_UP) : (GPIO_OUTPUT | GPIO_PULL_UP);
+ enum gpio_signal gpio_5v_en = port ? GPIO_USB_C1_5V_EN :
+ GPIO_USB_C0_5V_EN;
+ enum gpio_signal gpio_3a_en = port ? GPIO_EN_USB_C1_3A :
+ GPIO_EN_USB_C0_3A;
+ int flags;
- /*
- * Driving USB_Cx_5V_EN high, actually put a 16.5k resistance
- * (2x 33k in parallel) on the NX5P3290 load switch ILIM pin,
- * setting a minimum OCP current of 3186 mA.
- * Putting an internal pull-up on USB_Cx_5V_EN, effectively put a 33k
- * resistor on ILIM, setting a minimum OCP current of 1505 mA.
- */
- gpio_set_level(gpio, vbus_en[port]);
- gpio_set_flags(gpio, flags);
+ if (system_get_board_version() >= BOARD_VERSION_P1B) {
+ /*
+ * For P1B and beyond, 1.5 vs 3.0 A limit is controlled by a
+ * dedicated gpio where high = 3.0A and low = 1.5A. VBUS on/off
+ * is controlled by GPIO_USB_C0/1_5V_EN. Both of these signals
+ * can remain outputs.
+ */
+ gpio_set_level(gpio_3a_en, vbus_rp[port] == TYPEC_RP_3A0 ?
+ 1 : 0);
+ gpio_set_level(gpio_5v_en, vbus_en[port]);
+ } else {
+ /*
+ * For P1 and earlier board revs, a single gpio signal is
+ * used to both enable VBUS and set the current limit.
+ * Driving USB_Cx_5V_EN high, actually put a 16.5k resistance
+ * (2x 33k in parallel) on the NX5P3290 load switch ILIM pin,
+ * setting a minimum OCP current of 3186 mA.
+ * Putting an internal pull-up on USB_Cx_5V_EN, effectively put
+ * a 33k resistor on ILIM, setting a minimum OCP current of
+ * 1505 mA.
+ */
+ flags = (vbus_rp[port] == TYPEC_RP_1A5 && vbus_en[port]) ?
+ (GPIO_INPUT | GPIO_PULL_UP) :
+ (GPIO_OUTPUT | GPIO_PULL_UP);
+ gpio_set_level(gpio_5v_en, vbus_en[port]);
+ gpio_set_flags(gpio_5v_en, flags);
+ }
}
void typec_set_source_current_limit(int port, int rp)