OSDN Git Service

mtd: rawnand: hynix: fix decoding the OOB size on H27UCG8T2BTR
authorMartin Blumenstingl <martin.blumenstingl@googlemail.com>
Sun, 24 Jun 2018 20:53:55 +0000 (22:53 +0200)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Mon, 2 Jul 2018 07:01:38 +0000 (09:01 +0200)
commit16c4fba03a45ac8c6048a96e02abc933e1354852
tree7b18ab6779f479b8241b678857c8f1954769d2ad
parentac8cf0b9e784acaf6fa20de89cb23b156834ca01
mtd: rawnand: hynix: fix decoding the OOB size on H27UCG8T2BTR

The datasheet of the H27UCG8T2BTR states that this chip has a page size
of "16,384 + 1,280(Spare) bytes". The description of the "4th Byte of
Device Identifier Description" indicates that bits 6, 3 and 2 are
encoding the "Redundant Area Size / 8KB", where 640 bytes is a value of
0x6 (110 in binary notation).

hynix_nand_extract_oobsize decodes an OOB size of 640 bytes for this
chip. Kernel boot log extract before this patch:
nand: Could not find valid ONFI parameter page; aborting
nand: device found, Manufacturer ID: 0xad, Chip ID: 0xde
nand: Hynix NAND 8GiB 3,3V 8-bit
nand: 8192 MiB, MLC, erase size: 4096 KiB, page size: 16384,
      OOB size: 640

However, based on the description in the datasheet we need to multiply
the OOB size with 2, because it's "640 spare bytes per 8192 bytes page
size" and this NAND chip has a page size of 16384 (= 2 * 8192). After
this patch the kernel boot log reports:
nand: Could not find valid ONFI parameter page; aborting
nand: device found, Manufacturer ID: 0xad, Chip ID: 0xde
nand: Hynix NAND 8GiB 3,3V 8-bit
nand: 8192 MiB, MLC, erase size: 4096 KiB, page size: 16384,
      OOB size: 1280

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
drivers/mtd/nand/raw/nand_hynix.c