diff options
-rw-r--r-- | board/cr50/board.h | 1 | ||||
-rw-r--r-- | board/cr50/rdd.c | 14 | ||||
-rw-r--r-- | board/cr50/usb_i2c.c | 2 | ||||
-rw-r--r-- | chip/g/idle.c | 3 | ||||
-rw-r--r-- | chip/g/usb.c | 3 | ||||
-rw-r--r-- | common/case_closed_debug.c | 5 | ||||
-rw-r--r-- | include/case_closed_debug.h | 5 |
7 files changed, 19 insertions, 14 deletions
diff --git a/board/cr50/board.h b/board/cr50/board.h index b900768115..ad0dae24bb 100644 --- a/board/cr50/board.h +++ b/board/cr50/board.h @@ -277,7 +277,6 @@ void print_servo_state(void); int ap_is_on(void); int ec_is_on(void); -int rdd_is_connected(void); int servo_is_connected(void); void set_ap_on_deferred(void); diff --git a/board/cr50/rdd.c b/board/cr50/rdd.c index 5e260aa587..85b27ad0eb 100644 --- a/board/cr50/rdd.c +++ b/board/cr50/rdd.c @@ -18,11 +18,6 @@ #define CPRINTS(format, args...) cprints(CC_USB, format, ## args) -int rdd_is_connected(void) -{ - return ccd_get_mode() == CCD_MODE_ENABLED; -} - /* If the UART TX is connected the pinmux select will have a non-zero value */ int uart_tx_is_connected(int uart) { @@ -57,7 +52,7 @@ void uartn_tx_connect(int uart) * something to transmit) and servo is disconnected (we won't be * drive-fighting with servo). */ - if (servo_is_connected() || !rdd_is_connected()) + if (servo_is_connected() || !ccd_ext_is_enabled()) return; if (uart == UART_AP) { @@ -88,7 +83,7 @@ void uartn_tx_disconnect(int uart) static void configure_ccd(int enable) { if (enable) { - if (rdd_is_connected()) + if (ccd_ext_is_enabled()) return; /* Enable CCD */ @@ -119,7 +114,7 @@ static void rdd_check_pin(void) /* The CCD mode pin is active low. */ int enable = !gpio_get_level(GPIO_CCD_MODE_L); - if (enable == rdd_is_connected()) + if (enable == ccd_ext_is_enabled()) return; configure_ccd(enable); @@ -177,7 +172,8 @@ static int command_ccd(int argc, char **argv) print_rdd_state(); print_servo_state(); - ccprintf("CCD: %s\n", rdd_is_connected() ? "enabled" : "disabled"); + ccprintf("CCD EXT: %s\n", + ccd_ext_is_enabled() ? "enabled" : "disabled"); ccprintf("AP UART: %s\n", uartn_is_enabled(UART_AP) ? uart_tx_is_connected(UART_AP) ? "RX+TX" : "RX" : "disabled"); diff --git a/board/cr50/usb_i2c.c b/board/cr50/usb_i2c.c index 4c5750de49..66d5aaa632 100644 --- a/board/cr50/usb_i2c.c +++ b/board/cr50/usb_i2c.c @@ -78,7 +78,7 @@ int usb_i2c_board_enable(void) return EC_ERROR_BUSY; } - if (!rdd_is_connected()) + if (!ccd_ext_is_enabled()) return EC_ERROR_BUSY; if (!ccd_is_cap_enabled(CCD_CAP_I2C)) diff --git a/chip/g/idle.c b/chip/g/idle.c index ea994e8dec..78e4e9a1ff 100644 --- a/chip/g/idle.c +++ b/chip/g/idle.c @@ -3,6 +3,7 @@ * found in the LICENSE file. */ +#include "case_closed_debug.h" #include "clock.h" #include "common.h" #include "console.h" @@ -75,7 +76,7 @@ static int utmi_wakeup_is_enabled(void) * USB is only used for CCD, so only enable UTMI wakeups when RDD * detects that a debug accessory is attached. */ - return rdd_is_connected(); + return ccd_ext_is_enabled(); #else /* USB is used for the host interface, so always enable UTMI wakeups */ return 1; diff --git a/chip/g/usb.c b/chip/g/usb.c index 6adb193128..5b3b50dbab 100644 --- a/chip/g/usb.c +++ b/chip/g/usb.c @@ -609,8 +609,7 @@ static int handle_setup_with_in_stage(enum table_case tc, if (idx >= USB_STR_COUNT) return -1; #ifdef CONFIG_USB_SERIALNO - if (idx == USB_STR_SERIALNO && - ccd_get_mode() == CCD_MODE_ENABLED) + if (idx == USB_STR_SERIALNO && ccd_ext_is_enabled()) data = usb_serialno_desc; else #endif diff --git a/common/case_closed_debug.c b/common/case_closed_debug.c index 94fd164330..e35ed89fe9 100644 --- a/common/case_closed_debug.c +++ b/common/case_closed_debug.c @@ -65,3 +65,8 @@ 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/include/case_closed_debug.h b/include/case_closed_debug.h index 456bafa58d..35322c5cf7 100644 --- a/include/case_closed_debug.h +++ b/include/case_closed_debug.h @@ -43,6 +43,11 @@ void ccd_phy_init(int enable_ccd); */ enum ccd_mode ccd_get_mode(void); +/** + * Return non-zero if the CCD external interface is enabled. + */ +int ccd_ext_is_enabled(void); + /******************************************************************************/ /* New CCD "V1" configuration. Eventually this will supersede the above code */ |