2011-03-08 15:07:38     Adding support for page size 4096 NAND

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

2011-03-08 15:07:38     Adding support for page size 4096 NAND

Timur Aydin (TURKEY)

Message: 98735   

 

Hi,

 

I am working on getting the micron 29F16G08CBABA NAND chip to work with the 2010R1 release. I have added the nand device definition into the arch specific board file, defined the ready signal, ALE CLE and memory base. I have also enabled the platform nand module in the kernel. At first, the NAND was not detected, because its definition was not present in nand_ids.c. I added the definition of this nand. But then the nand_base.c module complained that the device says its 16 bit, but my definition says it is 8 bits. The method that nand_base.c uses to automatically determine the bus width, page size and erase size wasn't working for this NAND. So I directly specified the correct page size, block size etc in nand_ids.c and finally the NAND was detected.

 

I then tried to erase the NAND and this seemed to work (I had cranked up the MTD debug information with a level of 3, the maximum). But then I tried mounting the nand using the jffs2 filesystem, but this generated a lot of errors. I don't have the error strings available at the time, but they were mostly related to ECC calculation.

 

This NAND has 4096 byte pages and there is no other NAND in the kernel with this spec. What else do I need to do to support this NAND? I am kind of suspecting that the ECC calculation module needs heavy modification to support this NAND. I hope this isn't true Can somebody point me at the right direction ?

QuoteReplyEditDelete

 

 

2011-03-08 15:09:27     Re: Adding support for page size 4096 NAND

Timur Aydin (TURKEY)

Message: 98736   

 

This chip is ONFI 2.1 compliant and 2GBytes in size.

QuoteReplyEditDelete

 

 

2011-03-08 15:21:30     Re: Adding support for page size 4096 NAND

Mike Frysinger (UNITED STATES)

Message: 98737   

 

what Blackfin part exactly are you using ?  and how exactly are you connecting the NAND flash to the Blackfin ?

 

please post the full output shown while booting up linux.

QuoteReplyEditDelete

 

 

2011-03-08 15:36:50     Re: Adding support for page size 4096 NAND

Timur Aydin (TURKEY)

Message: 98738   

 

I am using the BF537-0.3 and the method of connection is EBUI using the AMS0 signal. Memory base was set to 0x20000000. I can confirm that the physical interface is working, because this NAND requires a reset command before it will return the proper manufacturer id and device id's. Because I am getting these id's correctly, I can conclude that both read and write to the nand is working.

 

I will post the full boot-up log and the error logs.

QuoteReplyEditDelete

 

 

2011-03-09 06:13:59     Re: Adding support for page size 4096 NAND

Timur Aydin (TURKEY)

Message: 98765   

 

OK, the bootup log is at the end of this message. I have also attached the kernel log while loading the nand-plat driver, while doing a flash erase and while doing the mount.

 

U-Boot 2010.06-00002-ga616884(BCM:2.0-0.0) (Mar 07 2011 - 17:31:42)

 

CPU:   ADSP bf537-0.3 (Detected Rev: 0.3) (spi flash boot)

Board: dB1 NBF board

Clock: VCO: 500 MHz, Core: 500 MHz, System: 125 MHz

RAM:   64 MiB

Flash: 0 Bytes

NAND:  No NAND device found!!!

0 MiB

SF: Detected M25P128 with page size 256, total 16 MiB

In:    serial

Out:   serial

Err:   serial

KGDB:  [on serial] ready

Net:   bfin_mac

Hit any key to stop autoboot:  0

Using bfin_mac device

File transfer via NFS from server 192.168.0.49; our IP address is 192.168.0.47

Filename '/uclinux-dist_2010R1/images/uImage'.

Load address: 0x1000000

Loading: #################################################################

         #################################################################

         #################################################################

         #################################################################

         #################################################################

         ###################################

done

Bytes transferred = 1838637 (1c0e2d hex)

## Booting kernel from Legacy Image at 01000000 ...

   Image Name:   bf537-2.6.34.7-ADI-2010R1-gec0cd

   Created:      2011-03-08  15:43:20 UTC

   Image Type:   Blackfin Linux Kernel Image (gzip compressed)

   Data Size:    1838573 Bytes = 1.8 MiB

   Load Address: 00001000

   Entry Point:  001ec97c

   Verifying Checksum ... OK

   Uncompressing Kernel Image ... OK

Starting Kernel at = 001ec97c

Linux version 2.6.34.7-ADI-2010R1-gec0cd06-dirty (tayd@bayazit) (gcc version 4.3.5 (ADI-2010R1/git-0ac2b26) ) #40 Tue Mar 8 17:43:08 EET 201

register early platform devices

bootconsole [early_shadow0] enabled

bootconsole [early_BFuart0] enabled

early printk enabled on early_BFuart0

Board Memory: 64MB

Kernel Managed Memory: 64MB

Memory map:

  fixedcode = 0x00000400-0x00000490

  text      = 0x00001000-0x00134738

  rodata    = 0x00134738-0x0019ea60

  bss       = 0x0019f000-0x001cfc30

  data      = 0x001cfc30-0x001e2000

    stack   = 0x001e0000-0x001e2000

  init      = 0x001e2000-0x00392000

  available = 0x00392000-0x03f00000

  DMA Zone  = 0x03f00000-0x04000000

Hardware Trace Active and Enabled

Boot Mode: 3

Blackfin support (C) 2004-2010 Analog Devices, Inc.

Compiled for ADSP-BF537 Rev 0.3

Blackfin Linux support by   blackfin.uclinux.org/

Processor Speed: 600 MHz core clock and 120 MHz System Clock

NOMPU: setting up cplb tables

Instruction Cache Enabled for CPU0

  External memory: cacheable in instruction cache

Data Cache Enabled for CPU0

  External memory: cacheable (write-back) in data cache

Built 1 zonelists in Zone order, mobility grouping off.  Total pages: 16002

Kernel command line: root=/dev/mtdblock0 rw clkin_hz=25000000 earlyprintk=serial,uart0,57600 console=ttyBF0,57600

PID hash table entries: 256 (order: -2, 1024 bytes)

Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)

Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)

Memory available: 60288k/65536k RAM, (1728k init code, 1229k kernel code, 695k data, 1024k dma, 572k reserved)

Hierarchical RCU implementation.

NR_IRQS:138

Configuring Blackfin Priority Driven Interrupts

console [ttyBF0] enabled, bootconsole disabled

console [ttyBF0] enabled, bootconsole disabled

Calibrating delay loop... 1196.03 BogoMIPS (lpj=5980160)

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: 48 KB (36 KB free)

NET: Registered protocol family 16

Blackfin DMA Controller

db1nbf_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

Switching to clocksource bfin_cs_cycles

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

RPC: Registered udp transport module.

RPC: Registered tcp transport module.

RPC: Registered tcp NFSv4.1 backchannel transport module.

JFFS2 version 2.2. (NAND) þþ 2001-2006 Red Hat, Inc.

msgmni has been set to 117

io scheduler noop registered

io scheduler cfq registered (default)

bfin-uart: Blackfin serial driver

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

m25p80 spi0.1: found m25p128, expected m25p80

m25p80 spi0.1: m25p128 (16384 Kbytes)

mtd .name = m25p80, .size = 0x1000000 (16MiB) .erasesize = 0x00040000 (256KiB) .numeraseregions = 0

partitions[0] = {.name = eeprom, .offset = 0x0, .size = 0x1000000 (16384KiB) }

partitions[1] = {.name = btldr, .offset = 0x0, .size = 0x80000 (512KiB) }

partitions[2] = {.name = uclinux, .offset = 0x80000, .size = 0x400000 (4096KiB) }

partitions[3] = {.name = apps, .offset = 0x480000, .size = 0xa40000 (10496KiB) }

partitions[4] = {.name = cfg, .offset = 0xec0000, .size = 0x140000 (1280KiB) }

Creating 5 MTD partitions on "m25p80":

0x000000000000-0x000001000000 : "eeprom"

mtd: Giving out device 0 to eeprom

0x000000000000-0x000000080000 : "btldr"

mtd: Giving out device 1 to btldr

0x000000080000-0x000000480000 : "uclinux"

mtd: Giving out device 2 to uclinux

0x000000480000-0x000000ec0000 : "apps"

mtd: Giving out device 3 to apps

0x000000ec0000-0x000001000000 : "cfg"

mtd: Giving out device 4 to cfg

m25p80 spi0.4: found m25p128, expected m25p80

m25p80 spi0.4: m25p128 (16384 Kbytes)

mtd .name = m25p80, .size = 0x1000000 (16MiB) .erasesize = 0x00040000 (256KiB) .numeraseregions = 0

partitions[0] = {.name = eeprom, .offset = 0x0, .size = 0x1000000 (16384KiB) }

partitions[1] = {.name = btldr, .offset = 0x0, .size = 0x80000 (512KiB) }

partitions[2] = {.name = uclinux, .offset = 0x80000, .size = 0x400000 (4096KiB) }

partitions[3] = {.name = apps, .offset = 0x480000, .size = 0xa40000 (10496KiB) }

partitions[4] = {.name = cfg, .offset = 0xec0000, .size = 0x140000 (1280KiB) }

Creating 5 MTD partitions on "m25p80":

0x000000000000-0x000001000000 : "eeprom"

mtd: Giving out device 5 to eeprom

0x000000000000-0x000000080000 : "btldr"

mtd: Giving out device 6 to btldr

0x000000080000-0x000000480000 : "uclinux"

mtd: Giving out device 7 to uclinux

0x000000480000-0x000000ec0000 : "apps"

mtd: Giving out device 8 to apps

0x000000ec0000-0x000001000000 : "cfg"

mtd: Giving out device 9 to cfg

rtc-bfin rtc-bfin: rtc core: registered rtc-bfin as rtc0

TCP cubic registered

NET: Registered protocol family 17

rtc-bfin rtc-bfin: setting system clock to 2011-03-09 10:57:51 UTC (1299668271)

dma_alloc_init: dma_page @ 0x0240f000 - 256 pages at 0x03f00000

Freeing unused kernel memory: 1728k freed

nbf_mac_addr = 00:24:d9:00:01:31

/bin/netconfig: bringing network interfaces down

/bin/netconfig: killing DHCP client daemon

killall: dhcpcd: no process killed

/bin/netconfig: deleting existing default gateways

/bin/netconfig: configuring network to use DHCP

eth0      Link encap:Ethernet  HWaddr 00:24:D9:00:01:31

/bin/netconfig: done.

mpsock: command = (verbose)

mpsock: command complete

mpsock: command = (wait_daemon_ready)

THIELnet Daemon v1.49-0.0 HOMENET v2.1-0.0

mpsock: command complete

/bin/mpwatch: entering main loop...

/bin/dlfile: url = (  update.bicom-inc.com/files/firmware/internal/update.ini)

/bin/dlfile: out = (/var/update/update.ini)

/bin/run_wget: url = (  update.bicom-inc.com/files/firmware/internal/update.ini)

/bin/run_wget: out = (/var/update/update.ini)

ln: /usr/web/html/root/: File exists

--2011-03-09 12:58:02--    update.bicom-inc.com/files/firmware/internal/update.ini

Resolving update.bicom-inc.com... root:/# 96.39.12.171

Connecting to update.bicom-inc.com|96.39.12.171|:80... connected.

HTTP request sent, awaiting response... 200 OK

Length: 8280 (8.1K) [text/plain]

Saving to: `/var/update/update.ini'

 

100%[=======================================>] 8,280       37.0K/s   in 0.2s 

 

2011-03-09 12:58:03 (37.0 KB/s) - `/var/update/update.ini' saved [8280/8280]

 

/bin/run_wget: done.

/bin/run_wget: url = (  update.bicom-inc.com/files/firmware/internal/update.ini.md5)

/bin/run_wget: out = (/var/update/update.ini.md5)

--2011-03-09 12:58:03--    update.bicom-inc.com/files/firmware/internal/update.ini.md5

Resolving update.bicom-inc.com... 96.39.12.171

Connecting to update.bicom-inc.com|96.39.12.171|:80... connected.

HTTP request sent, awaiting response... 200 OK

Length: 33 [text/plain]

Saving to: `/var/update/update.ini.md5'

 

100%[=======================================>] 33          --.-K/s   in 0s   

 

2011-03-09 12:58:03 (161 KB/s) - `/var/update/update.ini.md5' saved [33/33]

 

/bin/run_wget: done.

/bin/dlfile: calculating md5sum...

/bin/dlfile: md5_retrieved = (bb6e343bc006381e17cfdd2ae310c9fc)

/bin/dlfile: md5_calculated = (bb6e343bc006381e17cfdd2ae310c9fc)

/bin/dlfile: md5 sums match, done.

mpsock: command = (verbose)

mpsock: command complete

mpsock: command = (wait_mplayer_ready)

MPlayer dev-SVN-rUNKNOWN-4.3.5 (C) 2000-2007 MPlayer Team

Creating config file: //.mplayer/config

117 audio & 238 video codecs

using udp socket for messages

message socket bound to port 10711

mpsock: command complete

mpsock: command = (verbose)

mpsock: command complete

mpsock: command = (wait_mplayer_ready)

MPlayer dev-SVN-rUNKNOWN-4.3.5 (C) 2000-2007 MPlayer Team

117 audio & 238 video codecs

using udp socket for messages

message socket bound to port 10712

mpsock: command complete

 

kernellog.zip

QuoteReplyEditDelete

 

 

2011-03-09 06:59:14     Re: Adding support for page size 4096 NAND

Timur Aydin (TURKEY)

Message: 98767   

 

Here are the changes I made to the kernel so far:

 

diff --git a/arch/blackfin/mach-bf537/boards/db1nbf.c b/arch/blackfin/mach-bf537/boards/db1nbf.c

index a48142f..1a47d69 100644

--- a/arch/blackfin/mach-bf537/boards/db1nbf.c

+++ b/arch/blackfin/mach-bf537/boards/db1nbf.c

@@ -80,13 +80,9 @@ 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)",

+        .name   = "nanddisk",

         .size   = MTDPART_SIZ_FULL,

-        .offset = MTDPART_OFS_APPEND,

+        .offset = 0,

     },

};

#endif

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c

index 8f2958f..8276f20 100644

--- a/drivers/mtd/nand/nand_base.c

+++ b/drivers/mtd/nand/nand_base.c

@@ -2617,6 +2617,9 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,

     tmp_manf = chip->read_byte(mtd);

     tmp_id = chip->read_byte(mtd);

 

+        printk(KERN_INFO "%s: tmp_manf = 0x%x, tmp_id = 0x%x\n",

+               __func__, tmp_manf, tmp_id);

+

     if (tmp_manf != *maf_id || tmp_id != dev_id) {

         printk(KERN_INFO "%s: second ID read did not match "

                "%02x,%02x against %02x,%02x\n", __func__,

@@ -2647,6 +2650,10 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,

         chip->cellinfo = chip->read_byte(mtd);

         /* The 4th id byte is the important one */

         extid = chip->read_byte(mtd);

+

+                printk(KERN_INFO "%s: extid = 0x%x\n",

+                       __func__, extid);

+

         /* Calc pagesize */

         mtd->writesize = 1024 << (extid & 0x3);

         extid >>= 2;

@@ -2659,6 +2666,9 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,

         /* Get buswidth information */

         busw = (extid & 0x01) ? NAND_BUSWIDTH_16 : 0;

 

+                printk(KERN_INFO

+                       "%s: writesize = 0x%x, oobsize = 0x%x, erasesize = 0x%x, busw = 0x%x\n",

+                       __func__, mtd->writesize, mtd->oobsize, mtd->erasesize, busw);

     } else {

         /*

          * Old devices have chip data hardcoded in the device id table

diff --git a/drivers/mtd/nand/nand_ids.c b/drivers/mtd/nand/nand_ids.c

index 69ee2c9..959b5d7 100644

--- a/drivers/mtd/nand/nand_ids.c

+++ b/drivers/mtd/nand/nand_ids.c

@@ -109,6 +109,9 @@ struct nand_flash_dev nand_flash_ids[] = {

     {"NAND 2GiB 1,8V 16-bit",    0xB5, 0, 2048, 0, LP_OPTIONS16},

     {"NAND 2GiB 3,3V 16-bit",    0xC5, 0, 2048, 0, LP_OPTIONS16},

 

+    /* 16 Gigabit (page size 4096) */

+    {"NAND 2GiB 3,3V 8-bit",    0x48, 4096, 2048, 0x100000, LP_OPTIONS},

+

     /*

      * Renesas AND 1 Gigabit. Those chips do not support extended id and

      * have a strange page/block layout !  The chosen minimum erasesize is

QuoteReplyEditDelete

 

 

2011-03-09 16:20:03     Re: Adding support for page size 4096 NAND

Mike Frysinger (UNITED STATES)

Message: 98797   

 

i guess you're focusing on this:

<3>uncorrectable error :

<4>mtd->read(0x400 bytes from 0xc00000) returned ECC error

<5>jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00c00000: 0x2020 instead

 

rather than jumping into the jffs2 aspects, forget about that for now.  install the basic nanddump and nandwrite utilities.  since you havent set up the driver in u-boot, you'll have to focus on the kernel.

 

simply read/write a few blocks with those utils on raw mtd device.  make sure that works correctly.

 

if that doesnt even work, then double check the async timings in the kernel.  make sure they are not too fast for the hardware.  or even better, slow down the timings all the way and make sure just that is stable.

QuoteReplyEditDelete

 

 

2011-03-15 12:54:16     Re: Adding support for page size 4096 NAND

Timur Aydin (TURKEY)

Message: 98948   

 

Hello Mike, thanks for all the information...

 

I have added my NAND's id into the nand_id.c of the uboot and started testing the nand using u-boot. Indeed, u-boot is a better environment to bring up the nand.

 

Once I added the NAND id, u-boot detected the nand correctly:

 

------------------------------------------------------------------------------------------

 

U-Boot 2010.06-dirty(BCM:2.0-0.0) (Mar 15 2011 - 18:36:33)

 

CPU:   ADSP bf537-0.3 (Detected Rev: 0.3) (spi flash boot)

Board: dB1 NBF board

Clock: VCO: 500 MHz, Core: 500 MHz, System: 125 MHz

RAM:   64 MiB

Flash: 0 Bytes

NAND:  2048 MiB

SF: Detected M25P128 with page size 256, total 16 MiB

*** Warning - bad CRC, using default environment

 

In:    serial

Out:   serial

Err:   serial

KGDB:  [on serial] ready

Net:   bfin_mac

------------------------------------------------------------------------------------------

 

Here is the result of further tests:

 

------------------------------------------------------------------------------------------

 

bfin> nand info

 

Device 0: NAND 2GiB 3,3V 8-bit, sector size 1024 KiB

 

 

bfin> nand device

 

Device 0: NAND 2GiB 3,3V 8-bit, sector size 1024 KiB

 

 

bfin> nand read $(loadaddr) 0 100

 

NAND read: device 0 offset 0x0, size 0x100

256 bytes read: OK

bfin> md.b $(loadaddr)

01000000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

01000010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

01000020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

01000030: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

bfin>

 

 

bfin> nand write 0 0 10000

 

NAND write: device 0 offset 0x0, size 0x10000

65536 bytes written: OK

bfin>

 

 

bfin> nand read $(loadaddr) 0 10000

 

NAND read: device 0 offset 0x0, size 0x10000

NAND read from offset 0 failed -74

----------------------------------------------------------------------------

QuoteReplyEditDelete

 

 

2011-03-15 12:57:36     Re: Adding support for page size 4096 NAND

Timur Aydin (TURKEY)

Message: 98949   

 

So the write looks like it succeeded, but the read is failling.

 

I have also tried erasing the nand, and that worked without an error

 

bfin> nand erase

 

NAND erase: device 0 whole chip

Erasing at 0x7ff00000 -- 100% complete.

OK

bfin>

 

 

But this seems a little suspicious:

 

bfin> nand bad

 

Device 0 bad blocks:

bfin>

 

 

There are no bad block, but there should be at least a dozen or two bad block based on my experience with previous generations of nand from the same vendor (Micron)

QuoteReplyEditDelete

 

 

2011-03-15 13:02:37     Re: Adding support for page size 4096 NAND

Timur Aydin (TURKEY)

Message: 98950   

 

When I do a "nand dump 0", the entire page and the OOB area is filled with FF, which is good I suppose.

 

Here is another write test:

 

 

 

bfin> mw.b $(loadaddr) 55 100000

bfin> md.b $(loadaddr)

01000000: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55    UUUUUUUUUUUUUUUU

01000010: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55    UUUUUUUUUUUUUUUU

01000020: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55    UUUUUUUUUUUUUUUU

01000030: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55    UUUUUUUUUUUUUUUU

bfin> nand write $(loadaddr) 0 100000

 

NAND write: device 0 offset 0x0, size 0x100000

1048576 bytes written: OK

bfin> nand dump 0

Page 00000000 dump:

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

        55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55

OOB:

        ff ff ff ff ff ff ff ff

        ff ff ff ff ff ff ff ff

        ff ff ff ff ff ff ff ff

        ff ff ff ff ff ff ff ff

        ff ff ff ff ff ff ff ff

        ff ff ff ff ff ff ff ff

        ff ff ff ff ff ff ff ff

        ff ff ff ff ff ff ff ff

        ff ff ff ff ff ff ff ff

        ff ff ff ff ff ff ff ff

        ff ff ff ff ff ff ff ff

        ff ff ff ff ff ff ff ff

        ff ff ff ff ff ff ff ff

        ff ff ff ff ff ff ff ff

        ff ff ff ff ff ff ff ff

        ff ff ff ff ff ff ff ff

bfin>

QuoteReplyEditDelete

 

 

2011-03-15 13:06:35     Re: Adding support for page size 4096 NAND

Timur Aydin (TURKEY)

Message: 98951   

 

After this, I have power cycled the card:

 

bfin> md.b $(loadaddr)

01000000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

01000010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

01000020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

01000030: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

bfin> nand read $(loadaddr) 0 100000

 

NAND read: device 0 offset 0x0, size 0x100000

1048576 bytes read: OK

bfin> md.b $(loadaddr)

01000000: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55    UUUUUUUUUUUUUUUU

01000010: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55    UUUUUUUUUUUUUUUU

01000020: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55    UUUUUUUUUUUUUUUU

01000030: 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55 55    UUUUUUUUUUUUUUUU

 

 

So this looks good.

 

Is it possible that during my previous experiments under linux, I have wiped out the bad block table? In one experiment under linux, I had set the eraseblock size incorrectly, would that hurt the bad block table?

QuoteReplyEditDelete

 

 

2011-03-15 17:29:25     Re: Adding support for page size 4096 NAND

Mike Frysinger (UNITED STATES)

Message: 98952   

 

there is no place in the hardware that is dedicated to a bad block table.  how someone chooses to allocate space for that is an end customer decision.

 

as for how the manuf communicates bad blocks when the part comes out of the factory, you'd have to ask that vendor and/or consult the datasheet.  some will mark the block bad via that block's OOB data.

 

messing with the erase size and erasing random pages shouldnt really affect that i dont think.  the OOB info is calculated separately.

 

so the simplest method is that there is no bad block table anywhere in flash.  if a block is bad, the OOB page for that block will mark it as such.  then at runtime, the whole nand will be scanned to create a bad block table in RAM.  as soon as you reboot, that table is lost and needs to be recreated from scratch.

 

Linux and u-boot should largely act the same since the MTD/NAND code in u-boot is copied straight from Linux.

QuoteReplyEditDelete

 

 

2011-03-15 17:31:14     Re: Adding support for page size 4096 NAND

Mike Frysinger (UNITED STATES)

Message: 98953   

 

you'd have to enable debugging in the MTD layer to find out where that -74 is coming from (i guess that's -EBADMSG ?)

 

but again, you should double check your async timings in u-boot to make sure they arent too fast for the part and/or the board layout.  CONFIG_EBIU_AMBCTL{0,1}_VAL in your board's config header.

QuoteReplyEditDelete

Attachments

    Outcomes