u-boot/drivers
Peng Fan 552c88273e nand: mxs: fix the bitflips for erased page when uncorrectable error
This patch is porting from linux:
http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git/commit/
?h=imx_4.1.15_1.0.0_ga&id=3d42fcece496224fde59f9343763fb2dfc5b0768

"
We may meet the bitflips in reading an erased page(contains all 0xFF),
this may causes the UBIFS corrupt, please see the log from Elie:

-----------------------------------------------------------------
[    3.831323] UBI warning: ubi_io_read: error -74 (ECC error) while reading 16384 bytes from PEB 443:245760, read only 16384 bytes, retry
[    3.845026] UBI warning: ubi_io_read: error -74 (ECC error) while reading 16384 bytes from PEB 443:245760, read only 16384 bytes, retry
[    3.858710] UBI warning: ubi_io_read: error -74 (ECC error) while reading 16384 bytes from PEB 443:245760, read only 16384 bytes, retry
[    3.872408] UBI error: ubi_io_read: error -74 (ECC error) while reading 16384 bytes from PEB 443:245760, read 16384 bytes
...
[    4.011529] UBIFS error (pid 36): ubifs_recover_leb: corrupt empty space LEB 27:237568, corruption starts at 9815
[    4.021897] UBIFS error (pid 36): ubifs_scanned_corruption: corruption at LEB 27:247383
[    4.030000] UBIFS error (pid 36): ubifs_scanned_corruption: first 6569 bytes from LEB 27:247383
-----------------------------------------------------------------

This patch does a check for the uncorrectable failure in the following steps:

   [0] set the threshold.
       The threshold is set based on the truth:
       "A single 0 bit will lead to gf_len(13 or 14) bits 0 after the BCH
        do the ECC."

        For the sake of safe, we will set the threshold with half the gf_len, and
        do not make it bigger the ECC strength.

   [1] count the bitflips of the current ECC chunk, assume it is N.

   [2] if the (N <= threshold) is true, we continue to read out the page with
       ECC disabled. and we count the bitflips again, assume it is N2.
       (We read out the whole page, not just a chunk, this makes the check
        more strictly, and make the code more simple.)

   [3] if the (N2 <= threshold) is true again, we can regard this is a erased
       page. This is because a real erased page is full of 0xFF(maybe also has
       several bitflips), while a page contains the 0xFF data will definitely
       has many bitflips in the ECC parity areas.

   [4] if the [3] fails, we can regard this is a page filled with the '0xFF'
       data.
"

Signed-off-by: Peng Fan <peng.fan@nxp.com>
2020-05-10 20:55:20 +02:00
..
adc dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
ata sata: dwc_ahsata: Fix memory issue in reset_sata 2020-05-08 18:29:10 -04:00
axi dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
bios_emulator bios_emulator: remove stray break 2019-08-09 22:24:02 +08:00
block block: ide: use definitions from include/libata.h 2020-04-17 12:32:36 -04:00
board drivers: board: Add get_fit_loadable() 2020-01-07 11:13:24 -05:00
bootcount bootcount_ext: Add flag to enable/disable bootcount 2020-04-24 10:10:00 -04:00
cache cache: l2x0: Fix missing write to Auxiliary Control Register 2020-05-06 15:12:48 -04:00
clk i.MX for 2020.07 2020-05-04 09:29:42 -04:00
core dm: core: Add function to get child count of ofnode or device 2020-05-02 12:32:28 +02:00
cpu cpu: imx8: show RevC instead of Rev? at boot log 2020-05-03 15:45:49 +02:00
crypto drivers: crypto: rsa_mod_exp: avoid DM_FLAG_PRE_RELOC 2020-04-16 08:12:32 +02:00
ddr arm: mvebu: drivers/ddr: remove redundant assignment 2020-04-14 13:16:42 +02:00
demo SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
dfu configs: migrate CONFIG_SET_DFU_ALT_INFO to defconfigs 2020-05-08 09:16:26 -04:00
dma dma: ti: k3-udma: Mark flow id as valid parameter for RX channel config 2020-03-03 13:08:14 +05:30
fastboot fastboot: mt85xx: add command to flash/erase emmc hwpart 2020-01-25 12:04:36 -05:00
firmware Xilinx changes for v2020.07 2020-04-07 17:13:35 -04:00
fpga dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
gpio test: pinmux: add pincontrol-gpio for pin configuration 2020-04-16 23:06:54 -04:00
hwspinlock dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
i2c i2c: mxc: add fuse check 2020-05-10 13:21:20 +02:00
input input: Move input.o to be built only in some cases 2019-11-19 17:43:04 -05:00
led dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
mailbox dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
memory SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
misc misc: scu: Increase the timeout for MU communication 2020-05-10 20:55:20 +02:00
mmc mmc: zynq: parse dt when probing 2020-04-27 13:53:13 +02:00
mtd nand: mxs: fix the bitflips for erased page when uncorrectable error 2020-05-10 20:55:20 +02:00
net eQos: Implement the read_rom_hwaddr callback 2020-05-10 20:55:20 +02:00
nvme dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
pch x86: Allow removal of standard PCH drivers 2019-12-15 11:44:16 +08:00
pci pci: Avoid auto-config when chain loading 2020-04-30 17:40:16 +08:00
pci_endpoint pci_ep: Fix Coverity warning 2019-08-07 15:31:04 -04:00
phy phy: phy-mtk-tphy: add a new reference clock 2020-05-02 12:32:28 +02:00
pinctrl pinctrl: nxp: scu: Check the pad partition before set pinmux 2020-05-10 13:24:23 +02:00
power pmic: pfuze100: Change error message level to debug 2020-04-18 12:59:37 +02:00
pwm mediatek: pwm: add pwm driver for MediaTek SoCs 2020-04-17 12:32:36 -04:00
qe doc: fix references to README.qe_firmware 2020-05-04 09:12:37 +05:30
ram configs: stm32mp1: replace STM32MP1_TRUSTED by TFABOOT 2020-04-15 09:08:37 +02:00
remoteproc remoteproc: k3-r5: Fix rproc init failure on Split-mode _only_ devices 2020-03-16 12:33:19 +05:30
reset sandbox conversion to SDL2 2020-02-11 10:58:41 -05:00
rng rockchip: rng: Add a driver for random number generator(rng) device 2020-04-29 10:30:55 +08:00
rtc rtc: pt7c4338: Add driver model support 2020-05-04 09:12:36 +05:30
scsi scsi: Add dma direction member to command structure 2019-10-23 20:47:12 -04:00
serial uart: pl011: Add proper DM clock support 2020-05-07 09:01:42 -04:00
smem dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
soc dma-mapping: move dma_map_(un)single() to <linux/dma-mapping.h> 2020-02-19 21:27:30 +08:00
sound dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
spi spi: sifive: Fix QPP transfer 2020-04-30 22:34:20 +05:30
spmi dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
sysreset sysreset: add reset controller based reboot driver 2020-04-27 20:29:33 +02:00
tee tee: optee: use dev_info in print_os_revision 2020-04-17 12:32:36 -04:00
thermal thermal: imx_tmu: support i.MX8MP 2020-05-10 20:55:20 +02:00
timer timer MediaTek use upstream compatible 2020-05-01 11:34:01 -04:00
tpm tpm: Don't cleanup unless an error happens 2020-04-16 14:36:28 +08:00
ufs dma-mapping: move dma_map_(un)single() to <linux/dma-mapping.h> 2020-02-19 21:27:30 +08:00
usb usb: mx6: add fuse check 2020-05-10 13:21:27 +02:00
video i.MX for 2020.07 2020-05-04 09:29:42 -04:00
virtio dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
w1 dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
w1-eeprom dm: core: Create a new header file for 'compat' features 2020-02-05 19:33:46 -07:00
watchdog watchdog MediaTek add upstream compatible 2020-05-01 11:34:01 -04:00
Kconfig dm: rng: Add random number generator(rng) uclass 2020-01-07 18:08:21 +01:00
Makefile drivers: Descend to drivers/soc unconditionally 2020-03-03 13:08:13 +05:30