summaryrefslogtreecommitdiff
path: root/driver/tcpm/stub.c
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2021-11-04 12:11:58 -0600
committerCommit Bot <commit-bot@chromium.org>2021-11-05 04:22:34 +0000
commit252457d4b21f46889eebad61d4c0a65331919cec (patch)
tree01856c4d31d710b20e85a74c8d7b5836e35c3b98 /driver/tcpm/stub.c
parent08f5a1e6fc2c9467230444ac9b582dcf4d9f0068 (diff)
downloadchrome-ec-stabilize-quickfix-14526.91.B-ish.tar.gz
In the interest of making long-term branch maintenance incur as little technical debt on us as possible, we should not maintain any files on the branch we are not actually using. This has the added effect of making it extremely clear when merging CLs from the main branch when changes have the possibility to affect us. The follow-on CL adds a convenience script to actually pull updates from the main branch and generate a CL for the update. BUG=b:204206272 BRANCH=ish TEST=make BOARD=arcada_ish && make BOARD=drallion_ish Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I17e4694c38219b5a0823e0a3e55a28d1348f4b18 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3262038 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Diffstat (limited to 'driver/tcpm/stub.c')
-rw-r--r--driver/tcpm/stub.c159
1 files changed, 0 insertions, 159 deletions
diff --git a/driver/tcpm/stub.c b/driver/tcpm/stub.c
deleted file mode 100644
index 863a88c044..0000000000
--- a/driver/tcpm/stub.c
+++ /dev/null
@@ -1,159 +0,0 @@
-/* Copyright 2015 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.
- */
-
-/* TCPM for MCU also running TCPC */
-
-#include "task.h"
-#include "tcpm/tcpci.h"
-#include "tcpm/tcpm.h"
-#include "usb_pd.h"
-#include "usb_pd_tcpc.h"
-#include "usb_pd_tcpm.h"
-
-static int init_alert_mask(int port)
-{
- uint16_t mask;
- int rv;
-
- /*
- * Create mask of alert events that will cause the TCPC to
- * signal the TCPM via the Alert# gpio line.
- */
- mask = TCPC_REG_ALERT_TX_SUCCESS | TCPC_REG_ALERT_TX_FAILED |
- TCPC_REG_ALERT_TX_DISCARDED | TCPC_REG_ALERT_RX_STATUS |
- TCPC_REG_ALERT_RX_HARD_RST | TCPC_REG_ALERT_CC_STATUS;
- /* Set the alert mask in TCPC */
- rv = tcpc_alert_mask_set(port, mask);
-
- return rv;
-}
-
-static int init_power_status_mask(int port)
-{
- return tcpc_set_power_status_mask(port, 0);
-}
-
-int tcpm_init(int port)
-{
- int rv;
-
- tcpc_init(port);
- rv = init_alert_mask(port);
- if (rv)
- return rv;
-
- return init_power_status_mask(port);
-}
-
-int tcpm_get_cc(int port, enum tcpc_cc_voltage_status *cc1,
- enum tcpc_cc_voltage_status *cc2)
-{
- return tcpc_get_cc(port, cc1, cc2);
-}
-
-int tcpm_select_rp_value(int port, int rp)
-{
- return tcpc_select_rp_value(port, rp);
-}
-
-int tcpm_set_cc(int port, int pull)
-{
- return tcpc_set_cc(port, pull);
-}
-
-int tcpm_set_polarity(int port, enum tcpc_cc_polarity polarity)
-{
- return tcpc_set_polarity(port, polarity_rm_dts(polarity));
-}
-
-int tcpm_set_vconn(int port, int enable)
-{
- return tcpc_set_vconn(port, enable);
-}
-
-int tcpm_set_msg_header(int port, int power_role, int data_role)
-{
- return tcpc_set_msg_header(port, power_role, data_role);
-}
-
-static int tcpm_alert_status(int port, int *alert)
-{
- /* Read TCPC Alert register */
- return tcpc_alert_status(port, alert);
-}
-
-int tcpm_set_rx_enable(int port, int enable)
-{
- return tcpc_set_rx_enable(port, enable);
-}
-
-void tcpm_enable_auto_discharge_disconnect(int port, int enable)
-{
-}
-
-int tcpm_has_pending_message(int port)
-{
- return !rx_buf_is_empty(port);
-}
-
-int tcpm_dequeue_message(int port, uint32_t *payload, int *head)
-{
- int ret = tcpc_get_message(port, payload, head);
-
- /* Read complete, clear RX status alert bit */
- tcpc_alert_status_clear(port, TCPC_REG_ALERT_RX_STATUS);
-
- return ret;
-}
-
-void tcpm_clear_pending_messages(int port)
-{
- rx_buf_clear(port);
-}
-
-int tcpm_transmit(int port, enum tcpci_msg_type type, uint16_t header,
- const uint32_t *data)
-{
- return tcpc_transmit(port, type, header, data);
-}
-
-void tcpc_alert(int port)
-{
- int status;
-
- /* Read the Alert register from the TCPC */
- tcpm_alert_status(port, &status);
-
- /*
- * Clear alert status for everything except RX_STATUS, which shouldn't
- * be cleared until we have successfully retrieved message.
- */
- if (status & ~TCPC_REG_ALERT_RX_STATUS)
- tcpc_alert_status_clear(port,
- status & ~TCPC_REG_ALERT_RX_STATUS);
-
- if (status & TCPC_REG_ALERT_CC_STATUS) {
- /* CC status changed, wake task */
- task_set_event(PD_PORT_TO_TASK_ID(port), PD_EVENT_CC);
- }
- if (status & TCPC_REG_ALERT_RX_STATUS) {
- /*
- * message received. since TCPC is compiled in, we
- * already woke the PD task up from the phy layer via
- * pd_rx_event(), so we don't need to wake it again.
- */
- }
- if (status & TCPC_REG_ALERT_RX_HARD_RST) {
- /* hard reset received */
- task_set_event(PD_PORT_TO_TASK_ID(port),
- PD_EVENT_RX_HARD_RESET);
- }
- if (status & TCPC_REG_ALERT_TX_COMPLETE) {
- /* transmit complete */
- pd_transmit_complete(port, status & TCPC_REG_ALERT_TX_SUCCESS ?
- TCPC_TX_COMPLETE_SUCCESS :
- TCPC_TX_COMPLETE_FAILED);
- }
-}