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 5EE88C001B0 for ; Sun, 13 Aug 2023 17:37:20 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4C803846FB; Sun, 13 Aug 2023 19:37:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.b="y4lMDvod"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="N/C4hGka"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2A2AB8475C; Sun, 13 Aug 2023 19:37:17 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D867780DF7 for ; Sun, 13 Aug 2023 19:37:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=msuchanek@suse.de Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 8D8F621910; Sun, 13 Aug 2023 17:37:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1691948234; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4dhzLnh12kWhKVwPjWZVJTqUB47tXPKOMDzn5fsYuyc=; b=y4lMDvodCIvmSU+yr2WHb87rgK3je1S8BC1cZhq/GV4QqPq41hf9WcIgADTFzr5iWQfiFu Ui7f2FikMfTBP6n0/1WYsf1Uq1OlyhUxG582CXK+huOjdsc+1GIJKGbJjyeiw6fhqa/Rm7 LIQivLceLnDdg+pDLn/++VY/4pCNNnU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1691948234; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4dhzLnh12kWhKVwPjWZVJTqUB47tXPKOMDzn5fsYuyc=; b=N/C4hGkaTMySNZiWct0+WkzTzVoCfKoRGu82jomjFjmRl68K39d6y3BNi6c+EsqCReQuME BK6JzaKNmsgzCcCA== Received: from kunlun.suse.cz (unknown [10.100.128.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 619A52C142; Sun, 13 Aug 2023 17:37:14 +0000 (UTC) Date: Sun, 13 Aug 2023 19:37:13 +0200 From: Michal =?iso-8859-1?Q?Such=E1nek?= To: Massimo Pegorer Cc: Harry Waschkeit , "u-boot@lists.denx.de" Subject: Re: Problem upon startup with halted USB device on RaspberryPi 4 Message-ID: <20230813173713.GA42565@kunlun.suse.cz> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) 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.8 at phobos.denx.de X-Virus-Status: Clean Hello, On Sat, Aug 12, 2023 at 08:31:56PM +0200, Massimo Pegorer wrote: > Hi Harry, > > Il giorno lun 7 ago 2023 alle ore 11:02 Harry Waschkeit < > Harry.Waschkeit@conplement.de> ha scritto: > > > Hi, > > > > I have a RaspberryPi 4 where on one USB port a Sierra Wireless LTE > > module (EM7455) is attached via an PCIe-to-USB adapter. > > The boot image I use gets built by Yocto with the help of poky > > (kirkstone) and meta-raspberry (beside a few other layers) which > > incorporates U-Boot 22.01. > > > > When I apply power to the board it will come up until scanning USB > > devices (for potential boot devices), but then throw a BUG end reset the > > board. > > > Do you need USB boot devices? If not, I would build U-Boot without USB > support. That would be great workaround, However, enabling a device should not break the board. If that's the case the driver is clearly broken. Also rPi typically uses USB keyboard for boot-time input which makes the workaround not so great. Thanks Michal > > Massimo > > > This continues as long as the modem is unplugged. > > The exact error message is: > > > > scanning bus xhci_pci for devices... WARN halted endpoint, queuing URB > > anyway. > > Unexpected XHCI event TRB, skipping... (3af519b0 00000004 13000000 > > 02008401) > > BUG at drivers/usb/host/xhci-ring.c:503/abort_td()! > > BUG! > > resetting ... > > > > Some internet research brought up a patch (1) for > > drivers/usb/host/xhci-ring.c where halted devices simply get ignored > > during enumeration: > > > > diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c > > index acf437104a..6d995f446e 100644 > > --- a/drivers/usb/host/xhci-ring.c > > +++ b/drivers/usb/host/xhci-ring.c > > @@ -227,7 +227,8 @@ static int prepare_ring(struct xhci_ctrl *ctrl, > > struct xhci_ring *ep_ring, > > puts("WARN waiting for error on ep to be cleared\n"); > > return -EINVAL; > > case EP_STATE_HALTED: > > - puts("WARN halted endpoint, queueing URB anyway.\n"); > > + puts("WARN halted endpoint.\n"); > > + return -EPIPE; > > case EP_STATE_STOPPED: > > case EP_STATE_RUNNING: > > debug("EP STATE RUNNING.\n"); > > > > The driver file itself stems from the Linux sources, so I'm pretty sure > > that it is correct in that context. > > Even though I'm not really into USB stuff and therefore I cannot not > > really follow the discussion for the proposed change, in my eyes the > > patch could be reasonable for U-Boot nevertheless given that a) in my > > experience driver code is often used in a simplified way in U-Boot > > compared to Linux kernel, and b) it's all about board start-up only and > > not about full OS use with all bells, whistles and full error handling. > > > > Of course, I might be wrong while missing some important other use or > > corner cases, so I wanted to check here :-) > > > > At least, what I can say: with this patch I see a bunch of these warning > > messages but the board comes up and is usable in the end by Linux. > > > > fwiw: my internet search also showed another patch labelled in the first > > place "[PATCH] pi4: fix crash when issuing usb reset" (2) that didn't > > make it into the particular U-Boot 22.01 but was integrated right after > > that version in commit "Prepare v2022.04" with hash > > e4b6ebd3de982ae7185dbf689a030e73fd06e0d2 (3). > > As I first hoped I could address my problem by just adding this patch I > > got promptly disappointed. The only thing I gained was to now get > > endless error messages followed by retries until I power-cycled the > > board (causing to start all over): > > > > USB XHCI 1.00 > > scanning bus xhci_pci for devices... WARN halted endpoint, queueing URB > > anyway. > > Unexpected XHCI event TRB, skipping... (3afd6b30 00000004 13000000 > > 02008401) > > XHCI abort timeout > > WARN halted endpoint, queueing URB anyway. > > Unexpected XHCI event TRB, skipping... (3afd6b40 00000004 13000000 > > 02008401) > > XHCI abort timeout > > WARN halted endpoint, queueing URB anyway. > > Unexpected XHCI event TRB, skipping... (3afd6b50 00000004 13000000 > > 02008401) > > XHCI abort timeout > > WARN halted endpoint, queueing URB anyway. > > [...] > > > > To me it means that this specific PCIe-to-USB bridge might misbehave > > somehow, > > but the final question is: what are the odds to get that patch into > > official U-boot, or any other fix/quirk to make my hardware combo working? > > > > And also interesting: if I cannot hope for an upstream change, what > > potential risks I would have to accept when keeping my patch? > > > > Regards, > > Harry > > > > (1) > > > > https://linux-usb.vger.kernel.narkive.com/VW4VTVDU/patch-usb-host-xhci-fix-halted-endpoint-handling > > (2) > > https://lore.kernel.org/all/3d4ece94-932a-25dd-ef29-0ddfb4a51465@denx.de/T/ > > (3) > > > > https://source.denx.de/u-boot/u-boot/-/commit/e4b6ebd3de982ae7185dbf689a030e73fd06e0d2 > > > > -- > > i.A. Harry Waschkeit > > Senior Embedded Engineer > > conplement AG > > Südwestpark 92 > > 90449 Nürnberg > > > > Handelsregister: HRB 22863 > > Registergericht: Nürnberg > > Vertreten durch: Britta Waligora und Thomas Wahle > > Vorsitzender des Aufsichtsrates: Lorenz von Schröder > > > >