pagesize == 4096 byte
oob == 224 byte
block size == 256 Kbyte
-
u-boot configs/xxx.h 里面配置如下参数:
272 #define CONFIG_SYS_NAND_PAGE_SIZE 4096
273 #define CONFIG_SYS_NAND_OOBSIZE 224
274 #define CONFIG_SYS_NAND_BLOCK_SIZE (256*1024)
275 #define CONFIG_NAND_OMAP_ECCSCHEME OMAP_ECC_BCH16_CODE_HW
276 #define CONFIG_SYS_NAND_BAD_BLOCK_POS NAND_LARGE_BADBLOCK_POS
277 #define CONFIG_SYS_NAND_ECCPOS { 2, 3, 4, 5, 6, 7, 8, 9,
278 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
279 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
280 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
281 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
282 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
283 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
284 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
285 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
286 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,
287 100, 101, 102, 103, 104, 105, 106, 107, 108,
288 109, 110, 111, 112, 113, 114, 115, 116, 117,
289 118, 119, 120, 121, 122, 123, 124, 125, 126,
290 127, 128, 129, 130, 131, 132, 133, 134, 135,
291 136, 137, 138, 139, 140, 141, 142, 143, 144,
292 145, 146, 147, 148, 149, 150, 151, 152, 153,
293 154, 155, 156, 157, 158, 159, 160, 161, 162,
294 163, 164, 165, 166, 167, 168, 169, 170, 171,
295 172, 173, 174, 175, 176, 177, 178, 179, 180,
296 181, 182, 183, 184, 185, 186, 187, 188, 189,
297 190, 191, 192, 193, 194, 195, 196, 197, 198,
298 199, 200, 201, 202, 203, 204, 205, 206, 207,
299 208, 209,
300 }
301
302 #define CONFIG_SYS_NAND_ECCSIZE 512
303 #define CONFIG_SYS_NAND_ECCBYTES 26
83 "nandroot=ubi0:rootfs rw ubi.mtd=4,4096 "
84 "nandrootfstype=ubifs rootwait=1 "
85 "nandboot=echo Booting from nand ...; "
86 "run nandargs; "
87 "nandecc hw 16; "
88 "setenv loadaddr 0x82000000; "
89 "setenv fdtaddr 0x88000000; "
90 "nandecc hw 16; "
91 "nand read ${loadaddr} 0x240000 0x480000; "
92 "nandecc hw 16; "
93 "nand read ${fdtaddr} 0x6C0000 0x80000; "
94 "bootz ${loadaddr} - ${fdtaddr} ; "
-
上面的参数配置就是有关 nand 224,4096,256的配置
-
在烧写的时候,也要 nand hw 16, 在 omap_gpmc.c 里面还要添加
935 } else if (eccstrength == 8) {
936 err = omap_select_ecc_scheme(nand,
937 OMAP_ECC_BCH8_CODE_HW,
938 mtd->writesize, mtd->oobsize);
939 } else if (eccstrength == 16) {
940 err = omap_select_ecc_scheme(nand,
941 OMAP_ECC_BCH16_CODE_HW,
942 mtd->writesize, mtd->oobsize);
943 printf("hw 16 writesize : %d oobsize :%d
", mtd->writesize, mtd->oobsize);