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 9E038C433F5 for ; Thu, 2 Dec 2021 09:02:05 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DC048817DD; Thu, 2 Dec 2021 10:02:02 +0100 (CET) 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="nA+h0dOs"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C3B5B80379; Thu, 2 Dec 2021 10:02:00 +0100 (CET) Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) (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 56B55817E1 for ; Thu, 2 Dec 2021 10:01:57 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=p.yadav@ti.com Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 1B291pwj093294; Thu, 2 Dec 2021 03:01:51 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1638435711; bh=WOhlXndllXlmqrJNDPF0lF4KXSZTE1HqiYrx4XnYDQs=; h=Date:From:To:CC:Subject:References:In-Reply-To; b=nA+h0dOssAvD6705yqLXzQY8Os07ucaNj2eF4OW3NyxiIwnsqlh2cLScOw4YZRG5s V5suD2A2vIEKN7XBfiI/CZlDl3njQxuotxYzKIHnCRGQkZWGydsV08fhVh964JRu/m EVczsEYWf7IZXzPnrqtNWtFcgb/H+GCKt/DhOi/k= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 1B291pPR031153 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 2 Dec 2021 03:01:51 -0600 Received: from DFLE114.ent.ti.com (10.64.6.35) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Thu, 2 Dec 2021 03:01:51 -0600 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14 via Frontend Transport; Thu, 2 Dec 2021 03:01:51 -0600 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 1B291oBS113491; Thu, 2 Dec 2021 03:01:51 -0600 Date: Thu, 2 Dec 2021 14:31:50 +0530 From: Pratyush Yadav To: Marek Vasut CC: Jagan Teki , U-Boot-Denx , Vignesh R Subject: Re: [PATCH] mtd: cqspi: Wait for transfer completion Message-ID: <20211202090148.lvd6pfdedgq62bkg@ti.com> References: <20210914032231.273509-1-marex@denx.de> <20210914174230.ioalzc45yq37krot@ti.com> <47ef9ee8-81f7-da64-bd90-7c282cae354c@denx.de> <20210915082821.gofegwxuagrfee5i@ti.com> <20211025195335.elcg4ujh2sfr7lhx@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20171215 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 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.2 at phobos.denx.de X-Virus-Status: Clean Hi Marek, On 25/10/21 10:25PM, Marek Vasut wrote: > On 10/25/21 9:53 PM, Pratyush Yadav wrote: > > On 08/10/21 06:06PM, Jagan Teki wrote: > > > On Wed, Sep 15, 2021 at 2:05 PM Marek Vasut wrote: > > > > > > > > On 9/15/21 10:28 AM, Pratyush Yadav wrote: > > > > > On 14/09/21 08:22PM, Marek Vasut wrote: > > > > > > On 9/14/21 7:42 PM, Pratyush Yadav wrote: > > > > > > > On 14/09/21 05:22AM, Marek Vasut wrote: > > > > > > > > Wait for the read/write transfer finish bit get actually cleared, > > > > > > > > this does not happen immediately on at least SoCFPGA Gen5. > > > > > > > > > > > > > > > > Signed-off-by: Marek Vasut > > > > > > > > Cc: Jagan Teki > > > > > > > > Cc: Vignesh R > > > > > > > > Cc: Pratyush Yadav > > > > > > > > --- > > > > > > > > drivers/spi/cadence_qspi_apb.c | 17 +++++++++++++++++ > > > > > > > > 1 file changed, 17 insertions(+) > > > > > > > > > > > > > > > > diff --git a/drivers/spi/cadence_qspi_apb.c b/drivers/spi/cadence_qspi_apb.c > > > > > > > > index 429ee335db6..2cdf4c9c9f8 100644 > > > > > > > > --- a/drivers/spi/cadence_qspi_apb.c > > > > > > > > +++ b/drivers/spi/cadence_qspi_apb.c > > > > > > > > @@ -858,6 +858,14 @@ 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; > > > > > > > > + } > > > > > > > > + > > > > > > > > > > > > > > Huh, this is strange. I would expect the bit to clear immediately since > > > > > > > it doesn't really do any operation on the flash. How long does it > > > > > > > usually take to clear? If you don't wait for it to clear does anything > > > > > > > break? > > > > > > > > > > > > Often it does clear immediately, but there were a few odd cases where it did > > > > > > not happen right away, in which case I had transfer corruption. > > > > > > > > > > By "transfer corruption" do you mean the current transfer gets corrupted > > > > > or the next one? > > > > > > > > > > We get here _after_ the transfer is completed and this bit should have > > > > > little to do with the data received. If the current transfer fails then > > > > > I suspect something else might be going wrong the this is just a symptom > > > > > of the problem. > > > > > > > > As far as I recall, the problem was triggered when using UBI on the SPI > > > > NOR, so that could very well be the next transfer. > > > > > > Any further decisions here? shall I take it or v2? > > > > I think we need more information here. I don't see why checking this bit > > would interfere with the current transfer since that is already finished > > by the time we get here. If it is the next transfer then this might just > > be a symptom and the real problem might be somewhere else. > > What additional information do you need ? Sorry for the late reply. I dropped the ball on this one. The additional information I needed was to know what exactly happens if we don't wait for this bit to be cleared. Does the _current_ transfer go though fine? If it does, what gets corrupted in the next transfer? Do you only get partial data? Do you get garbage data? Do you get no data at all? All this information would be useful for understanding if this fix is the right one, and if so why it is the right one. -- Regards, Pratyush Yadav Texas Instruments Inc.