tcpm: fusb302: Always take hard reset actions when M_HARDSENT received

After sending a hard reset through Control3 SEND_HARD_RESET, packet Tx
will fail until PD_RESET is triggered. Therefore, always do such a reset
when we see an M_HARDSENT interrupt. Previously, it may have been possible
to skip our reset depending on prior Tx packet status, leaving the TCPC
in a wedged state.

BUG=chrome-os-partner:58232
TEST=Manual on kevin, spam 'pd 0 hard' for 10 hours with zinger attached,
verify TCPC is still responsive and negotiating to 20V.
BRANCH=gru.

Change-Id: I42db792a5f51218c58235dc38c2d49795b54986e
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/393769
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
(cherry picked from commit 811534541c263244d2fe9bdf9465de196e1575da)
Reviewed-on: https://chromium-review.googlesource.com/415486
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
This commit is contained in:
Shawn Nematbakhsh
2016-10-05 12:10:24 -07:00
committed by chrome-bot
parent 18cce61081
commit 6598f08930

View File

@@ -27,7 +27,6 @@ static struct fusb302_chip_state {
int previous_pull;
int togdone_pullup_cc1;
int togdone_pullup_cc2;
int tx_hard_reset_req;
struct mutex set_cc_lock;
uint8_t mdac_vnc;
uint8_t mdac_rd;
@@ -796,8 +795,6 @@ static int fusb302_tcpm_transmit(int port, enum tcpm_transmit_type type,
return fusb302_send_message(port, header, data, buf, buf_pos);
case TCPC_TX_HARD_RESET:
state[port].tx_hard_reset_req = 1;
/* Simply hit the SEND_HARD_RESET bit */
tcpc_read(port, TCPC_REG_CONTROL3, &reg);
reg |= TCPC_REG_CONTROL3_SEND_HARDRESET;
@@ -860,7 +857,6 @@ void fusb302_tcpc_alert(int port)
if (interrupt & TCPC_REG_INTERRUPT_COLLISION) {
/* packet sending collided */
state[port].tx_hard_reset_req = 0;
pd_transmit_complete(port, TCPC_TX_COMPLETE_FAILED);
}
@@ -946,13 +942,10 @@ void fusb302_tcpc_alert(int port)
if (interrupta & TCPC_REG_INTERRUPTA_HARDSENT) {
/* hard reset has been sent */
if (state[port].tx_hard_reset_req) {
state[port].tx_hard_reset_req = 0;
/* bring FUSB302 out of reset */
fusb302_pd_reset(port);
/* bring FUSB302 out of reset */
fusb302_pd_reset(port);
pd_transmit_complete(port, TCPC_TX_COMPLETE_SUCCESS);
}
pd_transmit_complete(port, TCPC_TX_COMPLETE_SUCCESS);
}
if (interrupta & TCPC_REG_INTERRUPTA_HARDRESET) {