| Message ID | 20230104161643.2730063-1-dario.binacchi@amarulasolutions.com |
|---|---|
| State | New |
| Headers |
Return-Path: <linux-amarula+bncBCQ4XFG47UFRBAON22OQMGQERXA53VQ@amarulasolutions.com> X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 8D2ED3F047 for <linux-amarula@patchwork.amarulasolutions.com>; Wed, 4 Jan 2023 17:17:05 +0100 (CET) Received: by mail-ej1-f69.google.com with SMTP id gn28-20020a1709070d1c00b007c177fee5fasf21584476ejc.23 for <linux-amarula@patchwork.amarulasolutions.com>; Wed, 04 Jan 2023 08:17:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1672849025; cv=pass; d=google.com; s=arc-20160816; b=nR4hxCDxHrBf6o9A+wF34My4BrRoGfEhitXGEzjY+5ABJn8OfdIcf7wqo8e9G0qHOM +zllR9fBi6MWAz7kG7U8UHnen6d5sFuctRwC41HMcK8GHgjyOOFY/LGKpGCezVwTAEtu S7OirPYn77Zq75GJ2mQYVzTTZsGs1CX6PN36CFx9XrXFR557z1OsFtXMmIc92XbialZA tF9MUWr4lL1WsBgTWKK5y1TjQiIA2+GQXW1u0NSFq7jJxzqI8dF9OMHtAycxnRFX7df7 0OMZNBzWG1A1EaYQwVCOgmN1oG+cCrsdcOLySDAzDoRERc3hhOjR12Q8q76NOyP9dmbN EaVw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:message-id:date:subject:cc:to :from:dkim-signature; bh=qSpilOXYBwif6V0PLOsWtMuup8PjwQ/gLTRWPvn++30=; b=mdNZFDBwiaWdpDZTYVr248p5sJaPIwLJDVTw/ARGD97BbL5nfff8NFp4WfbJln0jiX RJG4bNBs2/UmHidBQjOQTSSZPSY6XcjC7Fcr8xktPIQ4ly9AyuxnWnie1ALouqA/Ri5C vInSabw2KA8Ilbho4dNJKfXvxj79cdK1XBX+UaUAREAcS5JFp2a0XiLA60IzgCwUOdhJ FW8nb3QU3sfBhR5QatVqAF5Z/16i6B93A/cr1gWcymSAhe2v7iEwF1NCtiYASzbksvu6 u8Frdck+7eJnug9g9pciFeYdLycc/AB55htmzb8j+sYpKG19quMDI8Fhmpc3J04lkK36 h8wA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="lY6sZ/+b"; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:message-id:date:subject:cc:to:from :from:to:cc:subject:date:message-id:reply-to; bh=qSpilOXYBwif6V0PLOsWtMuup8PjwQ/gLTRWPvn++30=; b=Hz/HqfTX/scwd+mSi33qYOIggwI22t6Erj+XBO/sxt2TJaBTJNC1kRrfkU2Zq2zCVv woIecKCwp5+HV8dfFoztX8QUj5LFC1tHgpIhgh4IOEUABBBB6IW6J5L8l8RVJAySzfab 5QPEfx/GGnV1MeQvaEgXiyQ7PzHEyipo2ngHg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qSpilOXYBwif6V0PLOsWtMuup8PjwQ/gLTRWPvn++30=; b=n8Qa/dBzVdz4Ftfx5V14owc8kLRLds+RLQRCAv32WUSFuwAAzy/KRtbwkCWaC3d8OQ raIEAxwEDwpHSc195CwOe5xShCRQEMc8yfFeyMHSODc0Zyto1x/Y4YlZN7Zbby8+ldml 7NlpXYiUU8Wly33dKYGn10MvDbWmpY+HMnkF2+VAVwG8gEOIFZIPOrRt1j8Q5WkSrVpS O+yApGPMO8XgjStZqIUcaXf1T/Py/W5p7YtN68YOtH4XpLtW4QCJhO/u5u8T3p9v2Nzk ZJYB5tbk81jwiAyFTwVSU/MSMHrcHJIH0mFA79yjpH8ihtpWiGaXO8U00waSNklxvbjN Y4Zg== X-Gm-Message-State: AFqh2krxnlK/FEHovVB6sl6Dls3CPlPO44ZHHMOrG3jr1x7VgbKFn1uB A+4symXtZYGBrFa6vMzjZyPuntMd X-Google-Smtp-Source: AMrXdXvwT/z3wHKKk8okpxd2t02Ca3c4eoH7vc3KuSF1HhSi+VzWo8u85k1X88kHQsR8/oPti/bQfA== X-Received: by 2002:a17:906:6441:b0:7c1:7258:e3fa with SMTP id l1-20020a170906644100b007c17258e3famr3422386ejn.668.1672849025380; Wed, 04 Jan 2023 08:17:05 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:906:b24d:b0:7c1:6e9c:4a2c with SMTP id ce13-20020a170906b24d00b007c16e9c4a2cls6892955ejb.1.-pod-prod-gmail; Wed, 04 Jan 2023 08:17:04 -0800 (PST) X-Received: by 2002:a17:906:8384:b0:838:9aba:6a06 with SMTP id p4-20020a170906838400b008389aba6a06mr41383127ejx.39.1672849024223; Wed, 04 Jan 2023 08:17:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672849024; cv=none; d=google.com; s=arc-20160816; b=LTyjFmK2kcgI8jzNZNHGEwiRXankwjq23qnToM0mzgT6xLOQf+4FLjgnTgFm8OT2s4 oflupNObdteDozpyWle857TJ89GZzyxqCIXCMqHzuJtGlClsFABSVBYEbL97uPHYXbou lNMj6ON/GALAHKuN8nRBcBPFlMLoaNxB32bfX5+fpcA5WpCjyyDh/wodK39w+c1b04cM +CQ9XLK1wCXSMCAMAZXlURTvKQumpQSpS5hjpY+mnIn//QfmOUvpHy+lhzbNPyEEd3UX DoMFWhpjIfmFetJBnZ1FMxURkQR+HaSzZ1XwKT057KFyI7bUrRwSH/zpukFmCmNJgIQ/ Bjow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=jt3ehQ5uYN27ErBVJY7gefCH6KUDqbPPNnf0MbCCsjY=; b=vJKStAvsgEOpHLD7wLsHoU8s93KhqlVoClhgGdpRW2tccSYicCkkVCFhZjXpGXy5Bp Icxwf8A4BTugvMuvfiPO2nHbdoELCkLzSw1oIfTfOTQjdwvJUCg5Uj20uxgoB87AK7+9 TT4Rj8k9qdw2RQdzd9j1EV13+SOAGka5Vw34SHCpoUL7yeCFTMtltLFVk4qA4jHWCpCz RVU9Wrd1lIDrrAvAt0PV/xkuceB9g2V7Bwh3MQsIlFkhqATRG3C4wj3ND5CyqM9nzt0p 8xavqULtGiU9WFmtSAyCv2XaBlBm28UOcx8AxYBvp4hBkUZiaMEfOVknygBONmTyBDGd V6YA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="lY6sZ/+b"; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id o11-20020a50c90b000000b00475eb84ea60sor17890182edh.4.2023.01.04.08.17.04 for <linux-amarula@amarulasolutions.com> (Google Transport Security); Wed, 04 Jan 2023 08:17:04 -0800 (PST) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:aa7:d893:0:b0:47f:ab65:b3fe with SMTP id u19-20020aa7d893000000b0047fab65b3femr35181301edq.33.1672849024014; Wed, 04 Jan 2023 08:17:04 -0800 (PST) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-80-180-23-57.retail.telecomitalia.it. [80.180.23.57]) by smtp.gmail.com with ESMTPSA id cz8-20020a0564021ca800b0048f032371bcsm944439edb.88.2023.01.04.08.17.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Jan 2023 08:17:03 -0800 (PST) From: Dario Binacchi <dario.binacchi@amarulasolutions.com> To: u-boot@lists.denx.de Cc: Dario Binacchi <dario.binacchi@amarulasolutions.com>, Mattijs Korpershoek <mkorpershoek@baylibre.com>, Lukasz Majewski <lukma@denx.de>, Marek Vasut <marex@denx.de>, linux-amarula@amarulasolutions.com Subject: [PATCH] usb: gadget: fastboot: detach usb just before rebooting Date: Wed, 4 Jan 2023 17:16:43 +0100 Message-Id: <20230104161643.2730063-1-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="lY6sZ/+b"; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: <linux-amarula.amarulasolutions.com> X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/post>, <mailto:linux-amarula@amarulasolutions.com> List-Help: <https://support.google.com/a/amarulasolutions.com/bin/topic.py?topic=25838>, <mailto:linux-amarula+help@amarulasolutions.com> List-Archive: <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/> List-Unsubscribe: <mailto:googlegroups-manage+476853432473+unsubscribe@googlegroups.com>, <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/subscribe> |
| Series |
usb: gadget: fastboot: detach usb just before rebooting
|
|
Commit Message
Dario Binacchi
Jan. 4, 2023, 4:16 p.m. UTC
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")
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
---
drivers/usb/gadget/f_fastboot.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
Comments
On 1/4/23 17:16, Dario Binacchi 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") > Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> > --- > > 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: If Mattijs could have a look, that would be real nice. If there is no activity in say a week or two, please let me know and I'll pick it up via USB tree.
On Wed, Jan 04, 2023 at 17:27, Marek Vasut <marex@denx.de> wrote: > On 1/4/23 17:16, Dario Binacchi 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") >> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> >> --- >> >> 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: > > If Mattijs could have a look, that would be real nice. I've answered on v2. Let's continue the discussion there. > > If there is no activity in say a week or two, please let me know and > I'll pick it up via USB tree.
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: