usb: pd: pdphy: Acknowledge Rx sooner

To avoid missing an incoming packet that was quickly sent while
still processing the previous packet, clear the acknowledge bit
as soon as the message is consumed from the Rx FIFO. This gives
the hardware a chance to send a GoodCRC without causing the
sender to retry.

Change-Id: I8a9ef42685576ab68aa65efab1bebc40d801990d
Signed-off-by: Jack Pham <jackp@codeaurora.org>
This commit is contained in:
Jack Pham 2016-11-17 11:51:05 -08:00
parent dd1a207e6e
commit 1526cac8ab

View file

@ -673,6 +673,9 @@ static irqreturn_t pdphy_msg_rx_irq_thread(int irq, void *data)
if (ret)
goto done;
/* ack to change ownership of rx buffer back to PDPHY RX HW */
pdphy_reg_write(pdphy, USB_PDPHY_RX_ACKNOWLEDGE, 0);
if (((buf[0] & 0xf) == PD_MSG_BIST) && size >= 5) { /* BIST */
u8 mode = buf[5] >> 4; /* [31:28] of 1st data object */
@ -689,9 +692,6 @@ static irqreturn_t pdphy_msg_rx_irq_thread(int irq, void *data)
if (pdphy->msg_rx_cb)
pdphy->msg_rx_cb(pdphy->usbpd, frame_type, buf, size + 1);
/* ack to change ownership of rx buffer back to PDPHY RX HW */
pdphy_reg_write(pdphy, USB_PDPHY_RX_ACKNOWLEDGE, 0);
print_hex_dump_debug("rx msg:", DUMP_PREFIX_NONE, 32, 4, buf, size + 1,
false);
pdphy->rx_bytes += size + 1;