mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-28 02:35:28 +00:00
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>
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user