Synopsys USB3 Controller (DWC3) has a restriction where size
of OUT requests (TRB) queued to the controller must be aligned
with the endpoint's max packet size. Generally, accessory userspace
module submits RX requests not aligned to endpoint's max packet
size. Hence to overcome this, align the size of RX request buffer to
endpoint's max packet while submitting to DCD as the buffers are
already allocated with the size of 16KB.
Change-Id: I3acdfc055d0c6a79a0aa65a715bae06dc475d078
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
{
struct acc_dev *dev = fp->private_data;
struct usb_request *req;
- ssize_t r = count;
- unsigned xfer;
+ ssize_t r = count, xfer, len;
int ret = 0;
pr_debug("acc_read(%zu)\n", count);
if (count > BULK_BUFFER_SIZE)
count = BULK_BUFFER_SIZE;
+ len = ALIGN(count, dev->ep_out->maxpacket);
+
/* we will block until we're online */
pr_debug("acc_read: waiting for online\n");
ret = wait_event_interruptible(dev->read_wq, dev->online);
requeue_req:
/* queue a request */
req = dev->rx_req[0];
- req->length = count;
+ req->length = len;
dev->rx_done = 0;
ret = usb_ep_queue(dev->ep_out, req, GFP_KERNEL);
if (ret < 0) {