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 1A628C001DF for ; Tue, 8 Aug 2023 13:05:15 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 98F728623A; Tue, 8 Aug 2023 15:05:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=collabora.com header.i=@collabora.com header.b="mUreGS+4"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6D559862AE; Tue, 8 Aug 2023 15:05:12 +0200 (CEST) Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) (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 882CD861F7 for ; Tue, 8 Aug 2023 15:05:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=eugen.hristev@collabora.com Received: from [192.168.0.125] (unknown [82.76.24.202]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: ehristev) by madras.collabora.co.uk (Postfix) with ESMTPSA id 995596607210; Tue, 8 Aug 2023 14:05:09 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1691499910; bh=5QOd/Ct4h9kF7Mj9OymqryWVh0dguIHziZ+NGSCr/JY=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=mUreGS+4E66BfK90nrKqizfw7pKuWG/jpc/wL/kh0ueqP/JhYqu7vg75tvpXqZiET O0Zcbv1fcSH2WOTO/5JO1cLdyYux3OKaDEUWjy9ix+HriojsixTfjBYKJj+Pqk/AOJ IqhL6hMS/fgjOyciRXfD5/SX+QEqnvBbrck5gggcYdJyPMYrJS9ZWcINssvV4GI0Nz pbQAPMjGKCuVAdaoziZDp3k3ZIr480XUs6G+h3mimUoODPEwTof3g0EX7wGTv3bzfb QZvRcupjJVXFrH+heSKxcJ+5m7oF0duhGMd8cdsrw2i0NRjqIAVSfFfEJQb8XD4D87 /u19S2NHDYULw== Message-ID: Date: Tue, 8 Aug 2023 16:05:06 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH 0/2] mtd: nand: raw: atmel: R/B gpio on sam9x60 Content-Language: en-US To: Alexander Dahl , Dario Binacchi , Michael Trimarchi , Mihai Sain Cc: Balamanikandan Gunasundar , u-boot@lists.denx.de References: <20230808130250.188588-1-ada@thorsis.com> From: Eugen Hristev In-Reply-To: <20230808130250.188588-1-ada@thorsis.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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.8 at phobos.denx.de X-Virus-Status: Clean Added Mihai who tested this a lot at some point in time Eugen On 8/8/23 16:02, Alexander Dahl wrote: > Hello everyone, > > this is a patch series wtih some real fixes _and_ a question or some > kind of support request in the cover letter. I would be happy if anyone > could read the cover letter carefully and answer to that one what might > be the problem I see. O:-) > > I'm currently working on the sam9x60-curiosity board and especially > trying to get it booting from onboard raw NAND flash. As reported in my > last series I got the flash recognized already. However interacting > with it was terribly slow, because nand_wait_ready() calling > atmel_nand_dev_ready() ran into a 400ms timeout in several occasions, > especially when reading from the device. Reading a single block > triggered that timeout two times per page, which summed up to over 50 > seconds for 64 × 4096 = 256k Bytes! > > (You can have U-Boot print that warning from nand_wait_ready() by > increasing the console log level to at least "warn".) > > Note: the dts from atmel/next seems correct to me, I double checked that > again. My own debug log messages showed the GPIO is accessed, and if > you add enough debug messages sometimes the timeout is not reached, so > I'm sure the NAND chip eventually switches that R/B line and the code > correctly sees that, that line level change however takes ages, > something between 400ms and 500ms most of the times. > > I vaguely remembered on SAMA5D2 the old atmel raw nand driver is used > which does not support reading the R/B signal, but nevertheless works. > I'm not familiar in detail with those raw NAND flash chips, but as far > as I can understand, there are other ways to determine if the chip is > ready or busy. So after I removed that rb-gpio parameter from > 'at91-sam9x60_curiosity.dts' I ran into the bug fixed by patch 2. > > With that patch applied _and_ rb-gpio still removed from dts, raw NAND > access is reasonably fast on sam9x60-curiosity board. (You might want > to rebase to atmel/next for testing this.) Not sure if I should send a > patch for that dts change, because I suppose it's a workaround only and > not addressing the actual cause? > > I think the fix is correct in itself, I tested different combinations > and compared with the driver in Linux, however … > > Can anyone explain to me, why flash access is sooo slow if the R/B gpio > is used? Especially in comparision to Linux, where I don't need to > remove that thing from dts and it works reasonably fast? > > The actual flash chip is a Macronix MX30LF4G28AD, 512 MiB, SLC, erase > size: 256 KiB, page size: 4096, OOB size: 256. > > Greets > Alex > > P.S.: although not returned by get_maintainer.pl I added Eugen to Cc > because he is maintainer of the at91 and might have some insight if it > is a general problem of the nand controller in at91 socs? > > Alexander Dahl (2): > mtd: nand: raw: atmel: Remove duplicate line > mtd: nand: raw: atmel: Add error handling when rb-gpios missing > > drivers/mtd/nand/raw/atmel/nand-controller.c | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > > base-commit: a169438411f9277cc689c14078151aa1d1caae3c