summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2017-09-07 14:56:08 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2018-02-12 19:49:23 +0000
commitf2cf8bdca39e27d35350492688fab9587ca12ae5 (patch)
treee723298500019ca6db7ce6218d589f1b893e72fa
parent596aee9fcdef1bfe46eb1bb9605a175a1a93665f (diff)
downloadchrome-ec-f2cf8bdca39e27d35350492688fab9587ca12ae5.tar.gz
cleanup: pd: Remove CONFIG_CASE_CLOSED_DEBUG
CONFIG_CASE_CLOSED_DEBUG (CCD functionality implemented by EC) is no longer used in conjunction with CONFIG_USB_POWER_DELIVERY, and the common routines are only used by one board. BUG=chromium:737755 BRANCH=None TEST=`make buildall -j` Change-Id: I19a86afc99907502678d01cf1b6c07604803b7a9 Signed-off-by: Duncan Laurie <dlaurie@google.com> Original-Commit-Id: 1e72cc1f5719d5c5df6dbe76a8c86f60a525fe1a Original-Change-Id: Idc3d2fccef6cbec2af786cef634d752a02a0e859 Original-Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/656315 Original-Commit-Ready: Shawn N <shawnn@chromium.org> Original-Tested-by: Shawn N <shawnn@chromium.org> Original-Reviewed-by: Nick Sanders <nsanders@chromium.org> Original-Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/914646
-rw-r--r--board/mn50/board.h3
-rw-r--r--common/build.mk1
-rw-r--r--common/case_closed_debug.c67
-rw-r--r--common/usb_pd_protocol.c26
-rw-r--r--include/case_closed_debug.h10
-rw-r--r--include/config.h5
6 files changed, 13 insertions, 99 deletions
diff --git a/board/mn50/board.h b/board/mn50/board.h
index 2037fd8e5b..b01f64cf64 100644
--- a/board/mn50/board.h
+++ b/board/mn50/board.h
@@ -79,9 +79,6 @@
#define CONFIG_STREAM_USB
#define CONFIG_STREAM_USART1
-/* Enable Case Closed Debugging */
-#define CONFIG_CASE_CLOSED_DEBUG
-
#define CONFIG_USB_PID 0x502a
#define CONFIG_USB_SELF_POWERED
diff --git a/common/build.mk b/common/build.mk
index 4d0f67d090..126cd7a3ef 100644
--- a/common/build.mk
+++ b/common/build.mk
@@ -31,7 +31,6 @@ common-$(CONFIG_BLUETOOTH_LE)+=bluetooth_le.o
common-$(CONFIG_BLUETOOTH_LE_STACK)+=btle_hci_controller.o btle_ll.o
common-$(CONFIG_BUTTON_COUNT)+=button.o
common-$(CONFIG_CAPSENSE)+=capsense.o
-common-$(CONFIG_CASE_CLOSED_DEBUG)+=case_closed_debug.o
common-$(CONFIG_CHARGE_MANAGER)+=charge_manager.o
common-$(CONFIG_CHARGE_RAMP_HW)+=charge_ramp.o
common-$(CONFIG_CHARGE_RAMP_SW)+=charge_ramp.o charge_ramp_sw.o
diff --git a/common/case_closed_debug.c b/common/case_closed_debug.c
deleted file mode 100644
index 94fd164330..0000000000
--- a/common/case_closed_debug.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/* Copyright (c) 2014 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.
- *
- * Case Closed Debug common implementation
- */
-
-#include "case_closed_debug.h"
-
-#include "common.h"
-#include "usb_api.h"
-#include "usb_console.h"
-#include "usb_spi.h"
-
-#if !defined(CONFIG_USB)
-#error "CONFIG_USB must be defined to use Case Closed Debugging"
-#endif
-
-#if !defined(CONFIG_USB_CONSOLE)
-#error "CONFIG_USB_CONSOLE must be defined to use Case Closed Debugging"
-#endif
-
-#if !defined(CONFIG_USB_INHIBIT_INIT)
-#error "CONFIG_USB_INHIBIT_INIT must be defined to use Case Closed Debugging"
-#endif
-
-#if defined(CONFIG_USB_SPI)
-USB_SPI_CONFIG(ccd_usb_spi, USB_IFACE_SPI, USB_EP_SPI);
-#endif
-
-static enum ccd_mode current_mode = CCD_MODE_COUNT;
-
-void ccd_set_mode(enum ccd_mode new_mode)
-{
- if (new_mode == current_mode)
- return;
-
-#ifndef CONFIG_USB_SELECT_PHY
- if (current_mode != CCD_MODE_DISABLED)
-#endif
- usb_release();
-
- current_mode = new_mode;
-
- /*
- * The forwarding of the local console over USB is read-only
- * if we are not in the fully enabled mode.
- */
- usb_console_enable(new_mode != CCD_MODE_DISABLED,
- new_mode != CCD_MODE_ENABLED);
-
-#if defined(CONFIG_USB_SPI)
- usb_spi_enable(&ccd_usb_spi, new_mode == CCD_MODE_ENABLED);
-#endif
-
-#ifdef CONFIG_USB_SELECT_PHY
- ccd_phy_init(new_mode != CCD_MODE_DISABLED);
-#else
- if (new_mode != CCD_MODE_DISABLED)
- usb_init();
-#endif
-}
-
-enum ccd_mode ccd_get_mode(void)
-{
- return current_mode;
-}
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index 793a75b131..54dcbdfb74 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -253,8 +253,7 @@ static inline int pd_is_vbus_present(int port)
static int pd_debug_acc_plugged(int port)
{
-#if defined(CONFIG_CASE_CLOSED_DEBUG) || \
-defined(CONFIG_CASE_CLOSED_DEBUG_EXTERNAL)
+#ifdef CONFIG_CASE_CLOSED_DEBUG_EXTERNAL
return pd[port].task_state == PD_STATE_SRC_ACCESSORY ||
pd[port].task_state == PD_STATE_SNK_ACCESSORY;
#else
@@ -1932,15 +1931,12 @@ void pd_task(void *u)
/* Set the USB muxes and the default USB role */
pd_set_data_role(port, CONFIG_USB_PD_DEBUG_DR);
-#if defined(CONFIG_CASE_CLOSED_DEBUG) || defined(CONFIG_USB_PD_DTS)
+#ifdef CONFIG_USB_PD_DTS
if (new_cc_state == PD_CC_DEBUG_ACC) {
ccd_set_mode(system_is_locked() ?
CCD_MODE_PARTIAL :
CCD_MODE_ENABLED);
- }
-#endif
-#ifdef CONFIG_USB_PD_DTS
- if (new_cc_state == PD_CC_DEBUG_ACC) {
+
/* Enable Vbus */
pd_set_power_supply_ready(port);
/* Captive cable, CC1 always */
@@ -1974,7 +1970,7 @@ void pd_task(void *u)
(cc1 != TYPEC_CC_VOLT_RD ||
cc2 != TYPEC_CC_VOLT_RD))) {
set_state(port, PD_STATE_SRC_DISCONNECTED);
-#if defined(CONFIG_CASE_CLOSED_DEBUG) || defined(CONFIG_USB_PD_DTS)
+#ifdef CONFIG_USB_PD_DTS
ccd_set_mode(CCD_MODE_DISABLED);
#endif
timeout = 10*MSEC;
@@ -2431,16 +2427,9 @@ void pd_task(void *u)
&pd_usb_billboard_deferred_data,
PD_T_AME);
}
-#if defined(CONFIG_CASE_CLOSED_DEBUG) || \
-defined(CONFIG_CASE_CLOSED_DEBUG_EXTERNAL)
- else if (new_cc_state == PD_CC_DEBUG_ACC) {
-#ifdef CONFIG_CASE_CLOSED_DEBUG
- ccd_set_mode(system_is_locked() ?
- CCD_MODE_PARTIAL :
- CCD_MODE_ENABLED);
-#endif
+#ifdef CONFIG_CASE_CLOSED_DEBUG_EXTERNAL
+ else if (new_cc_state == PD_CC_DEBUG_ACC)
set_state(port, PD_STATE_SNK_ACCESSORY);
- }
break;
case PD_STATE_SNK_ACCESSORY:
/* debug accessory state */
@@ -2451,9 +2440,6 @@ defined(CONFIG_CASE_CLOSED_DEBUG_EXTERNAL)
/* If accessory becomes detached */
if (!cc_is_rp(cc1) || !cc_is_rp(cc2)) {
set_state(port, PD_STATE_SNK_DISCONNECTED);
-#ifdef CONFIG_CASE_CLOSED_DEBUG
- ccd_set_mode(CCD_MODE_DISABLED);
-#endif
timeout = 10*MSEC;
}
#endif
diff --git a/include/case_closed_debug.h b/include/case_closed_debug.h
index c1f43dd4d3..b41532bc5e 100644
--- a/include/case_closed_debug.h
+++ b/include/case_closed_debug.h
@@ -35,11 +35,9 @@ enum ccd_mode {
*/
void ccd_set_mode(enum ccd_mode new_mode);
-/* Initialize the PHY based on CCD state */
-void ccd_phy_init(int enable_ccd);
-
-/*
- * Get current CCD mode.
+/**
+ * Return non-zero if the CCD external interface is enabled.
*/
-enum ccd_mode ccd_get_mode(void);
+int ccd_ext_is_enabled(void);
+
#endif /* __CROS_EC_CASE_CLOSED_DEBUG_H */
diff --git a/include/config.h b/include/config.h
index 5d26605db3..6f54a5bd60 100644
--- a/include/config.h
+++ b/include/config.h
@@ -372,9 +372,10 @@
#undef CONFIG_BUTTON_RECOVERY
/*
- * Enable case close debug (CCD) mode in the EC.
+ * Indicates there is a dedicated recovery button.
*/
-#undef CONFIG_CASE_CLOSED_DEBUG
+#undef CONFIG_DEDICATED_RECOVERY_BUTTON
+
/* The case close debug (CCD) feature is provided by an external chip. */
#undef CONFIG_CASE_CLOSED_DEBUG_EXTERNAL