From patchwork Sun Sep 20 19:01:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Agner X-Patchwork-Id: 1367970 X-Patchwork-Delegate: trini@ti.com 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=agner.ch Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=agner.ch header.i=@agner.ch header.a=rsa-sha256 header.s=dkim header.b=Nl/mnLBD; 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 4BvcQ34X75z9sSC for ; Mon, 21 Sep 2020 05:02:09 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E4634824A6; Sun, 20 Sep 2020 21:01:55 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=agner.ch 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=agner.ch header.i=@agner.ch header.b="Nl/mnLBD"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A7F0F824D0; Sun, 20 Sep 2020 21:01:54 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail.kmu-office.ch (mail.kmu-office.ch [IPv6:2a02:418:6a02::a2]) (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 5343D8248F for ; Sun, 20 Sep 2020 21:01:52 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=agner.ch Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=stefan@agner.ch Received: from allenwind.lan (unknown [IPv6:2a02:169:3df5::4db]) by mail.kmu-office.ch (Postfix) with ESMTPSA id DF3025C13C7; Sun, 20 Sep 2020 21:01:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1600628511; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=yoSY2v4M3OeXq+FRdLjtAuOGAzujXo5A/uoK8lk5BDY=; b=Nl/mnLBDeUmJcMhfog6Sgs8U4MQQ2I47/3i8TJMnhTJzikXqvlQo14NKrFcnlJSezHlmo7 Ay8tZhgiRierpx/jzMO+j/SIWuig4c1JGnVzypYYRP9h99UbbtTyOxteGtmSX4WHlCecFy CSVWr/prUP0ZGOVh2f8H2NwArDi4M3U= From: Stefan Agner To: lukma@denx.de, u-boot@lists.denx.de Cc: Stefan Agner Subject: [PATCH] usb: storage: increase retries to 20 Date: Sun, 20 Sep 2020 21:01:43 +0200 Message-Id: <91041dfa88e2dc4919ef42fdf2524534bf6a47e3.1600628472.git.stefan@agner.ch> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.3 at phobos.denx.de X-Virus-Status: Clean A JMicron JMS583 based NVMe to USB 3.1 enclosure connected to a Raspberry Pi 4 fails to enumerate as a USB Mass Storage device on first try: ... startig USB... Bus xhci_pci: Register 5000420 NbrPorts 5 Starting the controller USB XHCI 1.00 scanning bus xhci_pci for devces... Device NOT ready Request Sense returned 02 04 01 4 USB Device(s) found scanning usb for storage devices... 0 Sorage Device(s) found However, it consistently works on the second try. It seems that the device takes longer than 1s to detect the media. With debug enabled it shows that the 11th retry count typically works. Increase retries to 20 for a startup time of up to 2s. Signed-off-by: Stefan Agner --- common/usb_storage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/usb_storage.c b/common/usb_storage.c index ff25441995..04910de21f 100644 --- a/common/usb_storage.c +++ b/common/usb_storage.c @@ -1019,7 +1019,7 @@ static int usb_request_sense(struct scsi_cmd *srb, struct us_data *ss) static int usb_test_unit_ready(struct scsi_cmd *srb, struct us_data *ss) { - int retries = 10; + int retries = 20; do { memset(&srb->cmd[0], 0, 12);