From f4fdb8d83f08921d557c1ef36778deb344c381ac Mon Sep 17 00:00:00 2001 From: Frank Wang Date: Tue, 9 Apr 2024 11:09:37 +0800 Subject: [PATCH] usb: typec: tcpci: husb311: fix tx failure Since the hardware bug of HUSB311, its TX fifo become abnormal when plug in a PD charger after plug out the cable from the PC. As a workaround, we do ResetTransmitBuffer after each TX packet is finished to prepare for the next. Signed-off-by: Frank Wang Change-Id: Ieebd090879a45ee2b5a1720e3debf860712e162c --- drivers/usb/typec/tcpm/tcpci_husb311.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/usb/typec/tcpm/tcpci_husb311.c b/drivers/usb/typec/tcpm/tcpci_husb311.c index 175d5f3e2a1d..6eaba84a5b69 100644 --- a/drivers/usb/typec/tcpm/tcpci_husb311.c +++ b/drivers/usb/typec/tcpm/tcpci_husb311.c @@ -207,6 +207,10 @@ static irqreturn_t husb311_irq(int irq, void *dev_id) } } + /* TCPCI Spec. Table 4-27 ResetTransmitBuffer */ + if (status & (TCPC_ALERT_TX_SUCCESS | TCPC_ALERT_TX_DISCARDED | TCPC_ALERT_TX_FAILED)) + husb311_write8(chip, TCPC_COMMAND, 0xdd); + return tcpci_irq(chip->tcpci); }