TI中文支持网
TI专业的中文技术问题搜集分享网站

am335x的nandflash移植

大家好,我将am335x-evm板的flash改为(–Page size x8: 4320 bytes (4096 + 224 bytes)),请问uboot需要修改那些地方?

我之前修改了am335x_evm.h后。

在uboot显示如下结果

=> mtdpart

default nand0: partition (NAND.SPL) size alignment incorrect

Shine:

从报错信息看,可能是NAND partition layout和新的nand flash的block size不一致,不仅仅partition offsets还有partition size也要是block size的倍数. 请检查am335x_evm.h文件的mtdparts配置。

,

ZB_LAJI:

你好,请问am335x_evm.h文件中mtdparts配置是指哪里?

我查看了文件仅有:

#ifdef CONFIG_NAND

#define NANDARGS \

"mtdids=" CONFIG_MTDIDS_DEFAULT "\0" \

"mtdparts=" CONFIG_MTDPARTS_DEFAULT "\0" \

"nandargs=setenv bootargs console=${console} " \

"${optargs} " \

"root=${nandroot} " \

"rootfstype=${nandrootfstype}\0" \

"nandroot=ubi0:rootfs rw ubi.mtd=NAND.file-system,2048\0" \

"nandrootfstype=ubifs rootwait=1\0" \

"nandboot=echo Booting from nand …; " \

"run nandargs; " \

"nand read ${fdtaddr} NAND.u-boot-spl-os; " \

"nand read ${loadaddr} NAND.kernel; " \

"bootz ${loadaddr} – ${fdtaddr}\0"

#else

#define NANDARGS ""

#endif

这一处提到了mdtparts,里面涉及的CONFIG_MTDPARTS_DEFAULT 在am335x_evm_deconfig中出现:

CONFIG_MTDPARTS_DEFAULT="mtdparts=nand.0:128k(NAND.SPL),128k(NAND.SPL.backup1),128k(NAND.SPL.backup2),128k(NAND.SPL.backup3),256k(NAND.u-boot-spl-os),1m(NAND.u-boot),128k(NAND.u-boot-env),128k(NAND.u-boot-env.backup1),8m(NAND.kernel),-(NAND.file-system)"

这里面有需要修改的参数?另外附上我之前修改的am335x_evm.h的部分:

#ifdef CONFIG_NAND

/* NAND: device related configs */

#define CONFIG_SYS_NAND_5_ADDR_CYCLE

#define CONFIG_SYS_NAND_PAGE_COUNT (CONFIG_SYS_NAND_BLOCK_SIZE / \

CONFIG_SYS_NAND_PAGE_SIZE)

#define CONFIG_SYS_NAND_PAGE_SIZE 4096

#define CONFIG_SYS_NAND_OOBSIZE 224/*64*/

#define CONFIG_SYS_NAND_BLOCK_SIZE (128*2048)/*128*1024*/

/* NAND: driver related configs */

#define CONFIG_SYS_NAND_BAD_BLOCK_POS NAND_LARGE_BADBLOCK_POS

#define CONFIG_SYS_NAND_ECCPOS { 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, \

16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, \

28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, \

40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, \

52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, \

64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, \

76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, \

88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, \

100, 101, 102, 103, 104, 105, 106, 107, 108, 109, \

110, 111, 112, 113}

#define CONFIG_SYS_NAND_ECCSIZE 512

#define CONFIG_SYS_NAND_ECCBYTES 14

#define CONFIG_SYS_NAND_ONFI_DETECTION

#define CONFIG_NAND_OMAP_ECCSCHEME OMAP_ECC_BCH8_CODE_HW

#define CONFIG_SYS_NAND_U_BOOT_OFFS 0x00100000/*0x000c0000*/

/* NAND: SPL related configs */

#ifdef CONFIG_SPL_OS_BOOT

#define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x00200000 /* kernel offset */

#endif

#endif /* !CONFIG_NAND */

,

Shine:

是这里,您用的flash block size还是128K吗?如果不是128k,CONFIG_MTDPARTS_DEFAULT里面的参数要修改。

,

ZB_LAJI:

我所使用的的是256K的,CONFIG_MTDPARTS_DEFAULT里面的参数是表示分区,请问这要如何修改啊?

,

Shine:

下面改成256k试试。
CONFIG_MTDPARTS_DEFAULT="mtdparts=nand.0:128k(NAND.SPL),128k(NAND.SPL.backup1),128k(NAND.SPL.backup2),128k(NAND.SPL.backup3),256k(NAND.u-boot-spl-os),1m(NAND.u-boot),128k(NAND.u-boot-env),128k(NAND.u-boot-env.backup1),8m(NAND.kernel),-(NAND.file-system)"

,

ZB_LAJI:

我将里面的128k均修改为256k后,mdtpart命令能够使用了。

device nand0 <nand.0>, # parts = 10 #: name                size            offset          mask_flags 0: NAND.SPL            0x00040000      0x00000000      0 1: NAND.SPL.backup1    0x00040000      0x00040000      0 2: NAND.SPL.backup2    0x00040000      0x00080000      0 3: NAND.SPL.backup3    0x00040000      0x000c0000      0 4: NAND.u-boot-spl-os  0x00040000      0x00100000      0 5: NAND.u-boot         0x00100000      0x00140000      0 6: NAND.u-boot-env     0x00040000      0x00240000      0 7: NAND.u-boot-env.backup10x00040000   0x00280000      0 8: NAND.kernel         0x00800000      0x002c0000      0 9: NAND.file-system    0x3f540000      0x00ac0000      0active partition: nand0,0 – (NAND.SPL) 0x00040000 @ 0x00000000defaults:mtdids  : nand0=nand.0mtdparts: mtdparts=nand.0:256k(NAND.SPL),256k(NAND.SPL.backup1),256k(NAND.SPL.backup2),256k(NAND.SPL.backup3),256k(NAND.u-boot-spl-os),1m(NAND.u-boot),256k(NAND.u-boot-env),256k(NAND.u-boot-env.backup1),8m(NAND.kernel),-(NAND.file-system)

但这里的这些分区是否能够进行合并,分区的大小依据是什么

另外,我进行nand write操作时,系统提示EEC错误

NAND erase: device 0 offset 0x100000, size 0x180000Erasing at 0x240000 — 100% complete.OK=> nand write 0x82000000 0x1000000 1x180000NAND write: '1×180000' is not a number=> nand write 0x82000000 0x1000000 0x180000NAND write: device 0 offset 0x1000000, size 0x180000omap-elm: uncorrectable ECC errorsomap-elm: uncorrectable ECC errorsNAND write to offset 1000000 failed -5 0 bytes written: ERROR

我前面有修改NAND_ECCPOS、ECCSIZE、ECCBYTES的大小,请问这ECC错误应该如何解决?

,

Shine:

2k page size变成4k page size, ECC机制也要修改,请参考下面的帖子。
e2echina.ti.com/…/149594

赞(0)
未经允许不得转载:TI中文支持网 » am335x的nandflash移植
分享到: 更多 (0)