RE: [PATCH v2] fsl_qe_udc: send ZLP when zero flag and length % maxpacket == 0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




>-----Original Message-----
>From: Valentin Longchamp [mailto:valentin.longchamp@xxxxxxxxxxx]
>Sent: Friday, April 08, 2011 10:42 PM
>To: Li Yang-R58472; dbrownell@xxxxxxxxxxxxxxxxxxxxx; linux-
>usb@xxxxxxxxxxxxxxx
>Cc: holger.brunck@xxxxxxxxxxx; stefan.bigler@xxxxxxxxxxx
>Subject: Re: [PATCH v2] fsl_qe_udc: send ZLP when zero flag and length %
>maxpacket == 0
>
>Sorry to bother, but I have received no new feedback about this patch, nor
>an ACK.
>
>Could someone please give an ACK or precise the status of the patch (I
>would like to know if it will be merged when applicable, and if not why) ?
>
>Best Regards
>
>Valentin
>
>Valentin Longchamp wrote:
>> The driver did not take the zero flag in the USB request. If the
>> request length is the same as the endpoint's maxpacket, an additional
>> ZLP with no data has to be transmitted.
>>
>> The method used here is inspired to what is done in fsl_udc_core.c
>> (and pxa27x_udc.c and at91_udc.c) where this is supported.
>>
>> There already was a discussion about this topic with people from
>> Keymile, and I propose here a better implementation:
>>
>> http://thread.gmane.org/gmane.linux.usb.general/38951
>>
>> Signed-off-by: Valentin Longchamp <valentin.longchamp@xxxxxxxxxxx>

Acked-by: Li Yang <leoli@xxxxxxxxxxxxx>

>> ---
>> Changes for v2:
>>   - collapsed if as suggested by Sergei
>>
>>  drivers/usb/gadget/fsl_qe_udc.c |   20 ++++++++++++++++++--
>>  1 files changed, 18 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/usb/gadget/fsl_qe_udc.c
>> b/drivers/usb/gadget/fsl_qe_udc.c index 0ce8244..5a9cf24 100644
>> --- a/drivers/usb/gadget/fsl_qe_udc.c
>> +++ b/drivers/usb/gadget/fsl_qe_udc.c
>> @@ -1150,6 +1150,12 @@ static int qe_ep_tx(struct qe_ep *ep, struct
>> qe_frame *frame)  static int txcomplete(struct qe_ep *ep, unsigned
>> char restart)  {
>>  	if (ep->tx_req != NULL) {
>> +		struct qe_req *req = ep->tx_req;
>> +		unsigned zlp = 0, last_len = 0;
>> +
>> +		last_len = min_t(unsigned, req->req.length - ep->sent,
>> +				ep->ep.maxpacket);
>> +
>>  		if (!restart) {
>>  			int asent = ep->last;
>>  			ep->sent += asent;
>> @@ -1158,9 +1164,18 @@ static int txcomplete(struct qe_ep *ep, unsigned
>char restart)
>>  			ep->last = 0;
>>  		}
>>
>> +		/* zlp needed when req->re.zero is set */
>> +		if (req->req.zero) {
>> +			if (last_len == 0 ||
>> +				(req->req.length % ep->ep.maxpacket) != 0)
>> +				zlp = 0;
>> +			else
>> +				zlp = 1;
>> +		} else
>> +			zlp = 0;
>> +
>>  		/* a request already were transmitted completely */
>> -		if ((ep->tx_req->req.length - ep->sent) <= 0) {
>> -			ep->tx_req->req.actual = (unsigned int)ep->sent;
>> +		if (((ep->tx_req->req.length - ep->sent) <= 0) && !zlp) {
>>  			done(ep, ep->tx_req, 0);
>>  			ep->tx_req = NULL;
>>  			ep->last = 0;
>> @@ -1193,6 +1208,7 @@ static int qe_usb_senddata(struct qe_ep *ep,
>struct qe_frame *frame)
>>  	buf = (u8 *)ep->tx_req->req.buf + ep->sent;
>>  	if (buf && size) {
>>  		ep->last = size;
>> +		ep->tx_req->req.actual += size;
>>  		frame_set_data(frame, buf);
>>  		frame_set_length(frame, size);
>>  		frame_set_status(frame, FRAME_OK);
>
>
>--
>Valentin Longchamp
>Embedded Software Engineer
>Hardware and Chip Integration
>______________________________________
>KEYMILE AG
>Schwarzenburgstr. 73
>CH-3097 Liebefeld
>Phone +41 31 377 1318
>Fax   +41 31 377 1212
>valentin.longchamp@xxxxxxxxxxx
>www.keymile.com
>______________________________________
>KEYMILE: A Specialist as a Partner


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux