各位好:
我司单板在linux内核下,有两个问题:
1、flash芯片为32Gb的,即容量为4GB字节,如果只分成一个分区,该如何支持4GB?(dts不支持大于32位的长度,目前只能分成两个2G的分区)
2、使用文件系统自带的测试程序(/usr/sbin/nandtest 、/usr/sbin/nandwirte)),测试很多坏块,但是在u-boot下使用nand命令测试只有几个坏块。这种情况可能是什么原因?
环境如下:
SDK:ti-processor-sdk-linux-am335x-evm-01.00.00.03-Linux-x86-Install.bin
CPU:AM3352
NAND FLASH:MICRON MT29F32G08CBADA
备注:u-boot和内核放在NOR FLASH中了,NAND FLASH只存放文件系统
dts配置如下:
nandflash_pins_default: nandflash_pins_default {
pinctrl-single,pins = <
0x0 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad0.gpmc_ad0 */
0x4 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad1.gpmc_ad1 */
0x8 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad2.gpmc_ad2 */
0xc (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad3.gpmc_ad3 */
0x10 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad4.gpmc_ad4 */
0x14 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad5.gpmc_ad5 */
0x18 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad6.gpmc_ad6 */
0x1c (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_ad7.gpmc_ad7 */
0x70 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_wait0.gpmc_wait0 */
0x74 (PIN_INPUT_PULLUP | MUX_MODE0) /* gpmc_wpn.gpio0_30 */
0x7c (PIN_OUTPUT | MUX_MODE0) /* gpmc_csn0.gpmc_csn0 */
0x90 (PIN_OUTPUT | MUX_MODE0) /* gpmc_advn_ale.gpmc_advn_ale */
0x94 (PIN_OUTPUT | MUX_MODE0) /* gpmc_oen_ren.gpmc_oen_ren */
0x98 (PIN_OUTPUT | MUX_MODE0) /* gpmc_wen.gpmc_wen */
0x9c (PIN_OUTPUT | MUX_MODE0) /* gpmc_be0n_cle.gpmc_be0n_cle */
>;
};
&gpmc {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&nandflash_pins_default>;
ranges = <0 0 0x01000000 0x10000000>; /* CS0: NAND */
nand@0,0 {
reg = <0 0 0>; /* CS0, offset 0 */
ti,nand-ecc-opt = "bch8";
ti,elm-id = <&elm>;
nand-bus-width = <8>;
gpmc,device-width = <1>;
gpmc,sync-clk-ps = <0>;
gpmc,cs-on-ns = <0>;
gpmc,cs-rd-off-ns = <44>;
gpmc,cs-wr-off-ns = <44>;
gpmc,adv-on-ns = <6>;
gpmc,adv-rd-off-ns = <34>;
gpmc,adv-wr-off-ns = <44>;
gpmc,we-on-ns = <0>;
gpmc,we-off-ns = <40>;
gpmc,oe-on-ns = <0>;
gpmc,oe-off-ns = <54>;
gpmc,access-ns = <64>;
gpmc,rd-cycle-ns = <82>;
gpmc,wr-cycle-ns = <82>;
gpmc,wait-on-read = "true";
gpmc,wait-on-write = "true";
gpmc,bus-turnaround-ns = <0>;
gpmc,cycle2cycle-delay-ns = <0>;
gpmc,clk-activation-ns = <0>;
gpmc,wait-monitoring-ns = <0>;
gpmc,wr-access-ns = <40>;
gpmc,wr-data-mux-bus-ns = <0>;
/* MTD partition table */
/* All SPL-* partitions are sized to minimal length
* which can be independently programmable. For
* NAND flash this is equal to size of erase-block */
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "NAND.rootfs1";
reg = <0x00000000 0x80000000>;
};
partition@1 {
label = "NAND.rootfs2";
reg = <0x00000000 0x80000000>;
};
};
};
系统运行后:
root@am335x-evm:/usr/sbin# cat /proc/mtd
dev: size erasesize name
mtd0: 01000000 00010000 "spi1.0"
mtd1: 80000000 00200000 "NAND.rootfs1"
mtd2: 80000000 00200000 "NAND.rootfs2"
测试了256M的空间:
root@am335x-evm:/usr/sbin# ./nandtest -o 0 -l 0x10000000 /dev/mtd1
ECC corrections: 0
ECC failures : 0
Bad blocks : 515
BBT blocks : 0
Bad block at 0x00000000
Bad block at 0x00200000
Bad block at 0x00400000
Bad block at 0x00600000
Bad block at 0x00800000
Bad block at 0x00a00000
Bad block at 0x00c00000
Bad block at 0x00e00000
Bad block at 0x01000000
Bad block at 0x01200000
Bad block at 0x01400000
Bad block at 0x01600000
Bad block at 0x01800000
Bad block at 0x01a00000
Bad block at 0x01c00000
Bad block at 0x01e00000
Bad block at 0x02000000
Bad block at 0x02200000
Bad block at 0x02400000
Bad block at 0x02600000
Bad block at 0x02800000
Bad block at 0x02a00000
Bad block at 0x02c00000
Bad block at 0x02e00000
Bad block at 0x03000000
Bad block at 0x03200000
Bad block at 0x03400000
Bad block at 0x03600000
Bad block at 0x03800000
Bad block at 0x03a00000
Bad block at 0x03c00000
Bad block at 0x03e00000
Bad block at 0x04000000
Bad block at 0x04200000
Bad block at 0x04400000
Bad block at 0x04600000
Bad block at 0x04800000
Bad block at 0x04a00000
Bad block at 0x04c00000
Bad block at 0x04e00000
05000000: erasing... [ 1390.993819] nand: nand_erase_nand: attempt to erase a bad block at page 0x00002800
MEMERASE: Input/output error
Bad block at 0x05200000
Bad block at 0x05400000
Bad block at 0x05600000
Bad block at 0x05800000
Bad block at 0x05a00000
Bad block at 0x05c00000
Bad block at 0x05e00000
Bad block at 0x06000000
Bad block at 0x06200000
Bad block at 0x06400000
Bad block at 0x06600000
Bad block at 0x06800000
Bad block at 0x06a00000
Bad block at 0x06c00000
Bad block at 0x06e00000
Bad block at 0x07000000
Bad block at 0x07200000
Bad block at 0x07400000
Bad block at 0x07600000
Bad block at 0x07800000
Bad block at 0x07a00000
Bad block at 0x07c00000
Bad block at 0x07e00000
Bad block at 0x08000000
Bad block at 0x08200000
Bad block at 0x08400000
Bad block at 0x08600000
08800000: erasing... [ 1391.651349] nand: nand_erase_nand: attempt to erase a bad block at page 0x00004400
MEMERASE: Input/output error
Bad block at 0x08a00000
Bad block at 0x08c00000
Bad block at 0x08e00000
Bad block at 0x09000000
Bad block at 0x09200000
Bad block at 0x09400000
Bad block at 0x09600000
Bad block at 0x09800000
Bad block at 0x09a00000
Bad block at 0x09c00000
Bad block at 0x09e00000
Bad block at 0x0a000000
Bad block at 0x0a200000
Bad block at 0x0a400000
Bad block at 0x0a600000
Bad block at 0x0a800000
Bad block at 0x0aa00000
Bad block at 0x0ac00000
Bad block at 0x0ae00000
Bad block at 0x0b000000
Bad block at 0x0b200000
Bad block at 0x0b400000
Bad block at 0x0b600000
Bad block at 0x0b800000
Bad block at 0x0ba00000
Bad block at 0x0bc00000
Bad block at 0x0be00000
Bad block at 0x0c000000
Bad block at 0x0c200000
Bad block at 0x0c400000
Bad block at 0x0c600000
Bad block at 0x0c800000
Bad block at 0x0ca00000
Bad block at 0x0cc00000
Bad block at 0x0ce00000
Bad block at 0x0d000000
Bad block at 0x0d200000
Bad block at 0x0d400000
Bad block at 0x0d600000
Bad block at 0x0d800000
Bad block at 0x0da00000
Bad block at 0x0dc00000
Bad block at 0x0de00000
Bad block at 0x0e000000
Bad block at 0x0e200000
Bad block at 0x0e400000
Bad block at 0x0e600000
Bad block at 0x0e800000
Bad block at 0x0ea00000
Bad block at 0x0ec00000
Bad block at 0x0ee00000
Bad block at 0x0f000000
Bad block at 0x0f200000
Bad block at 0x0f400000
Bad block at 0x0f600000
Bad block at 0x0f800000
Bad block at 0x0fa00000
Bad block at 0x0fc00000
Bad block at 0x0fe00000
Finished pass 1 successfully