[PATCH] mtd: rawnand: gpmi: Fix setting busy timeout setting

Sascha Hauer s.hauer at pengutronix.de
Tue Jun 14 01:34:37 PDT 2022


On Mon, Jun 13, 2022 at 04:07:38PM +0200, Miquel Raynal wrote:
> Hi Sascha,
> 
> s.hauer at pengutronix.de wrote on Mon, 13 Jun 2022 13:30:30 +0200:
> 
> > The DEVICE_BUSY_TIMEOUT value is described in the Reference Manual as:
> > 
> > | Timeout waiting for NAND Ready/Busy or ATA IRQ. Used in WAIT_FOR_READY
> > | mode. This value is the number of GPMI_CLK cycles multiplied by 4096.
> > 
> > So instead of multiplying the value in cycles with 4096, we have to
> > divide it by that value. Use DIV_ROUND_UP to make sure we are on the
> > safe side, especially when the calculated value in cycles is smaller
> > than 4096 as typically the case.
> > 
> > This bug likely never triggered because any timeout != 0 usually will
> > do. In my case the busy timeout in cycles was originally calculated as
> > 2408, which multiplied with 4096 is 0x968000. The lower 16 bits were
> > taken for the 16 bit wide register field, so the register value was
> > 0x8000. With 2970bf5a32f0 ("mtd: rawnand: gpmi: fix controller timings
> > setting") however the value in cycles became 2384, which multiplied
> > with 4096 is 0x950000. The lower 16 bit are 0x0 now resulting in an
> > intermediate timeout when reading from NAND.
> > 
> > Fixes: b1206122069aa ("mtd: rawnand: gpmi: use core timings instead of an empirical derivation")
> > Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> 
> Shouldn't we add a Cc: stable here?

I became a bit ignorant about Cc: stable because everything with the
keyword "Fix" in the subject seems to end up in stable anyway no matter
if I want it or not.

But right, this one should go into stable, I just resent.

Sascha


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the linux-mtd mailing list