All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pawel Laszczak <pawell@cadence.com>
To: <peter.chen@kernel.org>
Cc: <gregkh@linuxfoundation.org>, <linux-usb@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	Pawel Laszczak <pawell@cadence.com>, <stable@vger.kernel.org>
Subject: [PATCH v2] usb: cdnsp: fix issue with ZLP - added TD_SIZE = 1
Date: Mon, 24 Oct 2022 10:04:35 -0400	[thread overview]
Message-ID: <1666620275-139704-1-git-send-email-pawell@cadence.com> (raw)

Patch modifies the TD_SIZE in TRB before ZLP TRB.
The TD_SIZE in TRB before ZLP TRB must be set to 1 to force
processing ZLP TRB by controller.

cc: <stable@vger.kernel.org>
Fixes: 3d82904559f4 ("usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver")
Signed-off-by: Pawel Laszczak <pawell@cadence.com>

---
Changelog:
v2:
- returned value for last TRB must be 0

 drivers/usb/cdns3/cdnsp-ring.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/cdns3/cdnsp-ring.c b/drivers/usb/cdns3/cdnsp-ring.c
index 04dfcaa08dc4..aa79bce89d8a 100644
--- a/drivers/usb/cdns3/cdnsp-ring.c
+++ b/drivers/usb/cdns3/cdnsp-ring.c
@@ -1769,8 +1769,13 @@ static u32 cdnsp_td_remainder(struct cdnsp_device *pdev,
 
 	/* One TRB with a zero-length data packet. */
 	if (!more_trbs_coming || (transferred == 0 && trb_buff_len == 0) ||
-	    trb_buff_len == td_total_len)
+	    trb_buff_len == td_total_len) {
+		/* Before ZLP driver needs set TD_SIZE=1. */
+		if (more_trbs_coming)
+			return 1;
+
 		return 0;
+	}
 
 	maxp = usb_endpoint_maxp(preq->pep->endpoint.desc);
 	total_packet_count = DIV_ROUND_UP(td_total_len, maxp);
-- 
2.25.1


             reply	other threads:[~2022-10-24 17:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-24 14:04 Pawel Laszczak [this message]
2022-10-27  7:24 ` [PATCH v2] usb: cdnsp: fix issue with ZLP - added TD_SIZE = 1 Peter Chen
2022-10-27  8:46   ` Pawel Laszczak
2022-11-06  9:02     ` Peter Chen
2022-11-07  5:39       ` Pawel Laszczak
2022-11-10  1:02         ` Peter Chen
2022-11-10  5:38           ` Pawel Laszczak
2022-11-11  1:28             ` Peter Chen
2022-11-15  9:31               ` Pawel Laszczak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1666620275-139704-1-git-send-email-pawell@cadence.com \
    --to=pawell@cadence.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=peter.chen@kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.