From patchwork Fri Aug 14 13:29:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Looijmans X-Patchwork-Id: 1345034 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=topic.nl 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BSknc2CLjz9sTW for ; Fri, 14 Aug 2020 23:29:56 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CEF6881C1D; Fri, 14 Aug 2020 15:29:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=topic.nl Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id E95CB81A2A; Fri, 14 Aug 2020 15:29:47 +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=-1.8 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SUBJ_OBFU_PUNCT_FEW,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from jax4mhob22.registeredsite.com (jax4mhob22.registeredsite.com [64.69.218.110]) (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 EA5EB81A2A for ; Fri, 14 Aug 2020 15:29:44 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=topic.nl Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=mike.looijmans@topic.nl Received: from mailpod.hostingplatform.com ([10.30.71.203]) by jax4mhob22.registeredsite.com (8.14.4/8.14.4) with ESMTP id 07EDTgBN016896 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Fri, 14 Aug 2020 09:29:42 -0400 Received: (qmail 1302 invoked by uid 0); 14 Aug 2020 13:29:42 -0000 X-TCPREMOTEIP: 83.128.90.119 X-Authenticated-UID: mike@milosoftware.com Received: from unknown (HELO phenom.domain?not?set.invalid) (mike@milosoftware.com@83.128.90.119) by 0 with ESMTPA; 14 Aug 2020 13:29:41 -0000 From: Mike Looijmans To: michal.simek@xilinx.com, u-boot@lists.denx.de Cc: jagan@amarulasolutions.com, Mike Looijmans Subject: [PATCH] spi/zynqmp_gqspi.c: Use a sane timeout value in milliseconds Date: Fri, 14 Aug 2020 15:29:37 +0200 Message-Id: <20200814132937.29698-1-mike.looijmans@topic.nl> X-Mailer: git-send-email 2.17.1 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 The timeout passed to wait_for_bit... is in milliseconds, not in CPU cycles or something similar what the setting suggested. Rename the constant to GQSPI_TIMEOUT_MS to make it clear that the timeout is in milliseconds. Set the timeout to 10 seconds. You'll be hard pressed to find a NOR flash that this controller cannot read front to end in 10 seconds in a reasonable configuration (i.e. a speed of 100MHz or more). Signed-off-by: Mike Looijmans --- drivers/spi/zynqmp_gqspi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/spi/zynqmp_gqspi.c b/drivers/spi/zynqmp_gqspi.c index a72986be90..596a6a4eef 100644 --- a/drivers/spi/zynqmp_gqspi.c +++ b/drivers/spi/zynqmp_gqspi.c @@ -84,7 +84,7 @@ #define GQSPI_MAX_BAUD_RATE_VAL 7 #define GQSPI_DFLT_BAUD_RATE_VAL 2 -#define GQSPI_TIMEOUT 100000000 +#define GQSPI_TIMEOUT_MS 10000 #define GQSPI_BAUD_DIV_SHIFT 2 #define GQSPI_LPBK_DLY_ADJ_LPBK_SHIFT 5 @@ -228,7 +228,7 @@ static void zynqmp_qspi_fill_gen_fifo(struct zynqmp_qspi_priv *priv, int ret = 0; ret = wait_for_bit_le32(®s->isr, GQSPI_IXR_GFEMTY_MASK, 1, - GQSPI_TIMEOUT, 1); + GQSPI_TIMEOUT_MS, 1); if (ret) printf("%s Timeout\n", __func__); @@ -406,7 +406,7 @@ static int zynqmp_qspi_fill_tx_fifo(struct zynqmp_qspi_priv *priv, u32 size) while (size) { ret = wait_for_bit_le32(®s->isr, GQSPI_IXR_TXNFULL_MASK, 1, - GQSPI_TIMEOUT, 1); + GQSPI_TIMEOUT_MS, 1); if (ret) { printf("%s: Timeout\n", __func__); return ret; @@ -551,7 +551,7 @@ static int zynqmp_qspi_start_dma(struct zynqmp_qspi_priv *priv, } ret = wait_for_bit_le32(&dma_regs->dmaisr, GQSPI_DMA_DST_I_STS_DONE, - 1, GQSPI_TIMEOUT, 1); + 1, GQSPI_TIMEOUT_MS, 1); if (ret) { printf("DMA Timeout:0x%x\n", readl(&dma_regs->dmaisr)); return -ETIMEDOUT;