[uboot] mtd NAND recognition regression
Marcin Gołaś
marcingol30 at gmail.com
Thu Oct 20 15:44:46 CEST 2022
Hi,
after uboot update from 2022.07 to 2022.10 SAMSUNG NAND is not recognized
correctly.
I use device with SAMSUNG K9K8G08U0F flash which does not support ONFI and
JEDEC.
Both uboot versions read 8-byte id_data in the same way: 0xD3ECC65A9551D3EC.
However 2022.07 recognized flash correctly as:
nand_base: 1024 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size:
64
1024 MiB
The new 2022.10 recognized flash incorrectly:
nand_base: 1024 MiB, SLC, erase size: 4096 KiB, page size: 4096, OOB size:
128
1024 MiB
This behavior is caused by not setting chip->bits_per_cell value which is
in my case equal to zero.
To fix the issue we need to set it before we enter to function
nand_manufacturer_detect.
Following patch do this:
diff --git a/drivers/mtd/nand/raw/nand_base.c
b/drivers/mtd/nand/raw/nand_base.c
index 4b09a11288..143d3cb755 100644
--- a/drivers/mtd/nand/raw/nand_base.c
+++ b/drivers/mtd/nand/raw/nand_base.c
@@ -4375,6 +4375,8 @@ struct nand_flash_dev *nand_get_flash_type(struct
nand_chip *chip, int *maf_id,
chip->chipsize = (uint64_t)type->chipsize << 20;
+ chip->bits_per_cell = nand_get_bits_per_cell(chip->id.data[2]);
+
if (!type->pagesize) {
nand_manufacturer_detect(chip);
} else {
BR,
Marcin
More information about the U-Boot
mailing list