summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin K Wong <kevin.k.wong@intel.com>2016-08-02 15:42:18 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-08-03 19:41:11 -0700
commita35f3f5fa2b7e88eb094632bcdd3a57d48a62d2c (patch)
tree6e01427e16308a557b3821889e6df58b3102fb74
parentd93cbcff8df27a0b0a490e3caf24d87cc289c55b (diff)
downloadchrome-ec-a35f3f5fa2b7e88eb094632bcdd3a57d48a62d2c.tar.gz
reef: add pull-up for TCPC1 INT# when daughter board is not connected.
when the daughter board is not connected, TCPC1 INT# (USB_C1_PD_INT_ODL) will be floating since the external pull-up is located on the daughter board as well, and this floating signal will cause an interrupt storm and eventually cause a watchdog. BUG=chrome-os-partner:55488 BRANCH=none TEST=verify board no longer has watchdog reset when daughter baord is not connected. Change-Id: If1d73fa7d90f6ac52fd1ab0ac563a6bf5fd10dc0 Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com> Reviewed-on: https://chromium-review.googlesource.com/365499 Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: David Hendricks <dhendrix@chromium.org>
-rw-r--r--board/reef/board.c30
-rw-r--r--board/reef/board.h13
-rw-r--r--driver/tcpm/ps8751.h5
3 files changed, 34 insertions, 14 deletions
diff --git a/board/reef/board.c b/board/reef/board.c
index eab9828a94..1a9dc5e7bc 100644
--- a/board/reef/board.c
+++ b/board/reef/board.c
@@ -22,6 +22,7 @@
#include "driver/tcpm/anx74xx.h"
#include "driver/tcpm/ps8751.h"
#include "driver/tcpm/tcpci.h"
+#include "driver/tcpm/tcpm.h"
#include "extpower.h"
#include "gpio.h"
#include "hooks.h"
@@ -241,6 +242,22 @@ void board_tcpc_init(void)
if (!system_jumped_to_this_image())
board_reset_pd_mcu();
+ /*
+ * If daughter board is not connected,
+ * then enable Pull-Up for TCPC1 int# pin.
+ */
+ if (board_get_version() <= BOARD_VERSION_2) {
+ int rv, vendor_id = 0, product_id = 0;
+
+ rv = tcpc_read16(1, TCPC_REG_VENDOR_ID, &vendor_id);
+ rv |= tcpc_read16(1, TCPC_REG_PRODUCT_ID, &product_id);
+
+ if (rv || ((vendor_id != PS8751_VENDOR_ID) &&
+ (product_id != PS8751_PRODUCT_ID)))
+ gpio_set_flags(GPIO_USB_C1_PD_INT_ODL,
+ GPIO_INT_FALLING | GPIO_PULL_UP);
+ }
+
/* Enable TCPC0 interrupt */
gpio_enable_interrupt(GPIO_USB_C0_PD_INT_ODL);
@@ -810,19 +827,6 @@ void board_hibernate(void)
* turn off whatever can be turned off. */
}
-enum reef_board_version {
- BOARD_VERSION_UNKNOWN = -1,
- BOARD_VERSION_1,
- BOARD_VERSION_2,
- BOARD_VERSION_3,
- BOARD_VERSION_4,
- BOARD_VERSION_5,
- BOARD_VERSION_6,
- BOARD_VERSION_7,
- BOARD_VERSION_8,
- BOARD_VERSION_COUNT,
-};
-
struct {
enum reef_board_version version;
int thresh_mv;
diff --git a/board/reef/board.h b/board/reef/board.h
index 40f9416335..19b5db254d 100644
--- a/board/reef/board.h
+++ b/board/reef/board.h
@@ -209,6 +209,19 @@ enum sensor_id {
LID_ACCEL,
};
+enum reef_board_version {
+ BOARD_VERSION_UNKNOWN = -1,
+ BOARD_VERSION_1,
+ BOARD_VERSION_2,
+ BOARD_VERSION_3,
+ BOARD_VERSION_4,
+ BOARD_VERSION_5,
+ BOARD_VERSION_6,
+ BOARD_VERSION_7,
+ BOARD_VERSION_8,
+ BOARD_VERSION_COUNT,
+};
+
/* start as a sink in case we have no other power supply/battery */
#define PD_DEFAULT_STATE PD_STATE_SNK_DISCONNECTED
diff --git a/driver/tcpm/ps8751.h b/driver/tcpm/ps8751.h
index 765cc5c4f3..859981cc27 100644
--- a/driver/tcpm/ps8751.h
+++ b/driver/tcpm/ps8751.h
@@ -1,6 +1,6 @@
/* Copyright 2016 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..
+ * found in the LICENSE file.
*/
/* Parade Tech Type-C controller vendor specific APIs*/
@@ -9,6 +9,9 @@
#define __CROS_EC_USB_PD_TCPM_PS8751_H
/* Vendor defined registers */
+#define PS8751_VENDOR_ID 0x1DA0
+#define PS8751_PRODUCT_ID 0x8751
+
#define PS8751_REG_CTRL_1 0xD0
#define PS8751_REG_CTRL_1_HPD (1 << 0)
#define PS8751_REG_CTRL_1_IRQ (1 << 1)