From patchwork Sun Mar 22 13:00:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 1259667 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=denx.de header.i=@denx.de header.a=rsa-sha256 header.s=phobos-20191101 header.b=zKhOoAwh; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48ld1R2Xvpz9sRf for ; Mon, 23 Mar 2020 00:01:10 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 714D281795; Sun, 22 Mar 2020 14:00:56 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1584882056; bh=rC1RiMJUaF/Im3bNYYPYWPcMoGDj6MXZCRK4AcvolpA=; h=From:To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=zKhOoAwh/q9SGR9eTJzwZdrI5aAX9Z03L8YtniEH8HxlGhRSGy+sOGb8SkmBP+sE+ JdJqxRcD+MNL0Ao7e8XN6OFTUVk4gbQf550qseeuOjSZ2bGLSSivfDzicfNO6CFf+K V6Ib4A45PlhmjicXjJVwvxtOC7WcDAvOmwvbHEwBbUDxlLtBmYGOQQtSOvyxvuaNy1 la1nzJQcMORQbSHUBkeho0U89xyU1MclllytT3wRm3NVvCDrCNK75cFbYdQiye6PKL IUggTuFLaxlIPsjc4yOXGSksq7eXg49jtpLJmasuVcqbNf6OZVJlQnlyIRBpAkME4l LI1+kLEOkNHjA== Received: by phobos.denx.de (Postfix, from userid 109) id 532F28183D; Sun, 22 Mar 2020 14:00:54 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-out.m-online.net (mail-out.m-online.net [IPv6:2001:a60:0:28:0:1:25:1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 96AC68004A for ; Sun, 22 Mar 2020 14:00:50 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=lukma@denx.de Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 48ld0x5J8gz1rmgN; Sun, 22 Mar 2020 14:00:49 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 48ld0x4Mzwz1qv49; Sun, 22 Mar 2020 14:00:49 +0100 (CET) Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id fQmCgC495-Ih; Sun, 22 Mar 2020 14:00:47 +0100 (CET) X-Auth-Info: OuWDPl6cgs/nRaTChyFsmkSL0Mo9/9cu6T2Z0MPAogM= Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Sun, 22 Mar 2020 14:00:47 +0100 (CET) From: Lukasz Majewski To: Marek Vasut , Tom Rini , u-boot@lists.denx.de, Peng Fan Cc: Lukasz Majewski , Daniel Schwierzeck , Heinrich Schuchardt , Michal Suchanek , Simon Glass Subject: [RFT PATCH v1 0/5] usb: Improve robustness of ehci-hcd controller operation Date: Sun, 22 Mar 2020 14:00:26 +0100 Message-Id: <20200322130031.10455-1-lukma@denx.de> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.102.2 at phobos.denx.de X-Virus-Status: Clean This patch set is rather a request for testing (and a starting point for the discussion), as it may improve the robustness of USB with some pendrives - and yes sacrifice some performance for reliability. The previous version of this patch: https://patchwork.ozlabs.org/patch/1244928/ fixed issue for some network USB adapters and improved stability on TI boards. This patch also provides very detailed explanation of the problem in the commit message. With the async support patch applied ( SHA1: 02b0e1a36c5bc20174299312556ec4e266872bd6 ), the qhtoken variable has value 0x00 when token shows errors. As a result the error handling path is not executed. This looks like some missing/broken cache flushing - for easier bisecting this patch has been reverted for now Test setup: =========== Data: VFAT on the pendrive 16MiB FitImage on USB pen drive (to be read in U-Boot) 400 MiB recovery image (but not read) Pen drives: ----------- 1. ID 0930:6544 Toshiba Corp. TransMemory-Mini / Kingston DataTraveler 2.0 Stick 2. ID 21c4:8005 GOODRAM 8GB HW: --- IMX6Q -> TPC70 board Procedure: ---------- Boot U-Boot, execute: loadusb=usb start; fatload usb 0 ${loadaddr} ${upd_image} (Then the image has been crafted to OOPs and WDT after 4 seconds causes reset). When we fail - the "normal" execution path is followed and we boot up till prompt. Results: ======== 1. Current mainline - SHA1: 63b2ef407de2f0997deef3b54b7e7ab9c7a7cb27 - The USB error (EHCI timed out on TD - token=0x80008d80) is present after ~10 minutes - pendrive [1] - Error after a few minutes (1,2) - pendrive [2] 2. When USB async support is reverted (commit SHA1: 02b0e1a36c5bc20174299312556ec4e266872bd6 [*]) - Error is detected after ~1h - pendrive [1] 3. With this patchset applied - 12h of testing - no error - pendrive [1] With the pendrive [2] I do observe that very often it is not recognized at all. Even more strange - there is a difference in the reliability of being recognized between identical pendrives (used one vs. just unboxed one). Lukasz Majewski (5): Revert "usb: ehci-hcd: Keep async schedule running" usb: Handle XACTERR error in DATA phase of USB storage usb: Add some delay to wait for slow USB devices to be operational usb: Provide code to handle spinup of USB usb devices (mostly HDDs) usb: Handle QT_TOKEN_STATUS_XACTERR error when sending data common/usb.c | 10 ++++- common/usb_storage.c | 46 ++++++++++++++++++++++ drivers/usb/host/ehci-hcd.c | 78 ++++++++++++++++++++++++++----------- include/usb.h | 1 + include/usb_defs.h | 1 + 5 files changed, 112 insertions(+), 24 deletions(-)