linux-stable/drivers/mtd
Sascha Hauer 0fddf9ad06 mtd: rawnand: gpmi: Set WAIT_FOR_READY timeout based on program/erase times
06781a5026 Fixes the calculation of the DEVICE_BUSY_TIMEOUT register
value from busy_timeout_cycles. busy_timeout_cycles is calculated wrong
though: It is calculated based on the maximum page read time, but the
timeout is also used for page write and block erase operations which
require orders of magnitude bigger timeouts.

Fix this by calculating busy_timeout_cycles from the maximum of
tBERS_max and tPROG_max.

This is for now the easiest and most obvious way to fix the driver.
There's room for improvements though: The NAND_OP_WAITRDY_INSTR tells us
the desired timeout for the current operation, so we could program the
timeout dynamically for each operation instead of setting a fixed
timeout. Also we could wire up the interrupt handler to actually detect
and forward timeouts occurred when waiting for the chip being ready.

As a sidenote I verified that the change in 06781a5026 is really
correct. I wired up the interrupt handler in my tree and measured the
time between starting the operation and the timeout interrupt handler
coming in. The time increases 41us with each step in the timeout
register which corresponds to 4096 clock cycles with the 99MHz clock
that I have.

Fixes: 06781a5026 ("mtd: rawnand: gpmi: Fix setting busy timeout setting")
Fixes: b120612206 ("mtd: rawniand: gpmi: use core timings instead of an empirical derivation")
Cc: stable@vger.kernel.org
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Han Xu <han.xu@nxp.com>
Tested-by: Tomasz Moń <tomasz.mon@camlingroup.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
2022-07-15 17:41:11 +02:00
..
chips mtd: cfi_cmdset_0002: Rename chip_ready variables 2022-04-28 10:17:22 +02:00
devices mtd: st_spi_fsm: add missing clk_disable_unprepare() in stfsm_remove() 2022-05-17 18:36:02 +02:00
hyperbus mtd: hyperbus: HBMC_AM654 should depend on ARCH_K3 2022-03-14 17:01:58 +01:00
lpddr
maps ARM: multiplatform changes, part 2 2022-06-02 15:23:54 -07:00
nand mtd: rawnand: gpmi: Set WAIT_FOR_READY timeout based on program/erase times 2022-07-15 17:41:11 +02:00
parsers mtd: parsers: bcm47xxpart: print correct offset on read error 2022-04-04 10:33:11 +02:00
spi-nor spi: Updates for v5.19 2022-05-24 15:13:30 -07:00
tests mtd: tests: Fix eraseblock read speed miscalculation for lower partition sizes 2022-03-14 17:01:47 +01:00
ubi ubi: ubi_create_volume: Fix use-after-free when volume creation failed 2022-05-27 16:49:41 +02:00
ftl.c mtd/ftl: don't cast away the type when calling add_mtd_blktrans_dev 2021-08-23 10:01:04 +02:00
inftlcore.c
inftlmount.c mtd: inftl: remove unnecessary oom message 2021-06-11 20:44:21 +02:00
Kconfig mtdblock: Add comment about UBI block devices 2021-08-06 22:05:13 +02:00
Makefile
mtd_blkdevs.c block: remove QUEUE_FLAG_DISCARD 2022-04-17 19:49:59 -06:00
mtdblock.c mtdblock: warn if opened on NAND 2022-04-25 10:43:12 +02:00
mtdblock_ro.c mtdblock: Warn if added for a NAND device 2021-08-17 18:41:59 +02:00
mtdchar.c mtdchar: prevent unbounded allocation in MEMWRITE ioctl 2021-12-09 17:52:29 +01:00
mtdconcat.c mtd: mtdconcat: Check _read, _write callbacks existence before assignment 2021-08-17 18:43:33 +02:00
mtdcore.c mtd: core: Check devicetree alias for index 2022-04-25 10:37:49 +02:00
mtdcore.h
mtdoops.c mtd: mtdoops: Add a timestamp to the mtdoops header. 2022-04-26 09:27:12 +02:00
mtdpart.c mtd: call of_platform_populate() for MTD partitions 2022-05-16 18:37:48 +02:00
mtdpstore.c pstore/blk: Include zone in pstore_device_info 2021-06-16 21:09:31 -07:00
mtdsuper.c mm: don't include <linux/blkdev.h> in <linux/backing-dev.h> 2021-10-18 06:17:01 -06:00
mtdswap.c block: remove genhd.h 2022-02-02 07:49:59 -07:00
nftlcore.c
nftlmount.c mtd: nftl: remove unnecessary oom message 2021-06-11 20:43:26 +02:00
rfd_ftl.c mtd/rfd_ftl: don't cast away the type when calling add_mtd_blktrans_dev 2021-08-23 10:01:06 +02:00
sm_ftl.c
sm_ftl.h
ssfdc.c