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 C404EC04A95 for ; Tue, 25 Oct 2022 06:08:41 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 338B28033D; Tue, 25 Oct 2022 08:08:39 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com 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=ti.com header.i=@ti.com header.b="Aa8tKKGb"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4447580708; Tue, 25 Oct 2022 08:08:38 +0200 (CEST) Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) (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 6CF06802E3 for ; Tue, 25 Oct 2022 08:08:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=vigneshr@ti.com Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 29P68KwI042182; Tue, 25 Oct 2022 01:08:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1666678100; bh=WOgNUqM46M2Xq8K1nsiffnAr+CMUat/gsmdF+mg7Rns=; h=Date:Subject:To:CC:References:From:In-Reply-To; b=Aa8tKKGb2i3ndgAGPMejW5JBdxl1/BAxk06jzAvrc6TQ8SRJc4/wsx4Fp6Dl9AZeE YgxSqDxw6OJFJfaKsvHCyywKI0WhRJd940pl02rW1TFt/eJVg9/VcZ/feGJxOM9XrG yPOBTiP+iuUsquiNjR4awyVQRsWAUfWgAu1m1+yA= Received: from DFLE100.ent.ti.com (dfle100.ent.ti.com [10.64.6.21]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 29P68KVU013315 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 25 Oct 2022 01:08:20 -0500 Received: from DFLE107.ent.ti.com (10.64.6.28) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.6; Tue, 25 Oct 2022 01:08:19 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE107.ent.ti.com (10.64.6.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.6 via Frontend Transport; Tue, 25 Oct 2022 01:08:19 -0500 Received: from [10.250.233.85] (ileaxei01-snat.itg.ti.com [10.180.69.5]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 29P68Dt4012811; Tue, 25 Oct 2022 01:08:13 -0500 Message-ID: Date: Tue, 25 Oct 2022 11:38:12 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: Re: [PATCH 016/347] FogBugz #516535: Fix QSPI write issues Content-Language: en-US To: Jit Loon Lim , CC: Jagan Teki , Marek , Simon , Tien Fong , Kok Kiang , Siew Chin , Sin Hui , Raaj , Dinesh , Boon Khai , Alif , Teik Heng , Hazim , Chee Hong Ang References: <20220830062009.24408-1-jit.loon.lim@intel.com> From: Vignesh Raghavendra In-Reply-To: <20220830062009.24408-1-jit.loon.lim@intel.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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 Hi, On 30/08/22 11:50 am, Jit Loon Lim wrote: > From: Chee Hong Ang > > QSPI driver perform chip select on every flash read/write > access. The driver need to disable/enable the QSPI controller > while performing chip select. This may cause some data lost > especially the QSPI controller is configured to run at slower > speed as it may take longer time to access the flash device. > This patch prevent the driver from disable/enable the QSPI > controller too soon and inadvertently halting any ongoing flash > read/write access by ensuring the QSPI controller is always in > idle mode after each read/write access. > > Signed-off-by: Chee Hong Ang > --- > drivers/spi/cadence_qspi_apb.c | 15 ++++++++------- > 1 file changed, 8 insertions(+), 7 deletions(-) > > diff --git a/drivers/spi/cadence_qspi_apb.c b/drivers/spi/cadence_qspi_apb.c > index 2cdf4c9c9f..5e03495f45 100644 > --- a/drivers/spi/cadence_qspi_apb.c > +++ b/drivers/spi/cadence_qspi_apb.c > @@ -858,13 +858,9 @@ cadence_qspi_apb_indirect_read_execute(struct cadence_spi_plat *plat, > writel(CQSPI_REG_INDIRECTRD_DONE, > plat->regbase + CQSPI_REG_INDIRECTRD); > > - /* Check indirect done status */ > - ret = wait_for_bit_le32(plat->regbase + CQSPI_REG_INDIRECTRD, > - CQSPI_REG_INDIRECTRD_DONE, 0, 10, 0); > - if (ret) { > - printf("Indirect read clear completion error (%i)\n", ret); > - goto failrd; > - } Why would you drop looking at CQSPI_REG_INDIRECTRD_DONE status bit? This gives out a much granular error wrt what operation actually failed. > + /* Wait til QSPI is idle */ > + if (!cadence_qspi_wait_idle(plat->regbase)) > + return -EIO; > > return 0; > > @@ -1031,6 +1027,11 @@ cadence_qspi_apb_indirect_write_execute(struct cadence_spi_plat *plat, > > if (bounce_buf) > free(bounce_buf); > + > + /* Wait til QSPI is idle */ > + if (!cadence_qspi_wait_idle(plat->regbase)) > + return -EIO; > + > return 0; > > failwr: