2010-09-02 05:18:41     BF512 nand flash 坏块的疑问?

Document created by Aaronwu Employee on Aug 23, 2013
Version 1Show Document
  • View in full screen mode

2010-09-02 05:18:41     BF512 nand flash 坏块的疑问?

weixin zhan (CHINA)

Message: 93069   

 

在BF512+K9F2G08U0M ,片选接在AMS0.

 

其他的以下面文档中,电路完全一致.

 

  docs.blackfin.uclinux.org/doku.php?id=linux-kernel:drivers:bfin_async_nand

 

在UBOOT当中,查到的坏块 与在kernel中查到的坏块存在较大出入.

 

为何在内核中检测出的坏块,在UBOOT中未被检测出.

 

 

 

以下为u-boot中,所检查出来的坏块情况.

 

bfin> nand erase clean

 

NAND erase: device 0 whole chip

Skipping bad block at  0x05480000

Skipping bad block at  0x09420000

Skipping bad block at  0x0a120000

Skipping bad block at  0x0bce0000

Skipping bad block at  0x0e700000

Erasing at 0xffe0000 -- 100% complete. Cleanmarker written at 0xffe0000.

OK

bfin>

 

以下为linux-kernel中,所检查出来的坏块情况

 

console [ttyBF0] enabled, bootconsole disabled

Calibrating delay loop... 796.67 BogoMIPS (lpj=1593344)

Security Framework initialized

Mount-cache hash table entries: 512

Blackfin Scratchpad data SRAM: 4 KB

Blackfin L1 Data A SRAM: 16 KB (16 KB free)

Blackfin L1 Data B SRAM: 16 KB (16 KB free)

Blackfin L1 Instruction SRAM: 32 KB (26 KB free)

NET: Registered protocol family 16

Blackfin DMA Controller

ezbrd_init(): registering device resources

bio: create slab <bio-0> at 0

bfin-spi bfin-spi.0: Blackfin on-chip SPI Controller Driver, Version 1.0, regs_base@ffc00500, dma channel@7

bfin-spi bfin-spi.1: Blackfin on-chip SPI Controller Driver, Version 1.0, regs_base@ffc03400, dma channel@5

NET: Registered protocol family 2

IP route cache hash table entries: 1024 (order: 0, 4096 bytes)

TCP established hash table entries: 2048 (order: 2, 16384 bytes)

TCP bind hash table entries: 2048 (order: 1, 8192 bytes)

TCP: Hash tables configured (established 2048 bind 2048)

TCP reno registered

UDP hash table entries: 256 (order: 0, 4096 bytes)

UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)

NET: Registered protocol family 1

JFS: nTxBlock = 485, nTxLock = 3883

msgmni has been set to 121

io scheduler noop registered (default)

bfin-otp: initialized

bfin-uart: Blackfin serial driver

bfin-uart.0: ttyBF0 at MMIO 0xffc00400 (irq = 29) is a BFIN-UART

brd: module loaded

NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-bit)

Scanning device for bad blocks

Bad eraseblock 1 at 0x000000020000

Bad eraseblock 3 at 0x000000060000

Bad eraseblock 5 at 0x0000000a0000

Bad eraseblock 317 at 0x0000027a0000

Bad eraseblock 338 at 0x000002a40000

Bad eraseblock 460 at 0x000003980000

Bad eraseblock 461 at 0x0000039a0000

Bad eraseblock 463 at 0x0000039e0000

Bad eraseblock 465 at 0x000003a20000

Bad eraseblock 467 at 0x000003a60000

Bad eraseblock 469 at 0x000003aa0000

Bad eraseblock 479 at 0x000003be0000

Bad eraseblock 500 at 0x000003e80000

Bad eraseblock 521 at 0x000004120000

Bad eraseblock 541 at 0x0000043a0000

Bad eraseblock 563 at 0x000004660000

Bad eraseblock 584 at 0x000004900000

Bad eraseblock 605 at 0x000004ba0000

Bad eraseblock 626 at 0x000004e40000

Bad eraseblock 647 at 0x0000050e0000

Bad eraseblock 668 at 0x000005380000

Bad eraseblock 676 at 0x000005480000

Bad eraseblock 678 at 0x0000054c0000

Bad eraseblock 680 at 0x000005500000

Bad eraseblock 682 at 0x000005540000

Bad eraseblock 684 at 0x000005580000

Bad eraseblock 689 at 0x000005620000

Bad eraseblock 710 at 0x0000058c0000

Bad eraseblock 731 at 0x000005b60000

Bad eraseblock 752 at 0x000005e00000

Bad eraseblock 773 at 0x0000060a0000

Bad eraseblock 794 at 0x000006340000

Bad eraseblock 815 at 0x0000065e0000

Bad eraseblock 836 at 0x000006880000

Bad eraseblock 857 at 0x000006b20000

Bad eraseblock 878 at 0x000006dc0000

Bad eraseblock 899 at 0x000007060000

Bad eraseblock 919 at 0x0000072e0000

Bad eraseblock 920 at 0x000007300000

Bad eraseblock 922 at 0x000007340000

Bad eraseblock 924 at 0x000007380000

Bad eraseblock 926 at 0x0000073c0000

Bad eraseblock 928 at 0x000007400000

Bad eraseblock 938 at 0x000007540000

Bad eraseblock 959 at 0x0000077e0000

Bad eraseblock 980 at 0x000007a80000

Bad eraseblock 1001 at 0x000007d20000

Bad eraseblock 1019 at 0x000007f60000

Bad eraseblock 1038 at 0x0000081c0000

Bad eraseblock 1056 at 0x000008400000

Bad eraseblock 1075 at 0x000008660000

Bad eraseblock 1093 at 0x0000088a0000

Bad eraseblock 1112 at 0x000008b00000

Bad eraseblock 1130 at 0x000008d40000

Bad eraseblock 1149 at 0x000008fa0000

Bad eraseblock 1167 at 0x0000091e0000

Bad eraseblock 1185 at 0x000009420000

Bad eraseblock 1186 at 0x000009440000

Bad eraseblock 1188 at 0x000009480000

Bad eraseblock 1190 at 0x0000094c0000

Bad eraseblock 1192 at 0x000009500000

Bad eraseblock 1194 at 0x000009540000

Bad eraseblock 1196 at 0x000009580000

Bad eraseblock 1208 at 0x000009700000

Bad eraseblock 1227 at 0x000009960000

Bad eraseblock 1245 at 0x000009ba0000

Bad eraseblock 1264 at 0x000009e00000

Bad eraseblock 1282 at 0x00000a040000

Bad eraseblock 1289 at 0x00000a120000

Bad eraseblock 1291 at 0x00000a160000

Bad eraseblock 1293 at 0x00000a1a0000

Bad eraseblock 1295 at 0x00000a1e0000

Bad eraseblock 1297 at 0x00000a220000

Bad eraseblock 1299 at 0x00000a260000

Bad eraseblock 1308 at 0x00000a380000

Bad eraseblock 1326 at 0x00000a5c0000

Bad eraseblock 1345 at 0x00000a820000

Bad eraseblock 1363 at 0x00000aa60000

Bad eraseblock 1382 at 0x00000acc0000

Bad eraseblock 1400 at 0x00000af00000

Bad eraseblock 1419 at 0x00000b160000

Bad eraseblock 1437 at 0x00000b3a0000

Bad eraseblock 1456 at 0x00000b600000

Bad eraseblock 1474 at 0x00000b840000

Bad eraseblock 1493 at 0x00000baa0000

Bad eraseblock 1511 at 0x00000bce0000

Bad eraseblock 1530 at 0x00000bf40000

Bad eraseblock 1548 at 0x00000c180000

Bad eraseblock 1567 at 0x00000c3e0000

Bad eraseblock 1585 at 0x00000c620000

Bad eraseblock 1604 at 0x00000c880000

Bad eraseblock 1622 at 0x00000cac0000

Bad eraseblock 1641 at 0x00000cd20000

Bad eraseblock 1659 at 0x00000cf60000

Bad eraseblock 1678 at 0x00000d1c0000

Bad eraseblock 1696 at 0x00000d400000

Bad eraseblock 1715 at 0x00000d660000

Bad eraseblock 1733 at 0x00000d8a0000

Bad eraseblock 1752 at 0x00000db00000

Bad eraseblock 1770 at 0x00000dd40000

Bad eraseblock 1789 at 0x00000dfa0000

Bad eraseblock 1807 at 0x00000e1e0000

Bad eraseblock 1826 at 0x00000e440000

Bad eraseblock 1844 at 0x00000e680000

Bad eraseblock 1848 at 0x00000e700000

Bad eraseblock 1850 at 0x00000e740000

Bad eraseblock 1852 at 0x00000e780000

Bad eraseblock 1854 at 0x00000e7c0000

Bad eraseblock 1856 at 0x00000e800000

Bad eraseblock 1858 at 0x00000e840000

Bad eraseblock 1870 at 0x00000e9c0000

Bad eraseblock 1888 at 0x00000ec00000

Bad eraseblock 1907 at 0x00000ee60000

Bad eraseblock 1925 at 0x00000f0a0000

Bad eraseblock 1944 at 0x00000f300000

Bad eraseblock 1962 at 0x00000f540000

Bad eraseblock 1981 at 0x00000f7a0000

Bad eraseblock 1999 at 0x00000f9e0000

Bad eraseblock 2018 at 0x00000fc40000

Bad eraseblock 2036 at 0x00000fe80000

dm9000 Ethernet Driver, V1.31

TranslateQuoteReplyEditDelete

 

 

2010-09-02 07:24:14     Re: BF512 nand flash 坏块的疑问?

Aaron Wu (CHINA)

Message: 93071   

 

Guess something should be wrong with the parameters lilke pagesize, erase blocksize and total device size, suggest you to debug the code to check the actual value detected for these  parameters to make sure they are correct in mtd.

QuoteReplyEditDelete

 

 

2010-09-02 09:54:01     Re: BF512 nand flash 坏块的疑问?

weixin zhan (CHINA)

Message: 93078   

 

in arch_initcall call method, i declare:

 

 

 

#if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)

#ifdef CONFIG_MTD_PARTITIONS

const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL };

 

static struct mtd_partition bfin_plat_nand_partitions[] = {

{

  .name   = "linux kernel(nand)",

  .size   = 0x400000,

  .offset = 0,

}, {

  .name   = "file system(nand)",

  .size   = MTDPART_SIZ_FULL,

  .offset = MTDPART_OFS_APPEND,

},

};

#endif

 

#define BFIN_NAND_PLAT_CLE 2

#define BFIN_NAND_PLAT_ALE 1

static void bfin_plat_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)

{

struct nand_chip *this = mtd->priv;

 

if (cmd == NAND_CMD_NONE)

  return;

 

if (ctrl & NAND_CLE)

  writeb(cmd, this->IO_ADDR_W + (1 << BFIN_NAND_PLAT_CLE));

else

  writeb(cmd, this->IO_ADDR_W + (1 << BFIN_NAND_PLAT_ALE));

}

 

#define BFIN_NAND_PLAT_READY GPIO_PH5

static int bfin_plat_nand_dev_ready(struct mtd_info *mtd)

{

return gpio_get_value(BFIN_NAND_PLAT_READY);

}

 

static struct platform_nand_data bfin_plat_nand_data = {

.chip = {

  .nr_chips = 1,

  .chip_delay = 30,

#ifdef CONFIG_MTD_PARTITIONS

  .part_probe_types = part_probes,

  .partitions = bfin_plat_nand_partitions,

  .nr_partitions = ARRAY_SIZE(bfin_plat_nand_partitions),

#endif

},

.ctrl = {

  .cmd_ctrl  = bfin_plat_nand_cmd_ctrl,

  .dev_ready = bfin_plat_nand_dev_ready,

},

};

 

#define MAX(x, y) (x > y ? x : y)

static struct resource bfin_plat_nand_resources = {

.start = 0x20000000,

.end   = 0x20000000 + (1 << MAX(BFIN_NAND_PLAT_CLE, BFIN_NAND_PLAT_ALE)),

.flags = IORESOURCE_MEM,

};

 

static struct platform_device bfin_async_nand_device = {

.name = "gen_nand",

.id = -1,

.num_resources = 1,

.resource = &bfin_plat_nand_resources,

.dev = {

  .platform_data = &bfin_plat_nand_data,

},

};

 

static void bfin_plat_nand_init(void)

{

gpio_request(BFIN_NAND_PLAT_READY, "bfin_nand_plat");

}

#else

static void bfin_plat_nand_init(void) {}

#endif

TranslateQuoteReplyEditDelete

 

 

2010-09-22 12:48:25     Re: BF512 nand flash 坏块的疑问?

Jay Ku (UNITED STATES)

Message: 93756   

 

Wei - Did you ever solve this problem?  I'm having a similar problem on a BF537 with a NAND04G (see my other recent post).

 

Aaron - How do I check pagesize?

 

NAND is working fine in u-boot (I can erase/read/write, and u-boot finds just one bad block).

 

Flash specs as recognized by linux look correct:

 

NAND device: Manufacturer ID: 0x20, Chip ID: 0xdc (ST Micro NAND 512MiB 3,3V 8-bit)

 

root:/> cat /proc/mtd

dev:    size   erasesize  name

mtd0: 00800000 00020000 "linux kernel(nand)"

mtd1: 1f800000 00020000 "file system(nand)"

 

But I get a seemingly random list of bad blocks at boot:

 

NAND device: Manufacturer ID: 0x20, Chip ID: 0xdc (ST Micro NAND 512MiB 3,3V 8-bit)

Scanning device for bad blocks

Bad eraseblock 1 at 0x000000020000

Bad eraseblock 3 at 0x000000060000

Bad eraseblock 209 at 0x000001a20000

Bad eraseblock 211 at 0x000001a60000

Bad eraseblock 213 at 0x000001aa0000

...

Bad eraseblock 903 at 0x0000070e0000

Bad eraseblock 905 at 0x000007120000

Bad eraseblock 907 at 0x000007160000

Bad eraseblock 909 at 0x0000071a0000

RedBoot partition parsing not available

Creating 2 MTD partitions on "gen_nand":

0x000000000000-0x000000800000 : "linux kernel(nand)"

mtd: Giving out device 0 to linux kernel(nand)

0x000000800000-0x000020000000 : "file system(nand)"

mtd: Giving out device 1 to file system(nand)

Attachments

    Outcomes