All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukasz Majewski <l.majewski@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] usb: gadget: fastboot: Dequeue the previous IN request for the current request
Date: Mon, 06 Jul 2015 12:35:43 +0200	[thread overview]
Message-ID: <20150706123543.76592bd4@amdc2363> (raw)
In-Reply-To: <1436021176-15701-2-git-send-email-contact@paulk.fr>

Hi Paul,

> Recent versions of the fastboot tool will query the partition type
> before doing an operation on a partition (such as erase, flash, etc).
> It will then submit the operation as soon as the response for the
> partition type is received.
> 
> Usually, the MUSB controller will see that the partition type request
> return status was read by the host at the very same time as the
> actual operation request is submitted by the host. However, the
> operation will be read first (int_rx is handled first in
> musb_interrupt) and after it is completed, the fastboot USB gadget
> driver will send another return status. Hence, this happens before
> the musb gadget framework has had a chance to handle the previous
> acknowledgement that the host read the return status and dequeue the
> request.
> 
> The host will then usually empty the FIFO by the time musb_interrupt
> gets around handling the return status acknowledgement (for the
> previous request, this is still on the same musb_interrupt call), so
> no other interrupt is generated and the most recent return status
> acknowledgement remains unaccounted for.
> 
> It will then be used as a response for the next command, and the
> proper response for it will be delayed to the next command, and so on.
> 
> Dequeuing the previous IN request in the fastboot code ensures that
> no previous return status remains. It is acceptable to do it since
> there is no callback to it anyways.
> 
> Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
> ---
>  drivers/usb/gadget/f_fastboot.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/usb/gadget/f_fastboot.c
> b/drivers/usb/gadget/f_fastboot.c index b9a9099..60c846d 100644
> --- a/drivers/usb/gadget/f_fastboot.c
> +++ b/drivers/usb/gadget/f_fastboot.c
> @@ -311,6 +311,9 @@ static int fastboot_tx_write(const char *buffer,
> unsigned int buffer_size) 
>  	memcpy(in_req->buf, buffer, buffer_size);
>  	in_req->length = buffer_size;
> +
> +	usb_ep_dequeue(fastboot_func->in_ep, in_req);
> +
>  	ret = usb_ep_queue(fastboot_func->in_ep, in_req, 0);
>  	if (ret)
>  		printf("Error %d on queue\n", ret);

Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>

Comment the same as for [PATCH 1/2]

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

  reply	other threads:[~2015-07-06 10:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-04 14:46 [U-Boot] [PATCH 1/2] usb: gadget: fastboot: Request status and length check in rx handler Paul Kocialkowski
2015-07-04 14:46 ` [U-Boot] [PATCH 2/2] usb: gadget: fastboot: Dequeue the previous IN request for the current request Paul Kocialkowski
2015-07-06 10:35   ` Lukasz Majewski [this message]
2019-03-18  9:56   ` [U-Boot] Subject Eugeniu Rosca
2019-03-18 10:12     ` Paul Kocialkowski
2019-03-18 17:15       ` Eugeniu Rosca
2019-03-18 17:20         ` [U-Boot] [U-Boot, 2/2] usb: gadget: fastboot: Dequeue the previous IN request for the current request Eugeniu Rosca
2019-03-18 12:32     ` [U-Boot] Subject Marek Vasut
2015-07-06 10:28 ` [U-Boot] [PATCH 1/2] usb: gadget: fastboot: Request status and length check in rx handler Lukasz Majewski
2015-07-06 12:08   ` Paul Kocialkowski
2015-07-06 13:03   ` Paul Kocialkowski
2015-07-14 10:22 ` Lukasz Majewski
2015-07-14 10:27   ` Paul Kocialkowski
2015-07-14 11:32     ` Lukasz Majewski
2015-07-15 13:53       ` Paul Kocialkowski
2015-07-20  9:57 ` Lukasz Majewski

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=20150706123543.76592bd4@amdc2363 \
    --to=l.majewski@samsung.com \
    --cc=u-boot@lists.denx.de \
    /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.