From 1526cac8ab5180e481b33e63e88beae55cb737ff Mon Sep 17 00:00:00 2001 From: Jack Pham Date: Thu, 17 Nov 2016 11:51:05 -0800 Subject: [PATCH] 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 --- drivers/usb/pd/qpnp-pdphy.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/pd/qpnp-pdphy.c b/drivers/usb/pd/qpnp-pdphy.c index 0b9b60c3ca45..933b489de457 100644 --- a/drivers/usb/pd/qpnp-pdphy.c +++ b/drivers/usb/pd/qpnp-pdphy.c @@ -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;