From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1D4A8C3DA7D for ; Thu, 5 Jan 2023 09:06:33 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8684685598; Thu, 5 Jan 2023 10:06:30 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20210112.gappssmtp.com header.i=@baylibre-com.20210112.gappssmtp.com header.b="sEGgMtty"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BE36485592; Thu, 5 Jan 2023 10:06:29 +0100 (CET) Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 585288559A for ; Thu, 5 Jan 2023 10:06:24 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=mkorpershoek@baylibre.com Received: by mail-wr1-x436.google.com with SMTP id z16so18965887wrw.1 for ; Thu, 05 Jan 2023 01:06:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=mr0uDUNUqYdRzC6YrVI/WXkA8cycI18d1rbpZ4fh/A8=; b=sEGgMtty86Ugg/izzIABdPMBSiSktQv+BgwsASvhtS+e7+4+jtDSM/xIP48i5HSJ6z DTkf3KO4x727rw6z/1Kq2BuQVFl3Hc1WltnMUJMGaN5Hu5rgfZs6+qDTKlVcl+QbDZlu a6+ruYUXjo8nlkXX9i5KeT+Qiw6OTW4yr4ell3y5z8S9Qg1CfPA4w0Wky7idyJMfhg+/ z7B8jfSfH88PKkBR0wY5xaheIbJcSOM05mxFrHf/blcX7xNvxPZS8bdhMx6ySFAyTO7V WzIOsklSZ1q8mLtEDkplFxTSZdIuUY68xK/V/ETrLuKTaWg7QoVvY9ezVdxi4CoeYfBp nQaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=mr0uDUNUqYdRzC6YrVI/WXkA8cycI18d1rbpZ4fh/A8=; b=0T7BhURisEQUnA0id5jw89HcaP8wxdGmWLmoaQgvHMTtojRswa+HQ8fSi5hTiY1bQA 6YDHQB9vRafQyGlFUbTcrNuNG9f1M9dpp+9Cqs9bcz/1Relrg2fzUl2CFHrGuKv/vjNU 09LHcpU/wLIxFSuATzssOYHyLwiltraO0RrV+Cecv5HBll+lOZ4tqlvUIYBZsbrQRle2 2G2HuE6VQ7U4cpMGaK4wzcWrJ3vSDhz8WkAf8KlaNlVgHQTVMLcckCAUwt0HfcNNSM6t W2PH09gbh+GwR95+5CGazQ8PFDtZ1jtvf5cxv0wPNNb4efGWsUmiEBPOznP4oR3llovx XQ0Q== X-Gm-Message-State: AFqh2krAcVtufVcuVzHTogvtSG2vETJyIDEF/O5FTprddYTfQktlXrGR bhgdDKJC7GP6nBeAYTSgg4E6n9OXQ4uGnpPl X-Google-Smtp-Source: AMrXdXtF24E0IDTYndvVWd95GJeiVqTx6ZvkIrlWqGTa/fQeAR+lpnkd+Qy7t3We8ssXeu6+MALmeQ== X-Received: by 2002:a5d:44c9:0:b0:283:7ce6:dd55 with SMTP id z9-20020a5d44c9000000b002837ce6dd55mr18487016wrr.40.1672909583660; Thu, 05 Jan 2023 01:06:23 -0800 (PST) Received: from localhost ([82.66.159.240]) by smtp.gmail.com with ESMTPSA id t18-20020a5d42d2000000b00288a3fd9248sm21846420wrr.91.2023.01.05.01.06.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 01:06:22 -0800 (PST) From: Mattijs Korpershoek To: Dario Binacchi , u-boot@lists.denx.de Cc: Dario Binacchi , Michael Trimarchi , Lukasz Majewski , Marek Vasut , linux-amarula@amarulasolutions.com Subject: Re: [PATCH v2] usb: gadget: fastboot: detach usb just before rebooting In-Reply-To: <20230104164658.2734718-1-dario.binacchi@amarulasolutions.com> References: <20230104164658.2734718-1-dario.binacchi@amarulasolutions.com> Date: Thu, 05 Jan 2023 10:06:21 +0100 Message-ID: <871qo98i5u.fsf@baylibre.com> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean On Wed, Jan 04, 2023 at 17:46, 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 > Fixes: 5f7e01e9d5d800 ("usb: gadget: fastboot: detach usb on reboot commands") > Suggested-by: Michael Trimarchi > Signed-off-by: Dario Binacchi 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