public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Mattijs Korpershoek <mkorpershoek@baylibre.com>
To: Marek Vasut <marex@denx.de>, Lukasz Majewski <lukma@denx.de>,
	Neil Armstrong <narmstrong@baylibre.com>
Cc: Simon Glass <sjg@chromium.org>, u-boot@lists.denx.de
Subject: Re: [PATCH] fastboot: release usb_gadget on reboot commands
Date: Mon, 25 Jul 2022 15:19:22 +0200	[thread overview]
Message-ID: <87czdtjpnp.fsf@baylibre.com> (raw)
In-Reply-To: <5ca58b87-24d2-8b45-2bf3-29d51f413123@denx.de>

On ven., juil. 22, 2022 at 23:48, Marek Vasut <marex@denx.de> wrote:

> On 7/21/22 15:59, Mattijs Korpershoek wrote:
>
> [...]
>
>> diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
>> index 8ba55aab9f8f..a00d1ca571d1 100644
>> --- a/drivers/usb/gadget/f_fastboot.c
>> +++ b/drivers/usb/gadget/f_fastboot.c
>> @@ -420,7 +420,8 @@ static int fastboot_tx_write_str(const char *buffer)
>>   
>>   static void compl_do_reset(struct usb_ep *ep, struct usb_request *req)
>>   {
>> -	do_reset(NULL, 0, 0, NULL);
>> +	g_dnl_trigger_detach();
>> +	g_dnl_trigger_reset_request();

Hi Marek,

Thank you for your review and your suggestions.

>
> Wouldn't it be enough to call usb_gadget_release() before do_reset() 
> here ? Or actually fix up the hardware state in your platform reset 

Calling usb_gadget_release() just before do_reset() is sufficient as well.
However usb_gadget_release(int index) takes a controller index as
argument.
This controller index is retrieved from the "=> fastboot" cmd and I
could not come up with something elegant to retrieve it from
f_fastboot.c.
I can have another look if you think that's a better solution.

> implementation, which would cover all such odd states for every other 
> USB UDC mode of operation, not just fastboot ?

Implementing a platform_reset to reset the usb controller also works.
I discussed this with Neil at [1] and he suggested to send the f_fastboot.c fix
(this one) because it's generic and might fix issues for other boards.

So, should I abandon this version and go with the platform specific fix instead ?

[1] https://gitlab.com/baylibre/amlogic/atv/u-boot/-/commit/94c79b8226875babc20311cac7dac30e79238c9d#note_1020214136


  reply	other threads:[~2022-07-25 13:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-21 13:59 [PATCH] fastboot: release usb_gadget on reboot commands Mattijs Korpershoek
2022-07-22 21:48 ` Marek Vasut
2022-07-25 13:19   ` Mattijs Korpershoek [this message]
2022-07-25 15:30     ` Marek Vasut
2022-07-26  8:25       ` Mattijs Korpershoek
2022-07-26 13:36         ` Marek Vasut
2022-07-26 15:42           ` Mattijs Korpershoek

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=87czdtjpnp.fsf@baylibre.com \
    --to=mkorpershoek@baylibre.com \
    --cc=lukma@denx.de \
    --cc=marex@denx.de \
    --cc=narmstrong@baylibre.com \
    --cc=sjg@chromium.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox