OpenCloudOS-Kernel/drivers/mtd/nand/raw
Sascha Hauer 06781a5026 mtd: rawnand: gpmi: Fix setting busy timeout setting
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 2970bf5a32 ("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: b120612206 ("mtd: rawnand: gpmi: use core timings instead of an empirical derivation")
Cc: stable@vger.kernel.org
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20220614083138.3455683-1-s.hauer@pengutronix.de
2022-06-16 16:46:08 +02:00
..
atmel Raw NAND core changes: 2022-03-23 18:08:03 +01:00
bcm47xxnflash mtd: rawnand: Use the new ECC engine type enumeration 2020-09-28 15:59:42 +02:00
brcmnand Raw NAND core changes: 2022-03-23 18:08:03 +01:00
gpmi-nand mtd: rawnand: gpmi: Fix setting busy timeout setting 2022-06-16 16:46:08 +02:00
ingenic SPI NOR core changes: 2022-03-18 20:14:42 +01:00
Kconfig mtd: nand: make mtk_ecc.c a separated module 2022-04-27 18:12:35 +02:00
Makefile mtd: nand: make mtk_ecc.c a separated module 2022-04-27 18:12:35 +02:00
ams-delta.c mtd: rawnand: ams-delta: Keep the driver compatible with on-die ECC engines 2021-10-15 12:21:14 +02:00
arasan-nand-controller.c mtd: rawnand: arasan: Prevent an unsupported configuration 2021-10-15 12:24:54 +02:00
au1550nd.c mtd: rawnand: au1550nd: Keep the driver compatible with on-die ECC engines 2021-10-15 12:21:16 +02:00
cadence-nand-controller.c mtd: rawnand: cadence: fix possible null-ptr-deref in cadence_nand_dt_probe() 2022-04-27 17:15:05 +02:00
cafe_nand.c mtd: rawnand: cafe: Fix a resource leak in the error handling path of 'cafe_nand_probe()' 2021-08-23 10:58:14 +02:00
cs553x_nand.c mtd: rawnand: cs553x: simplify the return expression of cs553x_write_ctrl_byte() 2022-05-12 16:43:03 +02:00
davinci_nand.c mtd: rawnand: davinci: Remove redundant unsigned comparison to zero 2022-04-04 10:34:46 +02:00
denali.c mtd: rawnand: Use the new ECC engine type enumeration 2020-09-28 15:59:42 +02:00
denali.h mtd: rawnand: Replace zero-length array with flexible-array member 2020-03-11 16:17:54 +01:00
denali_dt.c mtd: rawnand: denali: Make use of the helper function devm_platform_ioremap_resource_byname() 2021-09-14 19:34:34 +02:00
denali_pci.c mtd: rawnand: denali: Use managed device resources 2022-04-21 09:34:00 +02:00
diskonchip.c SPI NOR core changes: 2020-12-16 18:48:16 +01:00
fsl_elbc_nand.c mtd: nand: ecc-hamming: Remove useless includes 2020-12-10 22:37:30 +01:00
fsl_ifc_nand.c mtd: nand: ecc-hamming: Remove useless includes 2020-12-10 22:37:30 +01:00
fsl_upm.c mtd: nand: ecc-hamming: Remove useless includes 2020-12-10 22:37:30 +01:00
fsmc_nand.c mtd: rawnand: fsmc: Fix timing computation 2021-12-03 14:33:45 +01:00
gpio.c mtd: rawnand: gpio: Keep the driver compatible with on-die ECC engines 2021-10-15 12:21:18 +02:00
hisi504_nand.c mtd: rawnand: hisi504: Make use of the helper function devm_platform_ioremap_resource() 2021-09-14 19:34:41 +02:00
intel-nand-controller.c mtd: rawnand: intel: fix possible null-ptr-deref in ebu_nand_probe() 2022-04-27 17:15:07 +02:00
internals.h mtd: rawnand: Choose the best timings, NV-DDR included 2021-05-26 10:52:43 +02:00
lpc32xx_mlc.c mtd: nand: ecc-hamming: Remove useless includes 2020-12-10 22:37:30 +01:00
lpc32xx_slc.c Revert "mtd: rawnand: lpc32xx_slc: Fix external use of SW Hamming ECC helper" 2021-10-15 12:21:09 +02:00
marvell_nand.c mtd: rawnand: marvell: Minor documentation correction 2021-06-18 09:45:21 +02:00
meson_nand.c mtd: rawnand: remove never changed ret variable 2021-08-06 22:01:56 +02:00
mpc5121_nfc.c mtd: rawnand: mpc5121: Check before clk_disable_unprepare() not needed 2022-05-16 18:34:38 +02:00
mtk_nand.c mtd: nand: make mtk_ecc.c a separated module 2022-04-27 18:12:35 +02:00
mxc_nand.c mtd: rawnand: mxc: Remove unneeded of_match_ptr() 2021-03-28 19:13:39 +02:00
mxic_nand.c mtd: nand: ecc-hamming: Move Hamming code to the generic NAND layer 2020-12-10 22:37:29 +01:00
nand_amd.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
nand_base.c mtd: rawnand: print offset instead of page number for bad blocks 2022-04-04 10:34:58 +02:00
nand_bbt.c mtd: Replace the expert mode symbols with a single helper 2022-02-07 16:36:11 +01:00
nand_esmt.c mtd: rawnand: Use nanddev_get/set_ecc_requirements() when relevant 2020-09-28 15:59:48 +02:00
nand_hynix.c mtd: rawnand: hynix: Add support for H27UCG8T2ETR-BC MLC NAND 2021-10-15 12:24:50 +02:00
nand_ids.c Revert "mtd: rawnand: add support for Toshiba TC58NVG0S3HTA00 NAND flash" 2022-06-09 15:07:07 +02:00
nand_jedec.c mtd: rawnand: Use nanddev_get/set_ecc_requirements() when relevant 2020-09-28 15:59:48 +02:00
nand_legacy.c mtd: rawnand: Avoid accessing NV-DDR timings from legacy code 2021-05-26 10:43:52 +02:00
nand_macronix.c mtd: rawnand: Create a nand_chip operations structure 2020-06-26 08:35:04 +02:00
nand_micron.c mtd: rawnand: Use nanddev_get/set_ecc_requirements() when relevant 2020-09-28 15:59:48 +02:00
nand_onfi.c mtd: rawnand: onfi: Fix endianness when reading NV-DDR values 2021-06-18 09:45:20 +02:00
nand_samsung.c mtd: rawnand: Use nanddev_get/set_ecc_requirements() when relevant 2020-09-28 15:59:48 +02:00
nand_timings.c mtd: rawnand: Add a helper to find the closest ONFI NV-DDR mode 2021-05-26 10:43:59 +02:00
nand_toshiba.c mtd: rawnand: kioxia: Add support for TH58NVG3S0HBAI4 2022-05-12 16:43:01 +02:00
nandsim.c mtd: rawnand: nandsim: Add NS_PAGE_BYTE_SHIFT macro to replace the repeat pattern 2022-01-23 16:37:05 +01:00
ndfc.c Revert "mtd: rawnand: ndfc: Fix external use of SW Hamming ECC helper" 2021-10-15 12:21:07 +02:00
omap2.c mtd: Fix misuses of of_match_ptr() 2022-01-31 17:18:03 +01:00
omap_elm.c mtd: rawnand: omap_elm: Add compatible for AM64 ELM 2022-04-11 10:56:33 +02:00
orion_nand.c mtd: rawnand: orion: Keep the driver compatible with on-die ECC engines 2021-10-15 12:21:22 +02:00
oxnas_nand.c mtd: rawnand: oxnas: Make use of the helper function devm_platform_ioremap_resource() 2021-09-14 19:34:51 +02:00
pasemi_nand.c mtd: rawnand: pasemi: Keep the driver compatible with on-die ECC engines 2021-10-15 12:21:24 +02:00
pl35x-nand-controller.c mtd: rawnand: pl353: Set the nand chip node as the flash node 2022-02-18 15:14:58 +01:00
plat_nand.c mtd: rawnand: plat_nand: Keep the driver compatible with on-die ECC engines 2021-10-15 12:21:26 +02:00
qcom_nandc.c mtd: rawnand: qcom: fix memory corruption that causes panic 2022-04-21 09:29:07 +02:00
r852.c mtd: rawnand: r852: use DEVICE_ATTR_RO() helper macro 2021-06-18 09:45:21 +02:00
r852.h mtd: rawnand: r852: Move the ECC initialization to ->attach_chip() 2020-11-20 12:30:53 +01:00
renesas-nand-controller.c mtd: rawnand: renesas: Use runtime PM instead of the raw clock API 2022-05-16 18:36:21 +02:00
rockchip-nand-controller.c mtd: rawnand: rockchip: Check before clk_disable_unprepare() not needed 2022-05-16 18:34:36 +02:00
s3c2410.c SPI NOR core changes: 2020-12-16 18:48:16 +01:00
sh_flctl.c mtd: rawnand: Fix return value check of wait_for_completion_timeout 2022-04-21 09:29:03 +02:00
sharpsl.c block: remove genhd.h 2022-02-02 07:49:59 -07:00
sm_common.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
sm_common.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
socrates_nand.c mtd: rawnand: socrates: Keep the driver compatible with on-die ECC engines 2021-10-15 12:21:29 +02:00
stm32_fmc2_nand.c mtd: rawnand: stm32_fmc2: Add NAND Write Protect support 2022-02-18 15:15:03 +01:00
sunxi_nand.c mtd: rawnand: sunxi: remove unnecessary oom message 2021-06-11 20:43:33 +02:00
tegra_nand.c mtd: rawnand: tegra: Add runtime PM and OPP support 2021-12-16 14:05:24 +01:00
tmio_nand.c mtd: rawnand: tmio: check return value after calling platform_get_resource() 2022-04-27 17:15:09 +02:00
txx9ndfmc.c Revert "mtd: rawnand: txx9ndfmc: Fix external use of SW Hamming ECC helper" 2021-10-15 12:21:01 +02:00
vf610_nfc.c mtd: rawnand: vf610: Make use of the helper function devm_platform_ioremap_resource() 2021-09-14 19:35:03 +02:00
xway_nand.c mtd: rawnand: xway: Keep the driver compatible with on-die ECC engines 2021-10-15 12:21:31 +02:00