I’m trying to add the new NAND recently to our custom board in DM365 with DVSDK(dvsdk_dm365-evm_4_01_00_09_setuplinux)
After patch with the following clip,
http://processors.wiki.ti.com/index.php/DM365_Nand_ECC_layout
The kernel seems cannot skip the bad block and we get problem with :
cat start.sh
start.sh: Input/output error
I get the error form u-boot when it’s starting:
U-Boot 2010.12-rc2 (Jun 15 2011 - 10:29:05)
Cores: ARM 297 MHz
DDR: 243 MHz
I2C: ready
DRAM: 128 MiB
NAND: 128 MiB
MMC: davinci: 0, davinci: 1
Bad block table found at page 65472, version 0x01
Bad block table found at page 65408, version 0x01
nand_bbt: ECC error while reading bad block table
nand_read_bbt: Bad block at 0x000002e60000
nand_read_bbt: Bad block at 0x000003b40000
nand_read_bbt: Bad block at 0x000007340000
this is what I get so far :
NAND: K9F1G08U0D 128M x 8 Bit NAND Flash Memory
• Organization
- Memory Cell Array : (128M + 4M) x 8bit
- Data Register : (2K + 64) x 8bit
• Automatic Program and Erase
- Page Program : (2K + 64)Byte
- Block Erase : (128K + 4K)Byte
Linux: 2.6.32.17-psp03.01.01.38
u-boot: 2010.12-rc1-psp03.01.01.38
u-boot NAND configuration:
#define CONFIG_NAND_DAVINCI
#define CONFIG_SYS_NAND_CS 2
#define CONFIG_SYS_NAND_USE_FLASH_BBT
#define CONFIG_SYS_NAND_4BIT_HW_ECC_OOBFIRST
#define CONFIG_SYS_NAND_PAGE_2K
#define CONFIG_SYS_NAND_LARGEPAGE
/* Confirmed: 0x02000000 ASYNC EMIF Data (CE0) address see page 16 of device-specific data manual */
#define CONFIG_SYS_NAND_BASE_LIST { 0x02000000, }
/* socket has two chipselects, nCE0 gated by address BIT(14) */
#define CONFIG_SYS_MAX_NAND_DEVICE 1
#define CONFIG_SYS_NAND_MAX_CHIPS 1
Changes in the board-dm365.c:
//mike added to support the hw ecc for dm365 uboot/ubl
static struct nand_ecclayout dm365_evm_nand_ecclayout = {
.eccbytes = 40,
.eccpos = {6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
},
.oobfree = {{2, 4}, {16, 6}, {32, 6}, {48, 6} },
};
static struct davinci_nand_pdata davinci_nand_data = {
.mask_chipsel = 0, // only one nand see below
.parts = davinci_nand_partitions,
.nr_parts = ARRAY_SIZE(davinci_nand_partitions),
.ecc_mode = NAND_ECC_HW, // no check ecc : NAND_ECC_NONE
.options = NAND_USE_FLASH_BBT,
.ecc_bits = 4,
//mike : added
.ecclayout = &dm365_evm_nand_ecclayout,
};
If we use
.mask_chipsel = BIT(14),
The kernel keep to tell us that :
NAND device: Manufacturer ID: 0xec, Chip ID: 0xf1 (Samsung NAND 128MiB 3,3V 8-bit)
2 NAND chips detected
nand_bbt: ECC error while reading bad block table
nand_bbt: ECC error while reading bad block table
Creating 8 MTD partitions on "davinci_nand.0":
More info when start:
List of all partitions:
1f00 4096 mtdblock0 (driver?)
1f01 1024 mtdblock1 (driver?)
1f02 3072 mtdblock2 (driver?)
1f03 20480 mtdblock3 (driver?)
1f04 1024 mtdblock4 (driver?)
1f05 32768 mtdblock5 (driver?)
1f06 4096 mtdblock6 (driver?)
1f07 195584 mtdblock7 (driver?)
No filesystem could mount root, tried: cramfs
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,3)
Backtrace:
[<c008c5f4>] (dump_backtrace+0x0/0x114) from [<c039d280>] (dump_stack+0x18/0x1c)
r7:00008000 r6:c2015000 r5:c0026808 r4:c04ce3f8
[<c039d268>] (dump_stack+0x0/0x1c) from [<c039d2d8>] (panic+0x54/0x12c)
[<c039d284>] (panic+0x0/0x12c) from [<c0008fbc>] (mount_block_root+0x1e0/0x220)
r3:00000000 r2:00000020 r1:c2029f60 r0:c0435da6
[<c0008ddc>] (mount_block_root+0x0/0x220) from [<c00090c0>] (mount_root+0xc4/0xfc)
r8:00000000 r7:00000000 r6:00000000 r5:c0026808 r4:01f00003
[<c0008ffc>] (mount_root+0x0/0xfc) from [<c0009268>] (prepare_namespace+0x170/0x1c8)
r5:c0026808 r4:c04cdf20
[<c00090f8>] (prepare_namespace+0x0/0x1c8) from [<c00084bc>] (kernel_init+0xe4/0x118)
r5:00000000 r4:c04cdce0
[<c00083d8>] (kernel_init+0x0/0x118) from [<c00a0d88>] (do_exit+0x0/0x668)
r5:00000000 r4:00000000
we tried to flash the whole chip and write the data to the mtdblock5 list below:
nand write 0x80700000 0x1d00000 0x2000000
NAND write: device 0 offset 0x1d00000, size 0x2000000
Skip bad block 0x02e60000
Skip bad block 0x03b40000
33554432 bytes written: OK
But the kernel cannot skip the bad block we found it is bad in uboot:
NAND device: Manufacturer ID: 0xec, Chip ID: 0xf1 (Samsung NAND 128MiB 3,3V 8-bit)
nand_bbt: ECC error while reading bad block table
Creating 8 MTD partitions on "davinci_nand.0":
0x000000000000-0x000000400000 : "bootloader"
When MTD BLOCK5 is mounted, we tried to do something in that mtd-part, we got:
cat start.sh
start.sh: Input/output error
we also tried to flash the app in kernel without luck:
/ # flash_eraseall /dev/mtd5
Erasing 128 Kibyte @ 1140000 -- 53 % complete.
Skipping bad block at 0x01160000
Erasing 128 Kibyte @ 1e20000 -- 94 % complete.
Skipping bad block at 0x01e40000
Erasing 128 Kibyte @ 2000000 -- 100 % complete
/ # nandwrite /dev/mtd5 app.img
Writing data to block 0 at offset 0x0
Writing data to block 1 at offset 0x20000
Writing data to block 2 at offset 0x40000
<Snap>
Writing data to block 137 at offset 0x1120000
Writing data to block 138 at offset 0x1140000
Writing data to block 139 at offset 0x1160000
Bad block at 1160000, 1 block(s) from 1160000 will be skipped
Writing data to block 140 at offset 0x1180000
Writing data to block 141 at offset 0x11a0000
Writing data to block 142 at offset 0x11c0000
<Snap>
Writing data to block 164 at offset 0x1480000
Writing data to block 165 at offset 0x14a0000
Writing data to block 166 at offset 0x14c0000
Don’t know why the kernel found just one bad block when write date into that mtd-part.
After reboot, u-boot seems to print the same thing with the previous steps we used u-boot to flash the app:
Bad block table found at page 65472, version 0x01
Bad block table found at page 65408, version 0x01
nand_bbt: ECC error while reading bad block table
nand_read_bbt: Bad block at 0x000002e60000
nand_read_bbt: Bad block at 0x000003b40000
nand_read_bbt: Bad block at 0x000007340000
And the dmesg gives the same message comp to the previous steps:
NAND device: Manufacturer ID: 0xec, Chip ID: 0xf1 (Samsung NAND 128MiB 3,3V 8-bit)
nand_bbt: ECC error while reading bad block table
Creating 8 MTD partitions on "davinci_nand.0":
0x000000000000-0x000000400000 : "bootloader"
0x000000400000-0x000000500000 : "params"
0x000000500000-0x000000800000 : "kernel"
0x000000800000-0x000001c00000 : "rootfs"
0x000001c00000-0x000001d00000 : "driver"
0x000001d00000-0x000003d00000 : "app"
0x000003d00000-0x000004100000 : "config"
0x000004100000-0x000008000000 : "ext"
davinci_nand davinci_nand.0: controller rev. 2.3
Any ideas? Any idea will be appreciate.
Thinks in advance.
Regards, Mike.