All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mattijs Korpershoek <mkorpershoek@baylibre.com>
To: Dario Binacchi <dario.binacchi@amarulasolutions.com>,
	u-boot@lists.denx.de
Cc: Dario Binacchi <dario.binacchi@amarulasolutions.com>,
	Michael Trimarchi <michael@amarulasolutions.com>,
	Lukasz Majewski <lukma@denx.de>, Marek Vasut <marex@denx.de>,
	linux-amarula@amarulasolutions.com
Subject: Re: [PATCH v2] usb: gadget: fastboot: detach usb just before rebooting
Date: Thu, 05 Jan 2023 10:06:21 +0100	[thread overview]
Message-ID: <871qo98i5u.fsf@baylibre.com> (raw)
In-Reply-To: <20230104164658.2734718-1-dario.binacchi@amarulasolutions.com>

On Wed, Jan 04, 2023 at 17:46, Dario Binacchi <dario.binacchi@amarulasolutions.com> wrote:

> The patch fixes the following error when updating a BSH SMM S2 board:
> 3:72>Start Cmd:FB[-t 8000]: ucmd nand write ${loadaddr} nanddtb ${filesize}
> 3:72>Okay (0.023s)
> 3:72>Start Cmd:FB: reboot
> 3:72>Fail Bulk(R):LIBUSB_ERROR_IO(0s)
>
> The "fastboot reboot" command detaches the USB when it still needs to be
> used. So let's detach the USB just before the reset.
>
> CC: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> Fixes: 5f7e01e9d5d800 ("usb: gadget: fastboot: detach usb on reboot commands")
> Suggested-by: Michael Trimarchi <michael@amarulasolutions.com>
> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>

Hi Dario,

Thank you for your patch and for reporting the problem.

Unfortunately, applying it seems to break the problem I tried to
solve with 5f7e01e9d5d800 ("usb: gadget: fastboot: detach usb on reboot commands")

Does reverting 5f7e01e9d5d800 also solves your issue?

I'll spend some time on this.

>
> ---
>
> Changes in v2:
> - Add 'Suggested-by' tag.
>
>  drivers/usb/gadget/f_fastboot.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
> index 07b1681c8a9a..0b3fae564d0a 100644
> --- a/drivers/usb/gadget/f_fastboot.c
> +++ b/drivers/usb/gadget/f_fastboot.c
> @@ -419,11 +419,6 @@ static int fastboot_tx_write_str(const char *buffer)
>  	return fastboot_tx_write(buffer, strlen(buffer));
>  }
>  
> -static void compl_do_reset(struct usb_ep *ep, struct usb_request *req)
> -{
> -	do_reset(NULL, 0, 0, NULL);
> -}
> -
>  static unsigned int rx_bytes_expected(struct usb_ep *ep)
>  {
>  	int rx_remain = fastboot_data_remaining();
> @@ -495,6 +490,12 @@ static void do_bootm_on_complete(struct usb_ep *ep, struct usb_request *req)
>  	do_exit_on_complete(ep, req);
>  }
>  
> +static void compl_do_reset(struct usb_ep *ep, struct usb_request *req)
> +{
> +	do_exit_on_complete(ep, req);
> +	do_reset(NULL, 0, 0, NULL);
> +}
> +
>  #if CONFIG_IS_ENABLED(FASTBOOT_UUU_SUPPORT)
>  static void do_acmd_complete(struct usb_ep *ep, struct usb_request *req)
>  {
> @@ -544,7 +545,6 @@ static void rx_handler_command(struct usb_ep *ep, struct usb_request *req)
>  		case FASTBOOT_COMMAND_REBOOT_FASTBOOTD:
>  		case FASTBOOT_COMMAND_REBOOT_RECOVERY:
>  			fastboot_func->in_req->complete = compl_do_reset;
> -			g_dnl_trigger_detach();
>  			break;
>  #if CONFIG_IS_ENABLED(FASTBOOT_UUU_SUPPORT)
>  		case FASTBOOT_COMMAND_ACMD:
> -- 
> 2.32.0

  reply	other threads:[~2023-01-05  9:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-04 16:46 [PATCH v2] usb: gadget: fastboot: detach usb just before rebooting Dario Binacchi
2023-01-05  9:06 ` Mattijs Korpershoek [this message]
2023-01-05  9:10   ` Dario Binacchi
2023-01-05 11:03     ` Mattijs Korpershoek
2023-01-05 13:25       ` Dario Binacchi
2023-01-05 15:29         ` Mattijs Korpershoek
2023-01-06 16:42         ` Mattijs Korpershoek
2023-01-07 16:45           ` Dario Binacchi
2023-01-10  8:29             ` 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=871qo98i5u.fsf@baylibre.com \
    --to=mkorpershoek@baylibre.com \
    --cc=dario.binacchi@amarulasolutions.com \
    --cc=linux-amarula@amarulasolutions.com \
    --cc=lukma@denx.de \
    --cc=marex@denx.de \
    --cc=michael@amarulasolutions.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.