summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2017-09-07 14:56:08 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-10-05 10:36:14 -0700
commit1e72cc1f5719d5c5df6dbe76a8c86f60a525fe1a (patch)
treea0b90021330e7f8495f351d65e69504a1548f7af
parent7dc3066837aaaa565af5df2e1433d7564d43220b (diff)
downloadchrome-ec-1e72cc1f5719d5c5df6dbe76a8c86f60a525fe1a.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: Idc3d2fccef6cbec2af786cef634d752a02a0e859 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/656315 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Nick Sanders <nsanders@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--board/mn50/board.c15
-rw-r--r--board/mn50/board.h3
-rw-r--r--common/build.mk1
-rw-r--r--common/case_closed_debug.c72
-rw-r--r--common/usb_pd_protocol.c26
-rw-r--r--include/case_closed_debug.h8
-rw-r--r--include/config.h4
-rw-r--r--include/console_channel.inc2
8 files changed, 20 insertions, 111 deletions
diff --git a/board/mn50/board.c b/board/mn50/board.c
index bc04a459db..15371075d3 100644
--- a/board/mn50/board.c
+++ b/board/mn50/board.c
@@ -29,6 +29,7 @@
#include "trng.h"
#include "uartn.h"
#include "usb_api.h"
+#include "usb_console.h"
#include "usb_descriptor.h"
#include "usb_hid.h"
#include "usb_spi.h"
@@ -86,7 +87,7 @@ void decrement_retry_counter(void)
}
}
-void ccd_phy_init(int none)
+void ccd_phy_init(void)
{
usb_select_phy(USB_SEL_PHY1);
@@ -107,6 +108,8 @@ int usb_i2c_board_is_enabled(void)
return 1;
}
+USB_SPI_CONFIG(ccd_usb_spi, USB_IFACE_SPI, USB_EP_SPI);
+
/* Initialize board. */
static void board_init(void)
{
@@ -132,7 +135,10 @@ static void board_init(void)
GREG32(PMU, PWRDN_SCRATCH16) = 0xCAFECAFE;
/* Enable USB / CCD */
- ccd_set_mode(CCD_MODE_ENABLED);
+ usb_release();
+ usb_console_enable(1, 0);
+ usb_spi_enable(&ccd_usb_spi, 1);
+ ccd_phy_init();
uartn_enable(UART_AP);
/* Calibrate INA0 (VBUS) with 1mA/LSB scale */
@@ -143,6 +149,11 @@ static void board_init(void)
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
+int ccd_ext_is_enabled(void)
+{
+ return 1;
+}
+
const void * const usb_strings[] = {
[USB_STR_DESC] = usb_string_desc,
[USB_STR_VENDOR] = USB_STRING_DESC("Google Inc."),
diff --git a/board/mn50/board.h b/board/mn50/board.h
index 486d39a53f..5b9c9c43af 100644
--- a/board/mn50/board.h
+++ b/board/mn50/board.h
@@ -81,9 +81,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 1600bcfbea..6ef6c25889 100644
--- a/common/build.mk
+++ b/common/build.mk
@@ -33,7 +33,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_CASE_CLOSED_DEBUG_V1)+=ccd_config.o
common-$(CONFIG_CHARGE_MANAGER)+=charge_manager.o
common-$(CONFIG_CHARGE_RAMP)+=charge_ramp.o
diff --git a/common/case_closed_debug.c b/common/case_closed_debug.c
deleted file mode 100644
index e35ed89fe9..0000000000
--- a/common/case_closed_debug.c
+++ /dev/null
@@ -1,72 +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;
-}
-
-int ccd_ext_is_enabled(void)
-{
- return ccd_get_mode() == CCD_MODE_ENABLED;
-}
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index ffbf9d8956..ac6c081d31 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -257,8 +257,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
@@ -1950,15 +1949,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 */
@@ -1992,7 +1988,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;
@@ -2467,16 +2463,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 */
@@ -2487,9 +2476,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 4cab77165c..b41532bc5e 100644
--- a/include/case_closed_debug.h
+++ b/include/case_closed_debug.h
@@ -35,14 +35,6 @@ 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.
- */
-enum ccd_mode ccd_get_mode(void);
-
/**
* Return non-zero if the CCD external interface is enabled.
*/
diff --git a/include/config.h b/include/config.h
index fbcb69604a..9023a41502 100644
--- a/include/config.h
+++ b/include/config.h
@@ -408,10 +408,6 @@
*/
#undef CONFIG_DEDICATED_RECOVERY_BUTTON
-/*
- * Enable case close debug (CCD) mode in the EC.
- */
-#undef CONFIG_CASE_CLOSED_DEBUG
/* The case close debug (CCD) feature is provided by an external chip. */
#undef CONFIG_CASE_CLOSED_DEBUG_EXTERNAL
/* Support V1 CCD configuration */
diff --git a/include/console_channel.inc b/include/console_channel.inc
index dc72d665fb..31ea119c1f 100644
--- a/include/console_channel.inc
+++ b/include/console_channel.inc
@@ -19,7 +19,7 @@ CONSOLE_CHANNEL(CC_BLUETOOTH_HCI,"bluetooth_hci")
#ifdef CONFIG_EXTENSION_COMMAND
CONSOLE_CHANNEL(CC_EXTENSION, "extension")
#endif
-#if defined(CONFIG_CASE_CLOSED_DEBUG) || defined(CONFIG_PHYSICAL_PRESENCE)
+#if defined(CONFIG_PHYSICAL_PRESENCE)
CONSOLE_CHANNEL(CC_CCD, "ccd")
#endif
CONSOLE_CHANNEL(CC_CHARGER, "charger")