calculate ubinize and mkfs.ibifs options

181 views Asked by At

I have a stm32 board with MT29F2G08ABAGAWP flash memory, I have a previous board with MT29F2G08ABAEAWP flash memory, the difference is in OOB, in the first OOB it is 64 bytes, in the second OOB it is 128 bytes, I can not find the formula anywhere LEB is calculated and could not find the PEB parameter for second flash, there are parameters from the datasheet:

for MT29F2G08ABAEAWP first: 
Page size x8: 2112 bytes (2048 + 64 bytes);
Block size: 64 pages (128K + 4K bytes);
Device size: 2Gb: 2048 blocks.
for MT29F2G08ABAGAWP second, for which I cannot calculate the values:
Page size x8: 2176 bytes (2048 + 128 bytes);
Block size: 64 pages (128K + 8K bytes);
Device size: 2Gb: 2048 blocks.

if you know how to calculate LEB, PEB, sub-page-size, maximum-logical-erase-block-count, minimum-I/O-unit-size from these parameters, please tell me, Google did not give an answer.

1

There are 1 answers

0
Ivan Ivanovich On

solution:

diff -Naur uboot-2017.11_orig/drivers/mtd/nand/nand_base.c uboot-2017.11/drivers/mtd/nand/nand_base.c
--- uboot-2017.11_orig/drivers/mtd/nand/nand_base.c 2021-08-05 17:50:55.136923003 +0300
+++ uboot-2017.11/drivers/mtd/nand/nand_base.c  2021-08-06 14:10:22.395612680 +0300
@@ -3440,7 +3440,7 @@
            mtd->oobsize = 448;
            break;
        case 3:
-           mtd->oobsize = 64;
+           mtd->oobsize = 128;
            break;
        case 4:
            mtd->oobsize = 32;
@@ -3467,8 +3467,7 @@
        mtd->writesize = 1024 << (extid & 0x03);
        extid >>= 2;
        /* Calc oobsize */
-       mtd->oobsize = (8 << (extid & 0x01)) *
-           (mtd->writesize >> 9);
+       mtd->oobsize = 128;
        extid >>= 2;
        /* Calc blocksize. Blocksize is multiples of 64KiB */
        mtd->erasesize = (64 * 1024) << (extid & 0x03);
@@ -3488,7 +3487,7 @@
                nand_is_slc(chip) &&
                (id_data[5] & 0x7) == 0x6 /* 24nm */ &&
                !(id_data[4] & 0x80) /* !BENAND */) {
-           mtd->oobsize = 32 * mtd->writesize >> 9;
+           mtd->oobsize = 128;
        }
 
    }