Patchwork at91: Status of NAND flash access

login
register
mail settings
Submitter Wu, Josh
Date Dec. 5, 2012, 6:59 a.m.
Message ID <50BEF0C0.7060807@atmel.com>
Download mbox | patch
Permalink /patch/203795/
State New
Headers show

Comments

Wu, Josh - Dec. 5, 2012, 6:59 a.m.
On 12/5/2012 12:24 AM, Bryan Evenson wrote:
>> -----Original Message-----
>> From: Josh Wu [mailto:josh.wu@atmel.com]
>> Sent: Tuesday, December 04, 2012 5:54 AM
>> To: Bryan Evenson
>> Cc: linux-arm-kernel@lists.infradead.org
>> Subject: Re: at91: Status of NAND flash access
>>
>> Hi, Bryan
>>
>> On 12/3/2012 10:39 PM, Bryan Evenson wrote:
>>> I have a kernel build of 3.7-rc5 that is built for the AT91SAM9G25.
>> The kernel has issues when it tries to read the filesystem from NAND
>> flash.  If I change to an NFS setup then the filesystem loads.
>> According to your question, it is not very clear to me, so could you
>> give more detail then I can help.
>>
>> What type (ubi, jffs2, or others) of your filesystem is used? How do
>> you flush the file system into the nand flash, by SAM-BA, or U-Boot?
>> With or without pmecc?
>> And what ecc type (pmecc, soft, none) do you enabled in the kernel?
>>
> I have a UBI filesystem, built using OE (2011.03-maintenance branch).
> I've been burning the filesystem to flash using SAM-BA, following the
> instructions on the Atmel Linux4SAM site (on this page here: http://www.at91.com/linux4sam/bin/view/Linux4SAM/FlashRootFs_9x5).

I checked the website, so your filesystem enable the PMECC with 2bits 
error bits.

>
> Here are all my MTD and filesystem related flags I have enabled in my
> kernel configuration.  If you see any missing that I should have set
> for UBI access of NAND flash, please let me know.
In your defconfig, the UBI filesystem is included.
>
> Also note that I am using the instructions found here to build this
> kernel: http://www.eewiki.net/display/linuxonarm/AT91SAM9x5, which
> means I am using the kernel extracted from the listed fork with the
> listed patches applied.
>
> #
> # Bus devices
> #
> CONFIG_MTD=y
> CONFIG_MTD_CMDLINE_PARTS=y
> CONFIG_MTD_OF_PARTS=y
>
> #
> # User Modules And Translation Layers
> #
> CONFIG_MTD_CHAR=y
> CONFIG_MTD_BLKDEVS=y
> CONFIG_MTD_BLOCK=y
>
> #
> # RAM/ROM/Flash chip drivers
> #
> CONFIG_MTD_MAP_BANK_WIDTH_1=y
> CONFIG_MTD_MAP_BANK_WIDTH_2=y
> CONFIG_MTD_MAP_BANK_WIDTH_4=y
> CONFIG_MTD_CFI_I1=y
> CONFIG_MTD_CFI_I2=y
>
> #
> # Disk-On-Chip Device Drivers
> #
> CONFIG_MTD_NAND_ECC=y
> CONFIG_MTD_NAND=y
> CONFIG_MTD_NAND_IDS=y
> CONFIG_MTD_NAND_ATMEL=y
>
> #
> # LPDDR flash memory drivers
> #
> CONFIG_MTD_UBI=y
> CONFIG_MTD_UBI_WL_THRESHOLD=4096
> CONFIG_MTD_UBI_BEB_LIMIT=20
> CONFIG_MTD_UBI_GLUEBI=y
> CONFIG_DTC=y
> CONFIG_OF=y
>
> #
> # Device Tree and Open Firmware support
> #
> CONFIG_PROC_DEVICETREE=y
> CONFIG_OF_FLATTREE=y
> CONFIG_OF_EARLY_FLATTREE=y
> CONFIG_OF_ADDRESS=y
> CONFIG_OF_IRQ=y
> CONFIG_OF_DEVICE=y
> CONFIG_OF_I2C=y
> CONFIG_OF_NET=y
> CONFIG_OF_MDIO=y
> CONFIG_OF_MTD=y
> CONFIG_BLK_DEV=y
> CONFIG_BLK_DEV_LOOP=y
> CONFIG_BLK_DEV_LOOP_MIN_COUNT=8
>
> #
> # File systems
> #
> CONFIG_EXT2_FS=y
> CONFIG_EXT2_FS_XATTR=y
> CONFIG_EXT2_FS_POSIX_ACL=y
> CONFIG_EXT2_FS_SECURITY=y
> CONFIG_EXT3_FS=y
> CONFIG_EXT3_DEFAULTS_TO_ORDERED=y
> CONFIG_EXT3_FS_XATTR=y
> CONFIG_EXT3_FS_POSIX_ACL=y
> CONFIG_EXT3_FS_SECURITY=y
> CONFIG_EXT4_FS=y
> CONFIG_EXT4_FS_XATTR=y
> CONFIG_EXT4_FS_POSIX_ACL=y
> CONFIG_EXT4_FS_SECURITY=y
> CONFIG_JBD=y
> CONFIG_JBD2=y
> CONFIG_FS_MBCACHE=y
> CONFIG_FS_POSIX_ACL=y
> CONFIG_FILE_LOCKING=y
> CONFIG_FSNOTIFY=y
> CONFIG_DNOTIFY=y
> CONFIG_INOTIFY_USER=y
> CONFIG_FANOTIFY=y
> CONFIG_GENERIC_ACL=y
>
> #
> # Pseudo filesystems
> #
> CONFIG_PROC_FS=y
> CONFIG_PROC_SYSCTL=y
> CONFIG_PROC_PAGE_MONITOR=y
> CONFIG_SYSFS=y
> CONFIG_TMPFS=y
> CONFIG_TMPFS_POSIX_ACL=y
> CONFIG_TMPFS_XATTR=y
> CONFIG_MISC_FILESYSTEMS=y
> CONFIG_JFFS2_FS=y
> CONFIG_JFFS2_FS_DEBUG=0
> CONFIG_JFFS2_FS_WRITEBUFFER=y
> CONFIG_JFFS2_ZLIB=y
> CONFIG_JFFS2_RTIME=y
> CONFIG_UBIFS_FS=y
> CONFIG_UBIFS_FS_ADVANCED_COMPR=y
> CONFIG_UBIFS_FS_LZO=y
> CONFIG_UBIFS_FS_ZLIB=y
> CONFIG_NETWORK_FILESYSTEMS=y
> CONFIG_NFS_FS=y
> CONFIG_NFS_V2=y
> CONFIG_NFS_V3=y
> CONFIG_NFS_V3_ACL=y
> CONFIG_NFS_V4=y
> CONFIG_ROOT_NFS=y
> CONFIG_NFS_USE_KERNEL_DNS=y
> CONFIG_LOCKD=y
> CONFIG_LOCKD_V4=y
> CONFIG_NFS_ACL_SUPPORT=y
> CONFIG_NFS_COMMON=y
> CONFIG_SUNRPC=y
> CONFIG_SUNRPC_GSS=y
> CONFIG_NLS=y
> CONFIG_NLS_DEFAULT="iso8859-1"
> CONFIG_NLS_CODEPAGE_437=y
> CONFIG_NLS_CODEPAGE_850=y
> CONFIG_NLS_ISO8859_1=y
>
>>> I've seen some patches on this list lately related to AT91 NAND flash
>> (specifically this thread: http://lists.infradead.org/pipermail/linux-
>> arm-kernel/2012-November/133748.html) and I believe my problems may be
>> related to this issue.  But, I'm having trouble following the thread to
>> find the current status.
>>> Can anyone tell me what the status is on NAND flash access for the
>> AT91 series with the 3.7-rc5 kernel?  If this version has a known bug,
>> is there a different suggested version I use that fixes the issue?
>> In 3.7-rc5, I think the atmel nand driver should work well with
>> AT91SAM9G25EK board even without the patch you mentioned in above URL.
>>
>> Just for PMECC, you need add following code in
>> arch/arm/boot/dts/at91sam9x5cm.dtsi:
>> -                        nand-ecc-mode = "soft";
>> +                       nand-ecc-mode = "hw";
>> +                        atmel,has-pmecc;        /* Enable PMECC */
>> +                        atmel,pmecc-cap = <2>;    /* PMECC error
>> bits*/
>> +                        atmel,pmecc-sector-size = <512>;  /* sector
>> size for PMECC, it is not page size */
>>
>> Also you can check the readme file in:
>> Documentation/devicetree/bindings/mtd/atmel-nand.txt
>>
> I did not have the NAND flash setup correctly in the dtsi.  I applied the patch
> that you provided, rebuilt and reloaded my kernel.  Unfortunately, the filesystem
> is still not being read from flash correctly.  It looks like the kernel
> correctly identifies the NAND flash and sets up the partitions, but has problems
> when it attempts to read out the filesystem.  Here is the kernel boot output.
> Do you see anything that tells you what may be going wrong?


[    1.226562] UBI: attaching mtd1 to ubi0
[    1.230468] uncorrectable error :

^^^^^^^^^^^^
After checking the log, it shows the nand driver use the soft ecc. So 
the pmecc is not enable yet.

Checking the 3.7-rc7, I found the patch I gave to you is not complete 
for pmecc enable, here is the whole patch to enable PMECC in dtsi.
Please apply it and give me the feedback. Sorry for the missing of the 
part of at91sam9x5.dtsi.
Bryan Evenson - Dec. 5, 2012, 2:15 p.m.
Josh,

Yes, that worked!  I have to still need change a few device tree settings to use the peripherals I want to use (certain USARTs, RTC, WDT, ADC) but my system now completely boots.  Thanks for the help.

I have a thread on the Atmel forum related to this issue.  I will be updating that in the next day or so with some more detailed information.

Thanks again,
Bryan

> -----Original Message-----

> From: Josh Wu [mailto:josh.wu@atmel.com]

> Sent: Wednesday, December 05, 2012 1:59 AM

> To: Bryan Evenson

> Cc: linux-arm-kernel@lists.infradead.org

> Subject: Re: at91: Status of NAND flash access

>

> On 12/5/2012 12:24 AM, Bryan Evenson wrote:

> >> -----Original Message-----

> >> From: Josh Wu [mailto:josh.wu@atmel.com]

> >> Sent: Tuesday, December 04, 2012 5:54 AM

> >> To: Bryan Evenson

> >> Cc: linux-arm-kernel@lists.infradead.org

> >> Subject: Re: at91: Status of NAND flash access

> >>

> >> Hi, Bryan

> >>

> >> On 12/3/2012 10:39 PM, Bryan Evenson wrote:

> >>> I have a kernel build of 3.7-rc5 that is built for the AT91SAM9G25.

> >> The kernel has issues when it tries to read the filesystem from NAND

> >> flash.  If I change to an NFS setup then the filesystem loads.

> >> According to your question, it is not very clear to me, so could you

> >> give more detail then I can help.

> >>

> >> What type (ubi, jffs2, or others) of your filesystem is used? How do

> >> you flush the file system into the nand flash, by SAM-BA, or U-Boot?

> >> With or without pmecc?

> >> And what ecc type (pmecc, soft, none) do you enabled in the kernel?

> >>

> > I have a UBI filesystem, built using OE (2011.03-maintenance branch).

> > I've been burning the filesystem to flash using SAM-BA, following the

> > instructions on the Atmel Linux4SAM site (on this page here:

> http://www.at91.com/linux4sam/bin/view/Linux4SAM/FlashRootFs_9x5).

>

> I checked the website, so your filesystem enable the PMECC with 2bits

> error bits.

>

> >

> > Here are all my MTD and filesystem related flags I have enabled in my

> > kernel configuration.  If you see any missing that I should have set

> > for UBI access of NAND flash, please let me know.

> In your defconfig, the UBI filesystem is included.

> >

> > Also note that I am using the instructions found here to build this

> > kernel: http://www.eewiki.net/display/linuxonarm/AT91SAM9x5, which

> > means I am using the kernel extracted from the listed fork with the

> > listed patches applied.

> >

> > #

> > # Bus devices

> > #

> > CONFIG_MTD=y

> > CONFIG_MTD_CMDLINE_PARTS=y

> > CONFIG_MTD_OF_PARTS=y

> >

> > #

> > # User Modules And Translation Layers

> > #

> > CONFIG_MTD_CHAR=y

> > CONFIG_MTD_BLKDEVS=y

> > CONFIG_MTD_BLOCK=y

> >

> > #

> > # RAM/ROM/Flash chip drivers

> > #

> > CONFIG_MTD_MAP_BANK_WIDTH_1=y

> > CONFIG_MTD_MAP_BANK_WIDTH_2=y

> > CONFIG_MTD_MAP_BANK_WIDTH_4=y

> > CONFIG_MTD_CFI_I1=y

> > CONFIG_MTD_CFI_I2=y

> >

> > #

> > # Disk-On-Chip Device Drivers

> > #

> > CONFIG_MTD_NAND_ECC=y

> > CONFIG_MTD_NAND=y

> > CONFIG_MTD_NAND_IDS=y

> > CONFIG_MTD_NAND_ATMEL=y

> >

> > #

> > # LPDDR flash memory drivers

> > #

> > CONFIG_MTD_UBI=y

> > CONFIG_MTD_UBI_WL_THRESHOLD=4096

> > CONFIG_MTD_UBI_BEB_LIMIT=20

> > CONFIG_MTD_UBI_GLUEBI=y

> > CONFIG_DTC=y

> > CONFIG_OF=y

> >

> > #

> > # Device Tree and Open Firmware support # CONFIG_PROC_DEVICETREE=y

> > CONFIG_OF_FLATTREE=y CONFIG_OF_EARLY_FLATTREE=y CONFIG_OF_ADDRESS=y

> > CONFIG_OF_IRQ=y CONFIG_OF_DEVICE=y CONFIG_OF_I2C=y CONFIG_OF_NET=y

> > CONFIG_OF_MDIO=y CONFIG_OF_MTD=y CONFIG_BLK_DEV=y

> > CONFIG_BLK_DEV_LOOP=y

> > CONFIG_BLK_DEV_LOOP_MIN_COUNT=8

> >

> > #

> > # File systems

> > #

> > CONFIG_EXT2_FS=y

> > CONFIG_EXT2_FS_XATTR=y

> > CONFIG_EXT2_FS_POSIX_ACL=y

> > CONFIG_EXT2_FS_SECURITY=y

> > CONFIG_EXT3_FS=y

> > CONFIG_EXT3_DEFAULTS_TO_ORDERED=y

> > CONFIG_EXT3_FS_XATTR=y

> > CONFIG_EXT3_FS_POSIX_ACL=y

> > CONFIG_EXT3_FS_SECURITY=y

> > CONFIG_EXT4_FS=y

> > CONFIG_EXT4_FS_XATTR=y

> > CONFIG_EXT4_FS_POSIX_ACL=y

> > CONFIG_EXT4_FS_SECURITY=y

> > CONFIG_JBD=y

> > CONFIG_JBD2=y

> > CONFIG_FS_MBCACHE=y

> > CONFIG_FS_POSIX_ACL=y

> > CONFIG_FILE_LOCKING=y

> > CONFIG_FSNOTIFY=y

> > CONFIG_DNOTIFY=y

> > CONFIG_INOTIFY_USER=y

> > CONFIG_FANOTIFY=y

> > CONFIG_GENERIC_ACL=y

> >

> > #

> > # Pseudo filesystems

> > #

> > CONFIG_PROC_FS=y

> > CONFIG_PROC_SYSCTL=y

> > CONFIG_PROC_PAGE_MONITOR=y

> > CONFIG_SYSFS=y

> > CONFIG_TMPFS=y

> > CONFIG_TMPFS_POSIX_ACL=y

> > CONFIG_TMPFS_XATTR=y

> > CONFIG_MISC_FILESYSTEMS=y

> > CONFIG_JFFS2_FS=y

> > CONFIG_JFFS2_FS_DEBUG=0

> > CONFIG_JFFS2_FS_WRITEBUFFER=y

> > CONFIG_JFFS2_ZLIB=y

> > CONFIG_JFFS2_RTIME=y

> > CONFIG_UBIFS_FS=y

> > CONFIG_UBIFS_FS_ADVANCED_COMPR=y

> > CONFIG_UBIFS_FS_LZO=y

> > CONFIG_UBIFS_FS_ZLIB=y

> > CONFIG_NETWORK_FILESYSTEMS=y

> > CONFIG_NFS_FS=y

> > CONFIG_NFS_V2=y

> > CONFIG_NFS_V3=y

> > CONFIG_NFS_V3_ACL=y

> > CONFIG_NFS_V4=y

> > CONFIG_ROOT_NFS=y

> > CONFIG_NFS_USE_KERNEL_DNS=y

> > CONFIG_LOCKD=y

> > CONFIG_LOCKD_V4=y

> > CONFIG_NFS_ACL_SUPPORT=y

> > CONFIG_NFS_COMMON=y

> > CONFIG_SUNRPC=y

> > CONFIG_SUNRPC_GSS=y

> > CONFIG_NLS=y

> > CONFIG_NLS_DEFAULT="iso8859-1"

> > CONFIG_NLS_CODEPAGE_437=y

> > CONFIG_NLS_CODEPAGE_850=y

> > CONFIG_NLS_ISO8859_1=y

> >

> >>> I've seen some patches on this list lately related to AT91 NAND

> >>> flash

> >> (specifically this thread:

> >> http://lists.infradead.org/pipermail/linux-

> >> arm-kernel/2012-November/133748.html) and I believe my problems may

> >> be related to this issue.  But, I'm having trouble following the

> >> thread to find the current status.

> >>> Can anyone tell me what the status is on NAND flash access for the

> >> AT91 series with the 3.7-rc5 kernel?  If this version has a known

> >> bug, is there a different suggested version I use that fixes the

> issue?

> >> In 3.7-rc5, I think the atmel nand driver should work well with

> >> AT91SAM9G25EK board even without the patch you mentioned in above

> URL.

> >>

> >> Just for PMECC, you need add following code in

> >> arch/arm/boot/dts/at91sam9x5cm.dtsi:

> >> -                        nand-ecc-mode = "soft";

> >> +                       nand-ecc-mode = "hw";

> >> +                        atmel,has-pmecc;        /* Enable PMECC */

> >> +                        atmel,pmecc-cap = <2>;    /* PMECC error

> >> bits*/

> >> +                        atmel,pmecc-sector-size = <512>;  /* sector

> >> size for PMECC, it is not page size */

> >>

> >> Also you can check the readme file in:

> >> Documentation/devicetree/bindings/mtd/atmel-nand.txt

> >>

> > I did not have the NAND flash setup correctly in the dtsi.  I applied

> > the patch that you provided, rebuilt and reloaded my kernel.

> > Unfortunately, the filesystem is still not being read from flash

> > correctly.  It looks like the kernel correctly identifies the NAND

> > flash and sets up the partitions, but has problems when it attempts

> to read out the filesystem.  Here is the kernel boot output.

> > Do you see anything that tells you what may be going wrong?

>

>

> [    1.226562] UBI: attaching mtd1 to ubi0

> [    1.230468] uncorrectable error :

>

> ^^^^^^^^^^^^

> After checking the log, it shows the nand driver use the soft ecc. So

> the pmecc is not enable yet.

>

> Checking the 3.7-rc7, I found the patch I gave to you is not complete

> for pmecc enable, here is the whole patch to enable PMECC in dtsi.

> Please apply it and give me the feedback. Sorry for the missing of the

> part of at91sam9x5.dtsi.

>

> diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi

> b/arch/arm/boot/dts/at91sam9x5.dtsi

> index 0cc062b..32ca418 100644

> --- a/arch/arm/boot/dts/at91sam9x5.dtsi

> +++ b/arch/arm/boot/dts/at91sam9x5.dtsi

> @@ -281,7 +281,11 @@

>               #address-cells = <1>;

>               #size-cells = <1>;

>               reg = <0x40000000 0x10000000

> +                0xffffe000 0x600    /* PMECC Registers */

> +                0xffffe600 0x200    /* PMECC Error Location Registers

> */

> +                0x00100000 0x100000    /* ROM code */

>                     >;

> +            atmel,pmecc-lookup-table-offset = <0x8000 0x10000>;

>               atmel,nand-addr-offset = <21>;

>               atmel,nand-cmd-offset = <22>;

>               gpios = <&pioD 5 0

> diff --git a/arch/arm/boot/dts/at91sam9x5cm.dtsi

> b/arch/arm/boot/dts/at91sam9x5cm.dtsi

> index 31e7be2..4027ac7 100644

> --- a/arch/arm/boot/dts/at91sam9x5cm.dtsi

> +++ b/arch/arm/boot/dts/at91sam9x5cm.dtsi

> @@ -26,7 +26,10 @@

>       ahb {

>           nand0: nand@40000000 {

>               nand-bus-width = <8>;

> -            nand-ecc-mode = "soft";

> +            nand-ecc-mode = "hw";

> +            atmel,has-pmecc;    /* Enable PMECC */

> +            atmel,pmecc-cap = <2>;

> +            atmel,pmecc-sector-size = <512>;

>               nand-on-flash-bbt;

>               status = "okay";

>

> --

> 1.7.9.5

>

> Best Regards,

> Josh Wu

> >

> > [    0.000000] Booting Linux on physical CPU 0

> > [    0.000000] Linux version 3.7.0-rc7-armv5-x0.11 (xxxx@xxxx) (gcc

> versio

> > n 4.6.2 20121016 (release) [ARM/embedded-4_6-branch revision 192487]

> > (GNU Tools for ARM Embedded Processors) ) #1 Tue Dec 4 10:29:17 EST

> 2012

> > [    0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ),

> cr=00053177

> > [    0.000000] CPU: VIVT data cache, VIVT instruction cache

> > [    0.000000] Machine: Atmel AT91SAM (Device Tree), model: Atmel

> AT91SAM9G25-EK

> > [    0.000000] Memory policy: ECC disabled, Data cache writeback

> > [    0.000000] AT91: Detected soc type: at91sam9x5

> > [    0.000000] AT91: Detected soc subtype: at91sam9g25

> > [    0.000000] AT91: sram at 0x300000 of 0x8000 mapped at 0xfef70000

> > [    0.000000] Clocks: CPU 400 MHz, master 133 MHz, main 12.000 MHz

> > [    0.000000] Built 1 zonelists in Zone order, mobility grouping on.

> Total pag

> > es: 32512

> > [    0.000000] Kernel command line: mem=128M console=ttyS0,115200

> mtdparts=atmel

> > _nand:8M(bootstrap/uboot/kernel)ro,-(rootfs) root=/dev/mtdblock1 rw

> > rootfstype=u bifs ubi.mtd=1 root=ubi0:rootfs

> > [    0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)

> > [    0.000000] Dentry cache hash table entries: 16384 (order: 4,

> 65536 bytes)

> > [    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768

> bytes)

> > [    0.000000] Memory: 128MB = 128MB total

> > [    0.000000] Memory: 124312k/124312k available, 6760k reserved, 0K

> highmem

> > [    0.000000] Virtual kernel memory layout:

> > [    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)

> > [    0.000000]     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)

> > [    0.000000]     vmalloc : 0xc8800000 - 0xff000000   ( 872 MB)

> > [    0.000000]     lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)

> > [    0.000000]     modules : 0xbf000000 - 0xc0000000   (  16 MB)

> > [    0.000000]       .text : 0xc0008000 - 0xc04b01d8   (4769 kB)

> > [    0.000000]       .init : 0xc04b1000 - 0xc04dc304   ( 173 kB)

> > [    0.000000]       .data : 0xc04de000 - 0xc050e9a0   ( 195 kB)

> > [    0.000000]        .bss : 0xc050e9c4 - 0xc056dd1c   ( 381 kB)

> > [    0.000000] NR_IRQS:16 nr_irqs:16 16

> > [    0.000000] sched_clock: 32 bits at 256 Hz, resolution 3906250ns,

> wraps every

> >   3892314108ms

> > [    0.000000] Console: colour dummy device 80x30

> > [    0.035156] Calibrating delay loop... 199.80 BogoMIPS (lpj=389120)

> > [    0.035156] pid_max: default: 32768 minimum: 301

> > [    0.035156] Mount-cache hash table entries: 512

> > [    0.039062] CPU: Testing write buffer coherency: ok

> > [    0.039062] Setting up static identity map for 0x2036cb00 -

> 0x2036cb58

> > [    0.039062] devtmpfs: initialized

> > [    0.042968] NET: Registered protocol family 16

> > [    0.042968] DMA: preallocated 256 KiB pool for atomic coherent

> allocations

> > [    0.070312] No ATAGs?

> > [    0.070312] AT91: Power Management

> > [    0.070312] AT91: Starting after power-restored wakeup

> > [    0.125000] bio: create slab <bio-0> at 0

> > [    0.128906] SCSI subsystem initialized

> > [    0.132812] usbcore: registered new interface driver usbfs

> > [    0.132812] usbcore: registered new interface driver hub

> > [    0.132812] usbcore: registered new device driver usb

> > [    0.136718] at91_i2c f8010000.i2c: AT91 i2c bus driver.

> > [    0.136718] at91_i2c f8014000.i2c: AT91 i2c bus driver.

> > [    0.140625] at91_i2c f8018000.i2c: AT91 i2c bus driver.

> > [    0.144531] Switching to clocksource tcb_clksrc

> > [    0.199218] NET: Registered protocol family 2

> > [    0.203125] TCP established hash table entries: 4096 (order: 3,

> 32768 bytes)

> > [    0.203125] TCP bind hash table entries: 4096 (order: 2, 16384

> bytes)

> > [    0.203125] TCP: Hash tables configured (established 4096 bind

> 4096)

> > [    0.203125] TCP: reno registered

> > [    0.203125] UDP hash table entries: 256 (order: 0, 4096 bytes)

> > [    0.203125] UDP-Lite hash table entries: 256 (order: 0, 4096

> bytes)

> > [    0.203125] NET: Registered protocol family 1

> > [    0.203125] RPC: Registered named UNIX socket transport module.

> > [    0.203125] RPC: Registered udp transport module.

> > [    0.203125] RPC: Registered tcp transport module.

> > [    0.203125] RPC: Registered tcp NFSv4.1 backchannel transport

> module.

> > [    0.210937] NFS: Registering the id_resolver key type

> > [    0.210937] Key type id_resolver registered

> > [    0.210937] Key type id_legacy registered

> > [    0.210937] jffs2: version 2.2. (NAND)  © 2001-2006 Red Hat, Inc.

> > [    0.210937] msgmni has been set to 242

> > [    0.210937] io scheduler noop registered (default)

> > [    0.222656] fffff200.serial: ttyS0 at MMIO 0xfffff200 (irq = 18)

> is a ATMEL_S

> > ERIAL

> > [    0.613281] console [ttyS0] enabled

> > [    0.617187] f801c000.serial: ttyS1 at MMIO 0xf801c000 (irq = 22)

> is a ATMEL_S

> > ERIAL

> > [    0.632812] brd: module loaded

> > [    0.652343] loop: module loaded

> > [    0.667968] atmel_nand: Use On Flash BBT

> > [    0.671875] atmel_nand 40000000.nand: No DMA support for NAND

> access.

> > [    0.679687] ONFI param page 0 valid

> > [    0.683593] ONFI flash detected

> > [    0.687500] NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda

> (Micron MT29F2G

> > 08AAD), page size: 2048, OOB size: 64

> > [    0.699218] Bad block table found at page 131008, version 0x01

> > [    0.703125] Bad block table found at page 130944, version 0x01

> > [    0.710937] nand_read_bbt: bad block at 0x000009380000

> > [    0.714843] 2 cmdlinepart partitions found on MTD device

> atmel_nand

> > [    0.722656] Creating 2 MTD partitions on "atmel_nand":

> > [    0.726562] 0x000000000000-0x000000800000 :

> "bootstrap/uboot/kernel"

> > [    0.734375] 0x000000800000-0x000010000000 : "rootfs"

> > [    0.753906] macb f802c000.ethernet (unregistered net_device):

> invalid hw addr

> > ess, using random

> > [    0.765625] libphy: MACB_mii_bus: probed

> > [    0.769531] macb f802c000.ethernet eth0: Cadence MACB at

> 0xf802c000 irq 23 (4

> > a:b7:82:09:12:d7)

> > [    0.781250] macb f802c000.ethernet eth0: attached PHY driver

> [Davicom DM9161A

> > ] (mii_bus:phy_addr=f802c000.etherne:00, irq=-1)

> > [    0.792968] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI)

> Driver

> > [    0.800781] atmel-ehci 700000.ehci: Atmel EHCI UHP HS

> > [    0.804687] atmel-ehci 700000.ehci: new USB bus registered,

> assigned bus numb

> > er 1

> > [    0.812500] atmel-ehci 700000.ehci: irq 30, io mem 0x00700000

> > [    0.828125] atmel-ehci 700000.ehci: USB 2.0 started, EHCI 1.00

> > [    0.832031] usb usb1: New USB device found, idVendor=1d6b,

> idProduct=0002

> > [    0.839843] usb usb1: New USB device strings: Mfr=3, Product=2,

> SerialNumber=

> > 1

> > [    0.847656] usb usb1: Product: Atmel EHCI UHP HS

> > [    0.851562] usb usb1: Manufacturer: Linux 3.7.0-rc7-armv5-x0.11

> ehci_hcd

> > [    0.859375] usb usb1: SerialNumber: 700000.ehci

> > [    0.863281] hub 1-0:1.0: USB hub found

> > [    0.867187] hub 1-0:1.0: 3 ports detected

> > [    0.875000] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver

> > [    0.878906] at91_ohci 600000.ohci: AT91 OHCI

> > [    0.882812] at91_ohci 600000.ohci: new USB bus registered,

> assigned bus numbe

> > r 2

> > [    0.890625] at91_ohci 600000.ohci: irq 30, io mem 0x00600000

> > [    0.957031] usb usb2: New USB device found, idVendor=1d6b,

> idProduct=0001

> > [    0.960937] usb usb2: New USB device strings: Mfr=3, Product=2,

> SerialNumber=

> > 1

> > [    0.968750] usb usb2: Product: AT91 OHCI

> > [    0.972656] usb usb2: Manufacturer: Linux 3.7.0-rc7-armv5-x0.11

> ohci_hcd

> > [    0.980468] usb usb2: SerialNumber: at91

> > [    0.984375] hub 2-0:1.0: USB hub found

> > [    0.988281] hub 2-0:1.0: 2 ports detected

> > [    0.996093] usbcore: registered new interface driver cdc_acm

> > [    1.000000] cdc_acm: USB Abstract Control Model driver for USB

> modems and ISD

> > N adapters

> > [    1.011718] usbcore: registered new interface driver uas

> > [    1.015625] Initializing USB Mass Storage driver...

> > [    1.019531] usbcore: registered new interface driver usb-storage

> > [    1.027343] USB Mass Storage support registered.

> > [    1.031250] usbcore: registered new interface driver ums-alauda

> > [    1.039062] usbcore: registered new interface driver ums-cypress

> > [    1.046875] usbcore: registered new interface driver ums-datafab

> > [    1.050781] usbcore: registered new interface driver ums_eneub6250

> > [    1.058593] usbcore: registered new interface driver ums-freecom

> > [    1.066406] usbcore: registered new interface driver ums-isd200

> > [    1.070312] usbcore: registered new interface driver ums-jumpshot

> > [    1.078125] usbcore: registered new interface driver ums-karma

> > [    1.085937] usbcore: registered new interface driver ums-onetouch

> > [    1.089843] usbcore: registered new interface driver ums-realtek

> > [    1.097656] usbcore: registered new interface driver ums-sddr09

> > [    1.105468] usbcore: registered new interface driver ums-sddr55

> > [    1.109375] usbcore: registered new interface driver ums-usbat

> > [    1.117187] usbcore: registered new interface driver usbserial

> > [    1.125000] usbcore: registered new interface driver

> usbserial_generic

> > [    1.132812] usbserial: USB Serial support registered for generic

> > [    1.136718] usbcore: registered new interface driver ftdi_sio

> > [    1.144531] usbserial: USB Serial support registered for FTDI USB

> Serial Devi

> > ce

> > [    1.152343] usbcore: registered new interface driver pl2303

> > [    1.156250] usbserial: USB Serial support registered for pl2303

> > [    1.164062] mousedev: PS/2 mouse device common for all mice

> > [    1.171875] i2c /dev entries driver

> > [    1.183593] usbcore: registered new interface driver usbhid

> > [    1.191406] usbhid: USB HID core driver

> > [    1.195312] TCP: cubic registered

> > [    1.195312] NET: Registered protocol family 10

> > [    1.203125] sit: IPv6 over IPv4 tunneling driver

> > [    1.210937] NET: Registered protocol family 17

> > [    1.214843] Key type dns_resolver registered

> > [    1.226562] UBI: attaching mtd1 to ubi0

> > [    1.230468] uncorrectable error :

> > [    1.234375] UBI warning: ubi_io_read: error -74 (ECC error) while

> reading 64

> > bytes from PEB 0:0, read only 64 bytes, retry

> > [    1.242187] uncorrectable error :

> > [    1.246093] UBI warning: ubi_io_read: error -74 (ECC error) while

> reading 64

> > bytes from PEB 0:0, read only 64 bytes, retry

> > [    1.257812] uncorrectable error :

> > [    1.261718] UBI warning: ubi_io_read: error -74 (ECC error) while

> reading 64

> > bytes from PEB 0:0, read only 64 bytes, retry

> > [    1.273437] uncorrectable error :

> > [    1.277343] UBI error: ubi_io_read: error -74 (ECC error) while

> reading 64 by

> > tes from PEB 0:0, read 64 bytes

> > [    1.285156] [<c000d2bc>] (unwind_backtrace+0x0/0xe0) from

> [<c0243764>] (ubi_i

> > o_read+0x1d4/0x2a4)

> > [    1.292968] [<c0243764>] (ubi_io_read+0x1d4/0x2a4) from

> [<c0243a74>] (ubi_io_

> > read_ec_hdr+0x68/0x214)

> > [    1.304687] [<c0243a74>] (ubi_io_read_ec_hdr+0x68/0x214) from

> [<c0247da0>] (u

> > bi_attach+0x104/0x13e4)

> > [    1.312500] [<c0247da0>] (ubi_attach+0x104/0x13e4) from

> [<c023e268>] (ubi_att

> > ach_mtd_dev+0x5a4/0xb94)

> > [    1.320312] [<c023e268>] (ubi_attach_mtd_dev+0x5a4/0xb94) from

> [<c04c88d4>] (

> > ubi_init+0x1d8/0x2d8)

> > [    1.332031] [<c04c88d4>] (ubi_init+0x1d8/0x2d8) from [<c0008860>]

> (do_one_ini

> > tcall+0x90/0x168)

> > [    1.339843] [<c0008860>] (do_one_initcall+0x90/0x168) from

> [<c0363f10>] (kern

> > el_init+0xe4/0x298)

> > [    1.347656] [<c0363f10>] (kernel_init+0xe4/0x298) from

> [<c00093f0>] (ret_from

> > _fork+0x14/0x24)

> > [    1.355468] UBI error: validate_ec_hdr: bad VID header offset

> 2048, expected

> > 512

> > [    1.363281] UBI error: validate_ec_hdr: bad EC header

> > [    1.367187] Erase counter header dump:

> > [    1.371093]  magic          0x55424923

> > [    1.375000]  version        1

> > [    1.378906]  ec             4

> > [    1.382812]  vid_hdr_offset 2048

> > [    1.386718]  data_offset    4096

> > [    1.390625]  image_seq      191777507

> > [    1.390625]  hdr_crc        0xecd7a545

> > [    1.394531] erase counter header hexdump:

> > [    1.398437] [<c000d2bc>] (unwind_backtrace+0x0/0xe0) from

> [<c024303c>] (valid

> > ate_ec_hdr+0x148/0x168)

> > [    1.410156] [<c024303c>] (validate_ec_hdr+0x148/0x168) from

> [<c0243bc4>] (ubi

> > _io_read_ec_hdr+0x1b8/0x214)

> > [    1.417968] [<c0243bc4>] (ubi_io_read_ec_hdr+0x1b8/0x214) from

> [<c0247da0>] (

> > ubi_attach+0x104/0x13e4)

> > [    1.429687] [<c0247da0>] (ubi_attach+0x104/0x13e4) from

> [<c023e268>] (ubi_att

> > ach_mtd_dev+0x5a4/0xb94)

> > [    1.437500] [<c023e268>] (ubi_attach_mtd_dev+0x5a4/0xb94) from

> [<c04c88d4>] (

> > ubi_init+0x1d8/0x2d8)

> > [    1.445312] [<c04c88d4>] (ubi_init+0x1d8/0x2d8) from [<c0008860>]

> (do_one_ini

> > tcall+0x90/0x168)

> > [    1.453125] [<c0008860>] (do_one_initcall+0x90/0x168) from

> [<c0363f10>] (kern

> > el_init+0xe4/0x298)

> > [    1.464843] [<c0363f10>] (kernel_init+0xe4/0x298) from

> [<c00093f0>] (ret_from

> > _fork+0x14/0x24)

> > [    1.472656] UBI error: ubi_io_read_ec_hdr: validation failed for

> PEB 0

> > [    1.476562] UBI error: ubi_attach_mtd_dev: failed to attach mtd1,

> error -22

> > [    1.484375] UBI error: ubi_init: cannot attach mtd1

> > [    1.492187] drivers/rtc/hctosys.c: unable to open rtc device

> (rtc0)

> > [    1.496093] atmel_mci f0008000.mmc: version: 0x504

> > [    1.503906] atmel_mci f0008000.mmc: using PIO

> > [    1.539062] atmel_mci f0008000.mmc: Atmel MCI controller at

> 0xf0008000 irq 28

> > , 1 slots

> > [    1.546875] atmel_mci f000c000.mmc: version: 0x504

> > [    1.550781] atmel_mci f000c000.mmc: using PIO

> > [    1.585937] atmel_mci f000c000.mmc: Atmel MCI controller at

> 0xf000c000 irq 29

> > , 1 slots

> > [    1.593750] UBIFS error (pid 1): ubifs_mount: cannot open

> "ubi0:rootfs", erro

> > r -19

> > [    1.601562] VFS: Cannot open root device "ubi0:rootfs" or unknown-

> block(0,0):

> >   error -19

> > [    1.609375] Please append a correct "root=" boot option; here are

> the availab

> > le partitions:

> > [    1.617187] 1f00            8192 mtdblock0  (driver?)

> > [    1.621093] 1f01          253952 mtdblock1  (driver?)

> > [    1.628906] Kernel panic - not syncing: VFS: Unable to mount root

> fs on unkno

> > wn-block(0,0)

> >

> > Thanks,

> > Bryan

> >

> >> Best Regards,

> >> Josh Wu

> >>

> >>> Thanks,

> >>> Bryan

> >>>

> >>>

> >>>

> >>> _______________________________________________

> >>> linux-arm-kernel mailing list

> >>> linux-arm-kernel@lists.infradead.org

> >>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Bryan Evenson - Dec. 6, 2012, 3:13 a.m.
Josh,

I spoke too soon.  I was able to read and use the filesystem from NAND
flash with the patch you provided when I applied it to the Atmel 3.4
kernel fork over at https://github.com/linux4sam/linux-at91/ (master branch).
When I applied the same patch to the recent mainline kernel (3.7-rc8),
it's still having problems accessing flash.  The boot log shows that it is
setting up for PMECC correctly, but it has errors when it tries to read from
the filesystem.

I noticed over at the linux-at91 fork that you had applied the PMECC support
on the 3.4.x_pmecc_dt_9x5 branch a few months ago.  From browsing the mainline
I didn't see some of your changes from that branch in the mainline.  Are there
some changes from the linux-at91 fork that are still scheduled for mainlining?

If it helps, here is the boot log when I tried to boot using a 3.7-rc8 kernel
and DT.

Thanks,
Bryan

Uncompressing Linux... done, booting the kernel.
[    0.000000] Booting Linux on physical CPU 0
[    0.000000] Linux version 3.7.0-rc8-armv5-x0.16 (xxxx@xxxx) (gcc versio
n 4.6.2 20121016 (release) [ARM/embedded-4_6-branch revision 192487] (GNU Tools
for ARM Embedded Processors) ) #1 Wed Dec 5 16:11:30 EST 2012
[    0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] Machine: Atmel AT91SAM (Device Tree), model: Atmel AT91SAM9G25-EK
[    0.000000] Memory policy: ECC disabled, Data cache writeback
[    0.000000] AT91: Detected soc type: at91sam9x5
[    0.000000] AT91: Detected soc subtype: at91sam9g25
[    0.000000] AT91: sram at 0x300000 of 0x8000 mapped at 0xfef70000
[    0.000000] Clocks: CPU 400 MHz, master 133 MHz, main 12.000 MHz
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pag
es: 32512
[    0.000000] Kernel command line: mem=128M console=ttyS0,115200 mtdparts=atmel
_nand:8M(bootstrap/uboot/kernel)ro,-(rootfs) root=/dev/mtdblock1 rw rootfstype=u
bifs ubi.mtd=1 root=ubi0:rootfs
[    0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Memory: 128MB = 128MB total
[    0.000000] Memory: 124276k/124276k available, 6796k reserved, 0K highmem
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
[    0.000000]     vmalloc : 0xc8800000 - 0xff000000   ( 872 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)
[    0.000000]     modules : 0xbf000000 - 0xc0000000   (  16 MB)
[    0.000000]       .text : 0xc0008000 - 0xc04b8630   (4802 kB)
[    0.000000]       .init : 0xc04b9000 - 0xc04e45c4   ( 174 kB)
[    0.000000]       .data : 0xc04e6000 - 0xc0516ce0   ( 196 kB)
[    0.000000]        .bss : 0xc0516d04 - 0xc05760bc   ( 381 kB)
[    0.000000] NR_IRQS:16 nr_irqs:16 16
[    0.000000] sched_clock: 32 bits at 256 Hz, resolution 3906250ns, wraps every
 3892314108ms
[    0.000000] Console: colour dummy device 80x30
[    0.035156] Calibrating delay loop... 199.80 BogoMIPS (lpj=389120)
[    0.035156] pid_max: default: 32768 minimum: 301
[    0.035156] Mount-cache hash table entries: 512
[    0.039062] CPU: Testing write buffer coherency: ok
[    0.039062] Setting up static identity map for 0x20371d48 - 0x20371da0
[    0.039062] devtmpfs: initialized
[    0.042968] NET: Registered protocol family 16
[    0.042968] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.070312] No ATAGs?
[    0.070312] AT91: Power Management
[    0.070312] AT91: Starting after power-restored wakeup
[    0.121093] bio: create slab <bio-0> at 0
[    0.125000] SCSI subsystem initialized
[    0.128906] usbcore: registered new interface driver usbfs
[    0.128906] usbcore: registered new interface driver hub
[    0.128906] usbcore: registered new device driver usb
[    0.132812] at91_i2c f8010000.i2c: AT91 i2c bus driver.
[    0.132812] at91_i2c f8014000.i2c: AT91 i2c bus driver.
[    0.136718] at91_i2c f8018000.i2c: AT91 i2c bus driver.
[    0.140625] Switching to clocksource tcb_clksrc
[    0.195312] NET: Registered protocol family 2
[    0.199218] TCP established hash table entries: 4096 (order: 3, 32768 bytes)
[    0.199218] TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
[    0.199218] TCP: Hash tables configured (established 4096 bind 4096)
[    0.199218] TCP: reno registered
[    0.199218] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.199218] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.199218] NET: Registered protocol family 1
[    0.199218] RPC: Registered named UNIX socket transport module.
[    0.199218] RPC: Registered udp transport module.
[    0.199218] RPC: Registered tcp transport module.
[    0.199218] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.207031] NFS: Registering the id_resolver key type
[    0.207031] Key type id_resolver registered
[    0.207031] Key type id_legacy registered
[    0.207031] jffs2: version 2.2. (NAND) �© 2001-2006 Red Hat, Inc.
[    0.207031] msgmni has been set to 242
[    0.210937] io scheduler noop registered (default)
[    0.218750] fffff200.serial: ttyS0 at MMIO 0xfffff200 (irq = 18) is a ATMEL_S
ERIAL
[    0.609375] console [ttyS0] enabled
[    0.613281] f801c000.serial: ttyS1 at MMIO 0xf801c000 (irq = 22) is a ATMEL_S
ERIAL
[    0.632812] brd: module loaded
[    0.652343] loop: module loaded
[    0.667968] atmel_nand: Use On Flash BBT
[    0.671875] atmel_nand 40000000.nand: No DMA support for NAND access.
[    0.675781] ONFI param page 0 valid
[    0.679687] ONFI flash detected
[    0.683593] NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda (Micron MT29F2G
08AAD), page size: 2048, OOB size: 64
[    0.695312] atmel_nand 40000000.nand: Initialize PMECC params, cap: 2, sector
: 512
[    0.703125] Bad block table found at page 131008, version 0x01
[    0.707031] Bad block table found at page 130944, version 0x01
[    0.714843] nand_read_bbt: bad block at 0x000009380000
[    0.718750] 2 cmdlinepart partitions found on MTD device atmel_nand
[    0.726562] Creating 2 MTD partitions on "atmel_nand":
[    0.730468] 0x000000000000-0x000000800000 : "bootstrap/uboot/kernel"
[    0.742187] 0x000000800000-0x000010000000 : "rootfs"
[    0.757812] macb f802c000.ethernet (unregistered net_device): invalid hw addr
ess, using random
[    0.773437] libphy: MACB_mii_bus: probed
[    0.777343] macb f802c000.ethernet eth0: Cadence MACB at 0xf802c000 irq 23 (c
a:2c:e6:c3:59:8f)
[    0.785156] macb f802c000.ethernet eth0: attached PHY driver [Davicom DM9161A
] (mii_bus:phy_addr=f802c000.etherne:00, irq=-1)
[    0.796875] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.804687] atmel-ehci 700000.ehci: Atmel EHCI UHP HS
[    0.808593] atmel-ehci 700000.ehci: new USB bus registered, assigned bus numb
er 1
[    0.816406] atmel-ehci 700000.ehci: irq 28, io mem 0x00700000
[    0.835937] atmel-ehci 700000.ehci: USB 2.0 started, EHCI 1.00
[    0.839843] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    0.847656] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=
1
[    0.855468] usb usb1: Product: Atmel EHCI UHP HS
[    0.859375] usb usb1: Manufacturer: Linux 3.7.0-rc8-armv5-x0.16 ehci_hcd
[    0.867187] usb usb1: SerialNumber: 700000.ehci
[    0.871093] hub 1-0:1.0: USB hub found
[    0.875000] hub 1-0:1.0: 3 ports detected
[    0.878906] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.886718] at91_ohci 600000.ohci: AT91 OHCI
[    0.890625] at91_ohci 600000.ohci: new USB bus registered, assigned bus numbe
r 2
[    0.898437] at91_ohci 600000.ohci: irq 28, io mem 0x00600000
[    0.964843] usb usb2: New USB device found, idVendor=1d6b, idProduct=0001
[    0.968750] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=
1
[    0.976562] usb usb2: Product: AT91 OHCI
[    0.980468] usb usb2: Manufacturer: Linux 3.7.0-rc8-armv5-x0.16 ohci_hcd
[    0.988281] usb usb2: SerialNumber: at91
[    0.992187] hub 2-0:1.0: USB hub found
[    0.996093] hub 2-0:1.0: 2 ports detected
[    1.003906] usbcore: registered new interface driver cdc_acm
[    1.007812] cdc_acm: USB Abstract Control Model driver for USB modems and ISD
N adapters
[    1.019531] usbcore: registered new interface driver uas
[    1.023437] Initializing USB Mass Storage driver...
[    1.027343] usbcore: registered new interface driver usb-storage
[    1.035156] USB Mass Storage support registered.
[    1.039062] usbcore: registered new interface driver ums-alauda
[    1.046875] usbcore: registered new interface driver ums-cypress
[    1.054687] usbcore: registered new interface driver ums-datafab
[    1.058593] usbcore: registered new interface driver ums_eneub6250
[    1.066406] usbcore: registered new interface driver ums-freecom
[    1.074218] usbcore: registered new interface driver ums-isd200
[    1.078125] usbcore: registered new interface driver ums-jumpshot
[    1.085937] usbcore: registered new interface driver ums-karma
[    1.093750] usbcore: registered new interface driver ums-onetouch
[    1.097656] usbcore: registered new interface driver ums-realtek
[    1.105468] usbcore: registered new interface driver ums-sddr09
[    1.113281] usbcore: registered new interface driver ums-sddr55
[    1.117187] usbcore: registered new interface driver ums-usbat
[    1.125000] usbcore: registered new interface driver usbserial
[    1.132812] usbcore: registered new interface driver usbserial_generic
[    1.140625] usbserial: USB Serial support registered for generic
[    1.144531] usbcore: registered new interface driver ftdi_sio
[    1.152343] usbserial: USB Serial support registered for FTDI USB Serial Devi
ce
[    1.160156] usbcore: registered new interface driver pl2303
[    1.167968] usbserial: USB Serial support registered for pl2303
[    1.171875] mousedev: PS/2 mouse device common for all mice
[    1.179687] i2c /dev entries driver
[    1.191406] usbcore: registered new interface driver usbhid
[    1.199218] usbhid: USB HID core driver
[    1.207031] usb 1-2: new high-speed USB device number 2 using atmel-ehci
[    1.214843] TCP: cubic registered
[    1.218750] NET: Registered protocol family 10
[    1.222656] sit: IPv6 over IPv4 tunneling driver
[    1.230468] NET: Registered protocol family 17
[    1.234375] Key type dns_resolver registered
[    1.246093] UBI: attaching mtd1 to ubi0
[    1.253906] atmel_nand 40000000.nand: PMECC: Too many errors
[    1.261718] UBI warning: ubi_io_read: error -5 while reading 64 bytes from PE
B 10:0, read only 0 bytes, retry
[    1.269531] atmel_nand 40000000.nand: PMECC: Too many errors
[    1.277343] UBI warning: ubi_io_read: error -5 while reading 64 bytes from PE
B 10:0, read only 0 bytes, retry
[    1.285156] atmel_nand 40000000.nand: PMECC: Too many errors
[    1.292968] UBI warning: ubi_io_read: error -5 while reading 64 bytes from PE
B 10:0, read only 0 bytes, retry
[    1.304687] atmel_nand 40000000.nand: PMECC: Too many errors
[    1.308593] UBI error: ubi_io_read: error -5 while reading 64 bytes from PEB
10:0, read 0 bytes
[    1.316406] [<c000d2bc>] (unwind_backtrace+0x0/0xe0) from [<c0243a10>] (ubi_i
o_read+0x1d4/0x2a4)
[    1.328125] [<c0243a10>] (ubi_io_read+0x1d4/0x2a4) from [<c0243d20>] (ubi_io_
read_ec_hdr+0x68/0x214)
[    1.335937] [<c0243d20>] (ubi_io_read_ec_hdr+0x68/0x214) from [<c024804c>] (u
bi_attach+0x104/0x13e4)
[    1.343750] [<c024804c>] (ubi_attach+0x104/0x13e4) from [<c023e514>] (ubi_att
ach_mtd_dev+0x5a4/0xb94)
[    1.355468] [<c023e514>] (ubi_attach_mtd_dev+0x5a4/0xb94) from [<c04d09dc>] (
ubi_init+0x1d8/0x2d8)
[    1.363281] [<c04d09dc>] (ubi_init+0x1d8/0x2d8) from [<c0008860>] (do_one_ini
tcall+0x90/0x168)
[    1.371093] [<c0008860>] (do_one_initcall+0x90/0x168) from [<c03686a4>] (kern
el_init+0xe8/0x2a0)
[    1.378906] [<c03686a4>] (kernel_init+0xe8/0x2a0) from [<c00093f0>] (ret_from
_fork+0x14/0x24)
[    1.386718] UBI error: ubi_attach_mtd_dev: failed to attach mtd1, error -5
[    1.394531] UBI error: ubi_init: cannot attach mtd1
[    1.402343] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
[    1.410156] UBIFS error (pid 1): ubifs_mount: cannot open "ubi0:rootfs", erro
r -19
[    1.417968] VFS: Cannot open root device "ubi0:rootfs" or unknown-block(0,0):
 error -19
[    1.425781] Please append a correct "root=" boot option; here are the availab
le partitions:
[    1.433593] 1f00            8192 mtdblock0  (driver?)
[    1.437500] 1f01          253952 mtdblock1  (driver?)
[    1.441406] Kernel panic - not syncing: VFS: Unable to mount root fs on unkno
wn-block(0,0)
Wu, Josh - Dec. 6, 2012, 10:30 a.m.
On 12/6/2012 11:13 AM, Bryan Evenson wrote:
> Josh,
>
> I spoke too soon.  I was able to read and use the filesystem from NAND
> flash with the patch you provided when I applied it to the Atmel 3.4
> kernel fork over at https://github.com/linux4sam/linux-at91/ (master branch).
> When I applied the same patch to the recent mainline kernel (3.7-rc8),
> it's still having problems accessing flash.  The boot log shows that it is
> setting up for PMECC correctly, but it has errors when it tries to read from
> the filesystem.
It is strange.  The 3.4 kernel from at91 github just have a few changes. 
so rationally it behavior the same at PMECC function. From your log, the 
3.7-rc8 kernel says the PMECC found uncorrectable errors.

Can you try to dump or read from the u-boot? to see whether u-boot can 
recognize the same nand page that "too many errors" happened in kernel?
I will do some test to see whether the 3.7-rc8 can work in my side or not.
>
> I noticed over at the linux-at91 fork that you had applied the PMECC support
> on the 3.4.x_pmecc_dt_9x5 branch a few months ago.  From browsing the mainline
> I didn't see some of your changes from that branch in the mainline.  Are there
> some changes from the linux-at91 fork that are still scheduled for mainlining?
yes, this patch is not push to mainline yet. Currently the only concern 
is we are think about the PMECC error correct bits need to adjust by 
ONFI parameters that read from nand flash.
But it is not decide yet. if no exception, this patch will push to 
mainline soon.

Best Regards,
Josh Wu

> If it helps, here is the boot log when I tried to boot using a 3.7-rc8 kernel
> and DT.
>
> Thanks,
> Bryan
>
> Uncompressing Linux... done, booting the kernel.
> [    0.000000] Booting Linux on physical CPU 0
> [    0.000000] Linux version 3.7.0-rc8-armv5-x0.16 (xxxx@xxxx) (gcc versio
> n 4.6.2 20121016 (release) [ARM/embedded-4_6-branch revision 192487] (GNU Tools
> for ARM Embedded Processors) ) #1 Wed Dec 5 16:11:30 EST 2012
> [    0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
> [    0.000000] CPU: VIVT data cache, VIVT instruction cache
> [    0.000000] Machine: Atmel AT91SAM (Device Tree), model: Atmel AT91SAM9G25-EK
> [    0.000000] Memory policy: ECC disabled, Data cache writeback
> [    0.000000] AT91: Detected soc type: at91sam9x5
> [    0.000000] AT91: Detected soc subtype: at91sam9g25
> [    0.000000] AT91: sram at 0x300000 of 0x8000 mapped at 0xfef70000
> [    0.000000] Clocks: CPU 400 MHz, master 133 MHz, main 12.000 MHz
> [    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pag
> es: 32512
> [    0.000000] Kernel command line: mem=128M console=ttyS0,115200 mtdparts=atmel
> _nand:8M(bootstrap/uboot/kernel)ro,-(rootfs) root=/dev/mtdblock1 rw rootfstype=u
> bifs ubi.mtd=1 root=ubi0:rootfs
> [    0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)
> [    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
> [    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
> [    0.000000] Memory: 128MB = 128MB total
> [    0.000000] Memory: 124276k/124276k available, 6796k reserved, 0K highmem
> [    0.000000] Virtual kernel memory layout:
> [    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
> [    0.000000]     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
> [    0.000000]     vmalloc : 0xc8800000 - 0xff000000   ( 872 MB)
> [    0.000000]     lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)
> [    0.000000]     modules : 0xbf000000 - 0xc0000000   (  16 MB)
> [    0.000000]       .text : 0xc0008000 - 0xc04b8630   (4802 kB)
> [    0.000000]       .init : 0xc04b9000 - 0xc04e45c4   ( 174 kB)
> [    0.000000]       .data : 0xc04e6000 - 0xc0516ce0   ( 196 kB)
> [    0.000000]        .bss : 0xc0516d04 - 0xc05760bc   ( 381 kB)
> [    0.000000] NR_IRQS:16 nr_irqs:16 16
> [    0.000000] sched_clock: 32 bits at 256 Hz, resolution 3906250ns, wraps every
>   3892314108ms
> [    0.000000] Console: colour dummy device 80x30
> [    0.035156] Calibrating delay loop... 199.80 BogoMIPS (lpj=389120)
> [    0.035156] pid_max: default: 32768 minimum: 301
> [    0.035156] Mount-cache hash table entries: 512
> [    0.039062] CPU: Testing write buffer coherency: ok
> [    0.039062] Setting up static identity map for 0x20371d48 - 0x20371da0
> [    0.039062] devtmpfs: initialized
> [    0.042968] NET: Registered protocol family 16
> [    0.042968] DMA: preallocated 256 KiB pool for atomic coherent allocations
> [    0.070312] No ATAGs?
> [    0.070312] AT91: Power Management
> [    0.070312] AT91: Starting after power-restored wakeup
> [    0.121093] bio: create slab <bio-0> at 0
> [    0.125000] SCSI subsystem initialized
> [    0.128906] usbcore: registered new interface driver usbfs
> [    0.128906] usbcore: registered new interface driver hub
> [    0.128906] usbcore: registered new device driver usb
> [    0.132812] at91_i2c f8010000.i2c: AT91 i2c bus driver.
> [    0.132812] at91_i2c f8014000.i2c: AT91 i2c bus driver.
> [    0.136718] at91_i2c f8018000.i2c: AT91 i2c bus driver.
> [    0.140625] Switching to clocksource tcb_clksrc
> [    0.195312] NET: Registered protocol family 2
> [    0.199218] TCP established hash table entries: 4096 (order: 3, 32768 bytes)
> [    0.199218] TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
> [    0.199218] TCP: Hash tables configured (established 4096 bind 4096)
> [    0.199218] TCP: reno registered
> [    0.199218] UDP hash table entries: 256 (order: 0, 4096 bytes)
> [    0.199218] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
> [    0.199218] NET: Registered protocol family 1
> [    0.199218] RPC: Registered named UNIX socket transport module.
> [    0.199218] RPC: Registered udp transport module.
> [    0.199218] RPC: Registered tcp transport module.
> [    0.199218] RPC: Registered tcp NFSv4.1 backchannel transport module.
> [    0.207031] NFS: Registering the id_resolver key type
> [    0.207031] Key type id_resolver registered
> [    0.207031] Key type id_legacy registered
> [    0.207031] jffs2: version 2.2. (NAND) �© 2001-2006 Red Hat, Inc.
> [    0.207031] msgmni has been set to 242
> [    0.210937] io scheduler noop registered (default)
> [    0.218750] fffff200.serial: ttyS0 at MMIO 0xfffff200 (irq = 18) is a ATMEL_S
> ERIAL
> [    0.609375] console [ttyS0] enabled
> [    0.613281] f801c000.serial: ttyS1 at MMIO 0xf801c000 (irq = 22) is a ATMEL_S
> ERIAL
> [    0.632812] brd: module loaded
> [    0.652343] loop: module loaded
> [    0.667968] atmel_nand: Use On Flash BBT
> [    0.671875] atmel_nand 40000000.nand: No DMA support for NAND access.
> [    0.675781] ONFI param page 0 valid
> [    0.679687] ONFI flash detected
> [    0.683593] NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda (Micron MT29F2G
> 08AAD), page size: 2048, OOB size: 64
> [    0.695312] atmel_nand 40000000.nand: Initialize PMECC params, cap: 2, sector
> : 512
> [    0.703125] Bad block table found at page 131008, version 0x01
> [    0.707031] Bad block table found at page 130944, version 0x01
> [    0.714843] nand_read_bbt: bad block at 0x000009380000
> [    0.718750] 2 cmdlinepart partitions found on MTD device atmel_nand
> [    0.726562] Creating 2 MTD partitions on "atmel_nand":
> [    0.730468] 0x000000000000-0x000000800000 : "bootstrap/uboot/kernel"
> [    0.742187] 0x000000800000-0x000010000000 : "rootfs"
> [    0.757812] macb f802c000.ethernet (unregistered net_device): invalid hw addr
> ess, using random
> [    0.773437] libphy: MACB_mii_bus: probed
> [    0.777343] macb f802c000.ethernet eth0: Cadence MACB at 0xf802c000 irq 23 (c
> a:2c:e6:c3:59:8f)
> [    0.785156] macb f802c000.ethernet eth0: attached PHY driver [Davicom DM9161A
> ] (mii_bus:phy_addr=f802c000.etherne:00, irq=-1)
> [    0.796875] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
> [    0.804687] atmel-ehci 700000.ehci: Atmel EHCI UHP HS
> [    0.808593] atmel-ehci 700000.ehci: new USB bus registered, assigned bus numb
> er 1
> [    0.816406] atmel-ehci 700000.ehci: irq 28, io mem 0x00700000
> [    0.835937] atmel-ehci 700000.ehci: USB 2.0 started, EHCI 1.00
> [    0.839843] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
> [    0.847656] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=
> 1
> [    0.855468] usb usb1: Product: Atmel EHCI UHP HS
> [    0.859375] usb usb1: Manufacturer: Linux 3.7.0-rc8-armv5-x0.16 ehci_hcd
> [    0.867187] usb usb1: SerialNumber: 700000.ehci
> [    0.871093] hub 1-0:1.0: USB hub found
> [    0.875000] hub 1-0:1.0: 3 ports detected
> [    0.878906] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
> [    0.886718] at91_ohci 600000.ohci: AT91 OHCI
> [    0.890625] at91_ohci 600000.ohci: new USB bus registered, assigned bus numbe
> r 2
> [    0.898437] at91_ohci 600000.ohci: irq 28, io mem 0x00600000
> [    0.964843] usb usb2: New USB device found, idVendor=1d6b, idProduct=0001
> [    0.968750] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=
> 1
> [    0.976562] usb usb2: Product: AT91 OHCI
> [    0.980468] usb usb2: Manufacturer: Linux 3.7.0-rc8-armv5-x0.16 ohci_hcd
> [    0.988281] usb usb2: SerialNumber: at91
> [    0.992187] hub 2-0:1.0: USB hub found
> [    0.996093] hub 2-0:1.0: 2 ports detected
> [    1.003906] usbcore: registered new interface driver cdc_acm
> [    1.007812] cdc_acm: USB Abstract Control Model driver for USB modems and ISD
> N adapters
> [    1.019531] usbcore: registered new interface driver uas
> [    1.023437] Initializing USB Mass Storage driver...
> [    1.027343] usbcore: registered new interface driver usb-storage
> [    1.035156] USB Mass Storage support registered.
> [    1.039062] usbcore: registered new interface driver ums-alauda
> [    1.046875] usbcore: registered new interface driver ums-cypress
> [    1.054687] usbcore: registered new interface driver ums-datafab
> [    1.058593] usbcore: registered new interface driver ums_eneub6250
> [    1.066406] usbcore: registered new interface driver ums-freecom
> [    1.074218] usbcore: registered new interface driver ums-isd200
> [    1.078125] usbcore: registered new interface driver ums-jumpshot
> [    1.085937] usbcore: registered new interface driver ums-karma
> [    1.093750] usbcore: registered new interface driver ums-onetouch
> [    1.097656] usbcore: registered new interface driver ums-realtek
> [    1.105468] usbcore: registered new interface driver ums-sddr09
> [    1.113281] usbcore: registered new interface driver ums-sddr55
> [    1.117187] usbcore: registered new interface driver ums-usbat
> [    1.125000] usbcore: registered new interface driver usbserial
> [    1.132812] usbcore: registered new interface driver usbserial_generic
> [    1.140625] usbserial: USB Serial support registered for generic
> [    1.144531] usbcore: registered new interface driver ftdi_sio
> [    1.152343] usbserial: USB Serial support registered for FTDI USB Serial Devi
> ce
> [    1.160156] usbcore: registered new interface driver pl2303
> [    1.167968] usbserial: USB Serial support registered for pl2303
> [    1.171875] mousedev: PS/2 mouse device common for all mice
> [    1.179687] i2c /dev entries driver
> [    1.191406] usbcore: registered new interface driver usbhid
> [    1.199218] usbhid: USB HID core driver
> [    1.207031] usb 1-2: new high-speed USB device number 2 using atmel-ehci
> [    1.214843] TCP: cubic registered
> [    1.218750] NET: Registered protocol family 10
> [    1.222656] sit: IPv6 over IPv4 tunneling driver
> [    1.230468] NET: Registered protocol family 17
> [    1.234375] Key type dns_resolver registered
> [    1.246093] UBI: attaching mtd1 to ubi0
> [    1.253906] atmel_nand 40000000.nand: PMECC: Too many errors
> [    1.261718] UBI warning: ubi_io_read: error -5 while reading 64 bytes from PE
> B 10:0, read only 0 bytes, retry
> [    1.269531] atmel_nand 40000000.nand: PMECC: Too many errors
> [    1.277343] UBI warning: ubi_io_read: error -5 while reading 64 bytes from PE
> B 10:0, read only 0 bytes, retry
> [    1.285156] atmel_nand 40000000.nand: PMECC: Too many errors
> [    1.292968] UBI warning: ubi_io_read: error -5 while reading 64 bytes from PE
> B 10:0, read only 0 bytes, retry
> [    1.304687] atmel_nand 40000000.nand: PMECC: Too many errors
> [    1.308593] UBI error: ubi_io_read: error -5 while reading 64 bytes from PEB
> 10:0, read 0 bytes
> [    1.316406] [<c000d2bc>] (unwind_backtrace+0x0/0xe0) from [<c0243a10>] (ubi_i
> o_read+0x1d4/0x2a4)
> [    1.328125] [<c0243a10>] (ubi_io_read+0x1d4/0x2a4) from [<c0243d20>] (ubi_io_
> read_ec_hdr+0x68/0x214)
> [    1.335937] [<c0243d20>] (ubi_io_read_ec_hdr+0x68/0x214) from [<c024804c>] (u
> bi_attach+0x104/0x13e4)
> [    1.343750] [<c024804c>] (ubi_attach+0x104/0x13e4) from [<c023e514>] (ubi_att
> ach_mtd_dev+0x5a4/0xb94)
> [    1.355468] [<c023e514>] (ubi_attach_mtd_dev+0x5a4/0xb94) from [<c04d09dc>] (
> ubi_init+0x1d8/0x2d8)
> [    1.363281] [<c04d09dc>] (ubi_init+0x1d8/0x2d8) from [<c0008860>] (do_one_ini
> tcall+0x90/0x168)
> [    1.371093] [<c0008860>] (do_one_initcall+0x90/0x168) from [<c03686a4>] (kern
> el_init+0xe8/0x2a0)
> [    1.378906] [<c03686a4>] (kernel_init+0xe8/0x2a0) from [<c00093f0>] (ret_from
> _fork+0x14/0x24)
> [    1.386718] UBI error: ubi_attach_mtd_dev: failed to attach mtd1, error -5
> [    1.394531] UBI error: ubi_init: cannot attach mtd1
> [    1.402343] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
> [    1.410156] UBIFS error (pid 1): ubifs_mount: cannot open "ubi0:rootfs", erro
> r -19
> [    1.417968] VFS: Cannot open root device "ubi0:rootfs" or unknown-block(0,0):
>   error -19
> [    1.425781] Please append a correct "root=" boot option; here are the availab
> le partitions:
> [    1.433593] 1f00            8192 mtdblock0  (driver?)
> [    1.437500] 1f01          253952 mtdblock1  (driver?)
> [    1.441406] Kernel panic - not syncing: VFS: Unable to mount root fs on unkno
> wn-block(0,0)
>
>
Bryan Evenson - Dec. 6, 2012, 1:20 p.m.
> -----Original Message-----

> From: Josh Wu [mailto:josh.wu@atmel.com]

> Sent: Thursday, December 06, 2012 5:30 AM

> To: Bryan Evenson

> Cc: linux-arm-kernel@lists.infradead.org

> Subject: Re: at91: Status of NAND flash access

>

> On 12/6/2012 11:13 AM, Bryan Evenson wrote:

> > Josh,

> >

> > I spoke too soon.  I was able to read and use the filesystem from

> NAND

> > flash with the patch you provided when I applied it to the Atmel 3.4

> > kernel fork over at https://github.com/linux4sam/linux-at91/ (master

> branch).

> > When I applied the same patch to the recent mainline kernel (3.7-

> rc8),

> > it's still having problems accessing flash.  The boot log shows that

> > it is setting up for PMECC correctly, but it has errors when it tries

> > to read from the filesystem.

> It is strange.  The 3.4 kernel from at91 github just have a few

> changes.

> so rationally it behavior the same at PMECC function. From your log,

> the

> 3.7-rc8 kernel says the PMECC found uncorrectable errors.

>

> Can you try to dump or read from the u-boot? to see whether u-boot can

> recognize the same nand page that "too many errors" happened in kernel?

> I will do some test to see whether the 3.7-rc8 can work in my side or

> not.


U-Boot> nand read 0x22000000 0x800000 0x1D00000

NAND read: device 0 offset 0x800000, size 0x1d00000
PMECC: Too many errors
NAND read from offset 800000 failed -5
 0 bytes read: ERROR

So u-boot has the same issue.  However, changing the kernel to the linux-at91
forked kernel produced different results.  That kernel noted the PMECC errors
but was still able to load the filesystem.  My boot output from the successful
filesystem load is below.  Is the 3.4 kernel performing corrections that the
mainline is not, or is it just ignoring errors that it should not be ignoring?

I'm hesitant to make any filesystem changes on this board because I know test
cases like this where it works one way but not the other are kind of rare.  Let
me know if you have similar results on your end.

-Bryan

Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0
Linux version 3.4.0 (xxxx@xxxx) (gcc version 4.5.3 20110311 (prerelease) (
GCC) ) #2 Wed Dec 5 15:36:29 EST 2012
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
CPU: VIVT data cache, VIVT instruction cache
Machine: Atmel AT91SAM (Device Tree), model: Atmel AT91SAM9G25-EK
Memory policy: ECC disabled, Data cache writeback
AT91: Detected soc type: at91sam9x5
AT91: Detected soc subtype: at91sam9g25
AT91: sram at 0x300000 of 0x8000 mapped at 0xfef70000
Clocks: CPU 400 MHz, master 133 MHz, main 12.000 MHz
gpiochip_add: registered GPIOs 0 to 31 on device: pioA
gpiochip_add: registered GPIOs 32 to 63 on device: pioB
gpiochip_add: registered GPIOs 64 to 95 on device: pioC
gpiochip_add: registered GPIOs 96 to 127 on device: pioD
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512
Kernel command line: mem=128M console=ttyS0,115200 mtdparts=atmel_nand:8M(bootst
rap/uboot/kernel)ro,-(rootfs) root=/dev/mtdblock1 rw rootfstype=ubifs ubi.mtd=1
root=ubi0:rootfs
PID hash table entries: 512 (order: -1, 2048 bytes)
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 128MB = 128MB total
Memory: 119856k/119856k available, 11216k reserved, 0K highmem
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
    vmalloc : 0xc8800000 - 0xff000000   ( 872 MB)
    lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)
    modules : 0xbf000000 - 0xc0000000   (  16 MB)
      .text : 0xc0008000 - 0xc04650d4   (4469 kB)
      .init : 0xc0466000 - 0xc048a000   ( 144 kB)
      .data : 0xc048a000 - 0xc04c4420   ( 234 kB)
       .bss : 0xc04c4444 - 0xc09c66e4   (5129 kB)
NR_IRQS:192
sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every 4294967286ms
Console: colour dummy device 80x30
Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar
... MAX_LOCKDEP_SUBCLASSES:  8
... MAX_LOCK_DEPTH:          48
... MAX_LOCKDEP_KEYS:        8191
... CLASSHASH_SIZE:          4096
... MAX_LOCKDEP_ENTRIES:     16384
... MAX_LOCKDEP_CHAINS:      32768
... CHAINHASH_SIZE:          16384
 memory used by lock dependency info: 3695 kB
 per task-struct memory footprint: 1152 bytes
------------------------
| Locking API testsuite:
----------------------------------------------------------------------------
                                 | spin |wlock |rlock |mutex | wsem | rsem |
  --------------------------------------------------------------------------
                     A-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
                 A-B-B-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
             A-B-B-C-C-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
             A-B-C-A-B-C deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
         A-B-B-C-C-D-D-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
         A-B-C-D-B-D-D-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
         A-B-C-D-B-C-D-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
                    double unlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
                  initialize held:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
                 bad unlock order:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
  --------------------------------------------------------------------------
              recursive read-lock:             |  ok  |             |  ok  |
           recursive read-lock #2:             |  ok  |             |  ok  |
            mixed read-write-lock:             |  ok  |             |  ok  |
            mixed write-read-lock:             |  ok  |             |  ok  |
  --------------------------------------------------------------------------
     hard-irqs-on + irq-safe-A/12:  ok  |  ok  |  ok  |
     soft-irqs-on + irq-safe-A/12:  ok  |  ok  |  ok  |
     hard-irqs-on + irq-safe-A/21:  ok  |  ok  |  ok  |
     soft-irqs-on + irq-safe-A/21:  ok  |  ok  |  ok  |
       sirq-safe-A => hirqs-on/12:  ok  |  ok  |  ok  |
       sirq-safe-A => hirqs-on/21:  ok  |  ok  |  ok  |
         hard-safe-A + irqs-on/12:  ok  |  ok  |  ok  |
         soft-safe-A + irqs-on/12:  ok  |  ok  |  ok  |
         hard-safe-A + irqs-on/21:  ok  |  ok  |  ok  |
         soft-safe-A + irqs-on/21:  ok  |  ok  |  ok  |
    hard-safe-A + unsafe-B #1/123:  ok  |  ok  |  ok  |
    soft-safe-A + unsafe-B #1/123:  ok  |  ok  |  ok  |
    hard-safe-A + unsafe-B #1/132:  ok  |  ok  |  ok  |
    soft-safe-A + unsafe-B #1/132:  ok  |  ok  |  ok  |
    hard-safe-A + unsafe-B #1/213:  ok  |  ok  |  ok  |
    soft-safe-A + unsafe-B #1/213:  ok  |  ok  |  ok  |
    hard-safe-A + unsafe-B #1/231:  ok  |  ok  |  ok  |
    soft-safe-A + unsafe-B #1/231:  ok  |  ok  |  ok  |
    hard-safe-A + unsafe-B #1/312:  ok  |  ok  |  ok  |
    soft-safe-A + unsafe-B #1/312:  ok  |  ok  |  ok  |
    hard-safe-A + unsafe-B #1/321:  ok  |  ok  |  ok  |
    soft-safe-A + unsafe-B #1/321:  ok  |  ok  |  ok  |
    hard-safe-A + unsafe-B #2/123:  ok  |  ok  |  ok  |
    soft-safe-A + unsafe-B #2/123:  ok  |  ok  |  ok  |
    hard-safe-A + unsafe-B #2/132:  ok  |  ok  |  ok  |
    soft-safe-A + unsafe-B #2/132:  ok  |  ok  |  ok  |
    hard-safe-A + unsafe-B #2/213:  ok  |  ok  |  ok  |
    soft-safe-A + unsafe-B #2/213:  ok  |  ok  |  ok  |
    hard-safe-A + unsafe-B #2/231:  ok  |  ok  |  ok  |
    soft-safe-A + unsafe-B #2/231:  ok  |  ok  |  ok  |
    hard-safe-A + unsafe-B #2/312:  ok  |  ok  |  ok  |
    soft-safe-A + unsafe-B #2/312:  ok  |  ok  |  ok  |
    hard-safe-A + unsafe-B #2/321:  ok  |  ok  |  ok  |
    soft-safe-A + unsafe-B #2/321:  ok  |  ok  |  ok  |
      hard-irq lock-inversion/123:  ok  |  ok  |  ok  |
      soft-irq lock-inversion/123:  ok  |  ok  |  ok  |
      hard-irq lock-inversion/132:  ok  |  ok  |  ok  |
      soft-irq lock-inversion/132:  ok  |  ok  |  ok  |
      hard-irq lock-inversion/213:  ok  |  ok  |  ok  |
      soft-irq lock-inversion/213:  ok  |  ok  |  ok  |
      hard-irq lock-inversion/231:  ok  |  ok  |  ok  |
      soft-irq lock-inversion/231:  ok  |  ok  |  ok  |
      hard-irq lock-inversion/312:  ok  |  ok  |  ok  |
      soft-irq lock-inversion/312:  ok  |  ok  |  ok  |
      hard-irq lock-inversion/321:  ok  |  ok  |  ok  |
      soft-irq lock-inversion/321:  ok  |  ok  |  ok  |
      hard-irq read-recursion/123:  ok  |
      soft-irq read-recursion/123:  ok  |
      hard-irq read-recursion/132:  ok  |
      soft-irq read-recursion/132:  ok  |
      hard-irq read-recursion/213:  ok  |
      soft-irq read-recursion/213:  ok  |
      hard-irq read-recursion/231:  ok  |
      soft-irq read-recursion/231:  ok  |
      hard-irq read-recursion/312:  ok  |
      soft-irq read-recursion/312:  ok  |
      hard-irq read-recursion/321:  ok  |
      soft-irq read-recursion/321:  ok  |
-------------------------------------------------------
Good, all 218 testcases passed! |
---------------------------------
Calibrating delay loop... 198.04 BogoMIPS (lpj=990208)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0x2033ced8 - 0x2033cf30
devtmpfs: initialized
dummy:
NET: Registered protocol family 16
AT91: Power Management (with slow clock mode)
AT91: Starting after power-restored wakeup
bio: create slab <bio-0> at 0
at_hdmac ffffec00.dma-controller: Atmel AHB DMA Controller ( cpy slave ), 8 chan
nels
at_hdmac ffffee00.dma-controller: Atmel AHB DMA Controller ( cpy slave ), 8 chan
nels
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
cfg80211: Calling CRDA to update world regulatory domain
Switching to clocksource tcb_clksrc
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 4096 (order: 3, 32768 bytes)
TCP bind hash table entries: 4096 (order: 5, 147456 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
TCP: reno registered
UDP hash table entries: 64 (order: 0, 5120 bytes)
UDP-Lite hash table entries: 64 (order: 0, 5120 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
NFS: Registering the id_resolver key type
jffs2: version 2.2. (NAND) (SUMMARY)  �© 2001-2006 Red Hat, Inc.
msgmni has been set to 234
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
io scheduler noop registered (default)
fffff200.serial: ttyS0 at MMIO 0xfffff200 (irq = 1) is a ATMEL_SERIAL
console [ttyS0] enabled
f801c000.serial: ttyS1 at MMIO 0xf801c000 (irq = 5) is a ATMEL_SERIAL
f8020000.serial: ttyS2 at MMIO 0xf8020000 (irq = 6) is a ATMEL_SERIAL
f8028000.serial: ttyS4 at MMIO 0xf8028000 (irq = 8) is a ATMEL_SERIAL
brd: module loaded
loop: module loaded
mtdoops: mtd device (mtddev=name/number) must be supplied
atmel_nand: Use On Flash BBT
atmel_nand 40000000.nand: No DMA support for NAND access.
ONFI param page 0 valid
ONFI flash detected
NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda (Micron MT29F2G08AAD)
Bad block table found at page 131008, version 0x01
Bad block table found at page 130944, version 0x01
nand_read_bbt: bad block at 0x000009380000
2 cmdlinepart partitions found on MTD device atmel_nand
Creating 2 MTD partitions on "atmel_nand":
0x000000000000-0x000000800000 : "bootstrap/uboot/kernel"
0x000000800000-0x000010000000 : "rootfs"
UBI: attaching mtd1 to ubi0
UBI: physical eraseblock size:   131072 bytes (128 KiB)
UBI: logical eraseblock size:    126976 bytes
UBI: smallest flash I/O unit:    2048
UBI: VID header offset:          2048 (aligned 2048)
UBI: data offset:                4096
UBI: max. sequence number:       4249
UBI warning: print_rsvd_warning: cannot reserve enough PEBs for bad PEB handling
, reserved 15, need 19
UBI: attached mtd1 to ubi0
UBI: MTD device name:            "rootfs"
UBI: MTD device size:            248 MiB
UBI: number of good PEBs:        1979
UBI: number of bad PEBs:         5
UBI: number of corrupted PEBs:   0
UBI: max. allowed volumes:       128
UBI: wear-leveling threshold:    4096
UBI: number of internal volumes: 1
UBI: number of user volumes:     1
UBI: available PEBs:             0
UBI: total number of reserved PEBs: 1979
UBI: number of PEBs reserved for bad PEB handling: 15
UBI: max/mean erase counter: 5/2
UBI: image sequence number:  191777507
UBI: background thread "ubi_bgt0d" started, PID 31
UBI error: ubi_init: cannot attach mtd1
tun: Universal TUN/TAP device driver, 1.6
tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>
macb f802c000.ethernet: (unregistered net_device): invalid hw address, using ran
dom
MACB_mii_bus: probed
macb f802c000.ethernet: eth0: Cadence MACB at 0xf802c000 irq 24 (4a:15:f4:49:94:
a4)
macb f802c000.ethernet: eth0: attached PHY driver [Davicom DM9161A] (mii_bus:phy
_addr=f802c000.etherne:00, irq=-1)
PPP generic driver version 2.4.2
NET: Registered protocol family 24
usbcore: registered new interface driver asix
usbcore: registered new interface driver cdc_ether
usbcore: registered new interface driver cdc_eem
usbcore: registered new interface driver net1080
usbcore: registered new interface driver cdc_subset
usbcore: registered new interface driver zaurus
usbcore: registered new interface driver ipheth
usbcore: registered new interface driver cdc_ncm
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
atmel-ehci 700000.ehci: Atmel EHCI UHP HS
atmel-ehci 700000.ehci: new USB bus registered, assigned bus number 1
atmel-ehci 700000.ehci: irq 22, io mem 0x00700000
atmel-ehci 700000.ehci: USB 2.0 started, EHCI 1.00
usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb1: Product: Atmel EHCI UHP HS
usb usb1: Manufacturer: Linux 3.4.0 ehci_hcd
usb usb1: SerialNumber: 700000.ehci
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 3 ports detected
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
at91_ohci 600000.ohci: AT91 OHCI
at91_ohci 600000.ohci: new USB bus registered, assigned bus number 2
at91_ohci 600000.ohci: irq 22, io mem 0x00600000
usb usb2: New USB device found, idVendor=1d6b, idProduct=0001
usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb2: Product: AT91 OHCI
usb usb2: Manufacturer: Linux 3.4.0 ohci_hcd
usb usb2: SerialNumber: at91
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 2 ports detected
usbcore: registered new interface driver cdc_acm
cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
usbcore: registered new interface driver libusual
usbcore: registered new interface driver usbserial
usbcore: registered new interface driver usbserial_generic
USB Serial support registered for generic
usbserial: USB Serial Driver core
usbcore: registered new interface driver moto-modem
USB Serial support registered for moto-modem
usbcore: registered new interface driver opticon
USB Serial support registered for opticon
usbcore: registered new interface driver pl2303
USB Serial support registered for pl2303
usbcore: registered new interface driver qcserial
USB Serial support registered for Qualcomm USB modem
usbcore: registered new interface driver symbol
USB Serial support registered for symbol
i2c /dev entries driver
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
nf_conntrack version 0.5.0 (1872 buckets, 7488 max)
IPv4 over IPv4 tunneling driver
ip_tables: (C) 2000-2006 Netfilter Core Team
TCP: cubic registered
NET: Registered protocol family 17
lib80211: common routines for IEEE802.11 drivers
Registering the dns_resolver key type
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
UBIFS: recovery needed
UBIFS: recovery completed
UBIFS: mounted UBI device 0, volume 0, name "rootfs"
UBIFS: file system size:   247476224 bytes (241676 KiB, 236 MiB, 1949 LEBs)
UBIFS: journal size:       9023488 bytes (8812 KiB, 8 MiB, 72 LEBs)
UBIFS: media format:       w4/r0 (latest is w4/r0)
UBIFS: default compressor: lzo
UBIFS: reserved for root:  0 bytes (0 KiB)
VFS: Mounted root (ubifs filesystem) on device 0:11.
devtmpfs: mounted
Freeing init memory: 144K
INIT: version 2.86 booting
Please wait: booting...
Starting udev
udev[62]: starting version 165
Root filesystem already rw, not remounting
Caching udev devnodes
Populating dev cache
logger: mount: mount point /proc/bus/usb does not exist
ALSA: Restoring mixer settings...
/usr/sbin/alsactl: load_state:1625: No soundcards found...
Configuring network interfaces... eth0      no wireless extensions.

udhcpc (v1.18.3) started
run-parts: /etc/udhcpc.d/00avahi-autoipd exited with code 1
Sending discover...
Sending discover...
Sending discover...
netlink: 12 bytes leftover after parsing attributes.
netlink: 12 bytes leftover after parsing attributes.
netlink: 12 bytes leftover after parsing attributes.
No lease, failing
done.
Starting portmap daemon: portmap.
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.all.rp_filter = 1
kernel.panic = 10
hwclock: can't open '/dev/misc/rtc': No such file or directory
Mon Nov  5 09:47:00 EST 2012
hwclock: can't open '/dev/misc/rtc': No such file or directory
INIT: Entering runlevel: 5
Starting system message bus: dbus.
Starting Dropbear SSH server: dropbear.
starting Busybox HTTP Daemon: httpd... done.
Starting Vixie-cron.
Starting ntpd: done
Starting syslogd/klogd: done
 * Starting Avahi mDNS/DNS-SD Daemon: avahi-daemon
   ...done.

> >

> > I noticed over at the linux-at91 fork that you had applied the PMECC

> > support on the 3.4.x_pmecc_dt_9x5 branch a few months ago.  From

> > browsing the mainline I didn't see some of your changes from that

> > branch in the mainline.  Are there some changes from the linux-at91

> fork that are still scheduled for mainlining?

> yes, this patch is not push to mainline yet. Currently the only concern

> is we are think about the PMECC error correct bits need to adjust by

> ONFI parameters that read from nand flash.

> But it is not decide yet. if no exception, this patch will push to

> mainline soon.

>

> Best Regards,

> Josh Wu

>

> > If it helps, here is the boot log when I tried to boot using a 3.7-

> rc8

> > kernel and DT.

> >

> > Thanks,

> > Bryan

> >

> > Uncompressing Linux... done, booting the kernel.

> > [    0.000000] Booting Linux on physical CPU 0

> > [    0.000000] Linux version 3.7.0-rc8-armv5-x0.16 (xxxx@xxxx) (gcc

> versio

> > n 4.6.2 20121016 (release) [ARM/embedded-4_6-branch revision 192487]

> > (GNU Tools for ARM Embedded Processors) ) #1 Wed Dec 5 16:11:30 EST

> 2012

> > [    0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ),

> cr=00053177

> > [    0.000000] CPU: VIVT data cache, VIVT instruction cache

> > [    0.000000] Machine: Atmel AT91SAM (Device Tree), model: Atmel

> AT91SAM9G25-EK

> > [    0.000000] Memory policy: ECC disabled, Data cache writeback

> > [    0.000000] AT91: Detected soc type: at91sam9x5

> > [    0.000000] AT91: Detected soc subtype: at91sam9g25

> > [    0.000000] AT91: sram at 0x300000 of 0x8000 mapped at 0xfef70000

> > [    0.000000] Clocks: CPU 400 MHz, master 133 MHz, main 12.000 MHz

> > [    0.000000] Built 1 zonelists in Zone order, mobility grouping on.

> Total pag

> > es: 32512

> > [    0.000000] Kernel command line: mem=128M console=ttyS0,115200

> mtdparts=atmel

> > _nand:8M(bootstrap/uboot/kernel)ro,-(rootfs) root=/dev/mtdblock1 rw

> > rootfstype=u bifs ubi.mtd=1 root=ubi0:rootfs

> > [    0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)

> > [    0.000000] Dentry cache hash table entries: 16384 (order: 4,

> 65536 bytes)

> > [    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768

> bytes)

> > [    0.000000] Memory: 128MB = 128MB total

> > [    0.000000] Memory: 124276k/124276k available, 6796k reserved, 0K

> highmem

> > [    0.000000] Virtual kernel memory layout:

> > [    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)

> > [    0.000000]     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)

> > [    0.000000]     vmalloc : 0xc8800000 - 0xff000000   ( 872 MB)

> > [    0.000000]     lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)

> > [    0.000000]     modules : 0xbf000000 - 0xc0000000   (  16 MB)

> > [    0.000000]       .text : 0xc0008000 - 0xc04b8630   (4802 kB)

> > [    0.000000]       .init : 0xc04b9000 - 0xc04e45c4   ( 174 kB)

> > [    0.000000]       .data : 0xc04e6000 - 0xc0516ce0   ( 196 kB)

> > [    0.000000]        .bss : 0xc0516d04 - 0xc05760bc   ( 381 kB)

> > [    0.000000] NR_IRQS:16 nr_irqs:16 16

> > [    0.000000] sched_clock: 32 bits at 256 Hz, resolution 3906250ns,

> wraps every

> >   3892314108ms

> > [    0.000000] Console: colour dummy device 80x30

> > [    0.035156] Calibrating delay loop... 199.80 BogoMIPS (lpj=389120)

> > [    0.035156] pid_max: default: 32768 minimum: 301

> > [    0.035156] Mount-cache hash table entries: 512

> > [    0.039062] CPU: Testing write buffer coherency: ok

> > [    0.039062] Setting up static identity map for 0x20371d48 -

> 0x20371da0

> > [    0.039062] devtmpfs: initialized

> > [    0.042968] NET: Registered protocol family 16

> > [    0.042968] DMA: preallocated 256 KiB pool for atomic coherent

> allocations

> > [    0.070312] No ATAGs?

> > [    0.070312] AT91: Power Management

> > [    0.070312] AT91: Starting after power-restored wakeup

> > [    0.121093] bio: create slab <bio-0> at 0

> > [    0.125000] SCSI subsystem initialized

> > [    0.128906] usbcore: registered new interface driver usbfs

> > [    0.128906] usbcore: registered new interface driver hub

> > [    0.128906] usbcore: registered new device driver usb

> > [    0.132812] at91_i2c f8010000.i2c: AT91 i2c bus driver.

> > [    0.132812] at91_i2c f8014000.i2c: AT91 i2c bus driver.

> > [    0.136718] at91_i2c f8018000.i2c: AT91 i2c bus driver.

> > [    0.140625] Switching to clocksource tcb_clksrc

> > [    0.195312] NET: Registered protocol family 2

> > [    0.199218] TCP established hash table entries: 4096 (order: 3,

> 32768 bytes)

> > [    0.199218] TCP bind hash table entries: 4096 (order: 2, 16384

> bytes)

> > [    0.199218] TCP: Hash tables configured (established 4096 bind

> 4096)

> > [    0.199218] TCP: reno registered

> > [    0.199218] UDP hash table entries: 256 (order: 0, 4096 bytes)

> > [    0.199218] UDP-Lite hash table entries: 256 (order: 0, 4096

> bytes)

> > [    0.199218] NET: Registered protocol family 1

> > [    0.199218] RPC: Registered named UNIX socket transport module.

> > [    0.199218] RPC: Registered udp transport module.

> > [    0.199218] RPC: Registered tcp transport module.

> > [    0.199218] RPC: Registered tcp NFSv4.1 backchannel transport

> module.

> > [    0.207031] NFS: Registering the id_resolver key type

> > [    0.207031] Key type id_resolver registered

> > [    0.207031] Key type id_legacy registered

> > [    0.207031] jffs2: version 2.2. (NAND) �© 2001-2006 Red Hat,

> Inc.

> > [    0.207031] msgmni has been set to 242

> > [    0.210937] io scheduler noop registered (default)

> > [    0.218750] fffff200.serial: ttyS0 at MMIO 0xfffff200 (irq = 18)

> is a ATMEL_S

> > ERIAL

> > [    0.609375] console [ttyS0] enabled

> > [    0.613281] f801c000.serial: ttyS1 at MMIO 0xf801c000 (irq = 22)

> is a ATMEL_S

> > ERIAL

> > [    0.632812] brd: module loaded

> > [    0.652343] loop: module loaded

> > [    0.667968] atmel_nand: Use On Flash BBT

> > [    0.671875] atmel_nand 40000000.nand: No DMA support for NAND

> access.

> > [    0.675781] ONFI param page 0 valid

> > [    0.679687] ONFI flash detected

> > [    0.683593] NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda

> (Micron MT29F2G

> > 08AAD), page size: 2048, OOB size: 64

> > [    0.695312] atmel_nand 40000000.nand: Initialize PMECC params,

> cap: 2, sector

> > : 512

> > [    0.703125] Bad block table found at page 131008, version 0x01

> > [    0.707031] Bad block table found at page 130944, version 0x01

> > [    0.714843] nand_read_bbt: bad block at 0x000009380000

> > [    0.718750] 2 cmdlinepart partitions found on MTD device

> atmel_nand

> > [    0.726562] Creating 2 MTD partitions on "atmel_nand":

> > [    0.730468] 0x000000000000-0x000000800000 :

> "bootstrap/uboot/kernel"

> > [    0.742187] 0x000000800000-0x000010000000 : "rootfs"

> > [    0.757812] macb f802c000.ethernet (unregistered net_device):

> invalid hw addr

> > ess, using random

> > [    0.773437] libphy: MACB_mii_bus: probed

> > [    0.777343] macb f802c000.ethernet eth0: Cadence MACB at

> 0xf802c000 irq 23 (c

> > a:2c:e6:c3:59:8f)

> > [    0.785156] macb f802c000.ethernet eth0: attached PHY driver

> [Davicom DM9161A

> > ] (mii_bus:phy_addr=f802c000.etherne:00, irq=-1)

> > [    0.796875] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI)

> Driver

> > [    0.804687] atmel-ehci 700000.ehci: Atmel EHCI UHP HS

> > [    0.808593] atmel-ehci 700000.ehci: new USB bus registered,

> assigned bus numb

> > er 1

> > [    0.816406] atmel-ehci 700000.ehci: irq 28, io mem 0x00700000

> > [    0.835937] atmel-ehci 700000.ehci: USB 2.0 started, EHCI 1.00

> > [    0.839843] usb usb1: New USB device found, idVendor=1d6b,

> idProduct=0002

> > [    0.847656] usb usb1: New USB device strings: Mfr=3, Product=2,

> SerialNumber=

> > 1

> > [    0.855468] usb usb1: Product: Atmel EHCI UHP HS

> > [    0.859375] usb usb1: Manufacturer: Linux 3.7.0-rc8-armv5-x0.16

> ehci_hcd

> > [    0.867187] usb usb1: SerialNumber: 700000.ehci

> > [    0.871093] hub 1-0:1.0: USB hub found

> > [    0.875000] hub 1-0:1.0: 3 ports detected

> > [    0.878906] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver

> > [    0.886718] at91_ohci 600000.ohci: AT91 OHCI

> > [    0.890625] at91_ohci 600000.ohci: new USB bus registered,

> assigned bus numbe

> > r 2

> > [    0.898437] at91_ohci 600000.ohci: irq 28, io mem 0x00600000

> > [    0.964843] usb usb2: New USB device found, idVendor=1d6b,

> idProduct=0001

> > [    0.968750] usb usb2: New USB device strings: Mfr=3, Product=2,

> SerialNumber=

> > 1

> > [    0.976562] usb usb2: Product: AT91 OHCI

> > [    0.980468] usb usb2: Manufacturer: Linux 3.7.0-rc8-armv5-x0.16

> ohci_hcd

> > [    0.988281] usb usb2: SerialNumber: at91

> > [    0.992187] hub 2-0:1.0: USB hub found

> > [    0.996093] hub 2-0:1.0: 2 ports detected

> > [    1.003906] usbcore: registered new interface driver cdc_acm

> > [    1.007812] cdc_acm: USB Abstract Control Model driver for USB

> modems and ISD

> > N adapters

> > [    1.019531] usbcore: registered new interface driver uas

> > [    1.023437] Initializing USB Mass Storage driver...

> > [    1.027343] usbcore: registered new interface driver usb-storage

> > [    1.035156] USB Mass Storage support registered.

> > [    1.039062] usbcore: registered new interface driver ums-alauda

> > [    1.046875] usbcore: registered new interface driver ums-cypress

> > [    1.054687] usbcore: registered new interface driver ums-datafab

> > [    1.058593] usbcore: registered new interface driver ums_eneub6250

> > [    1.066406] usbcore: registered new interface driver ums-freecom

> > [    1.074218] usbcore: registered new interface driver ums-isd200

> > [    1.078125] usbcore: registered new interface driver ums-jumpshot

> > [    1.085937] usbcore: registered new interface driver ums-karma

> > [    1.093750] usbcore: registered new interface driver ums-onetouch

> > [    1.097656] usbcore: registered new interface driver ums-realtek

> > [    1.105468] usbcore: registered new interface driver ums-sddr09

> > [    1.113281] usbcore: registered new interface driver ums-sddr55

> > [    1.117187] usbcore: registered new interface driver ums-usbat

> > [    1.125000] usbcore: registered new interface driver usbserial

> > [    1.132812] usbcore: registered new interface driver

> usbserial_generic

> > [    1.140625] usbserial: USB Serial support registered for generic

> > [    1.144531] usbcore: registered new interface driver ftdi_sio

> > [    1.152343] usbserial: USB Serial support registered for FTDI USB

> Serial Devi

> > ce

> > [    1.160156] usbcore: registered new interface driver pl2303

> > [    1.167968] usbserial: USB Serial support registered for pl2303

> > [    1.171875] mousedev: PS/2 mouse device common for all mice

> > [    1.179687] i2c /dev entries driver

> > [    1.191406] usbcore: registered new interface driver usbhid

> > [    1.199218] usbhid: USB HID core driver

> > [    1.207031] usb 1-2: new high-speed USB device number 2 using

> atmel-ehci

> > [    1.214843] TCP: cubic registered

> > [    1.218750] NET: Registered protocol family 10

> > [    1.222656] sit: IPv6 over IPv4 tunneling driver

> > [    1.230468] NET: Registered protocol family 17

> > [    1.234375] Key type dns_resolver registered

> > [    1.246093] UBI: attaching mtd1 to ubi0

> > [    1.253906] atmel_nand 40000000.nand: PMECC: Too many errors

> > [    1.261718] UBI warning: ubi_io_read: error -5 while reading 64

> bytes from PE

> > B 10:0, read only 0 bytes, retry

> > [    1.269531] atmel_nand 40000000.nand: PMECC: Too many errors

> > [    1.277343] UBI warning: ubi_io_read: error -5 while reading 64

> bytes from PE

> > B 10:0, read only 0 bytes, retry

> > [    1.285156] atmel_nand 40000000.nand: PMECC: Too many errors

> > [    1.292968] UBI warning: ubi_io_read: error -5 while reading 64

> bytes from PE

> > B 10:0, read only 0 bytes, retry

> > [    1.304687] atmel_nand 40000000.nand: PMECC: Too many errors

> > [    1.308593] UBI error: ubi_io_read: error -5 while reading 64

> bytes from PEB

> > 10:0, read 0 bytes

> > [    1.316406] [<c000d2bc>] (unwind_backtrace+0x0/0xe0) from

> [<c0243a10>] (ubi_i

> > o_read+0x1d4/0x2a4)

> > [    1.328125] [<c0243a10>] (ubi_io_read+0x1d4/0x2a4) from

> [<c0243d20>] (ubi_io_

> > read_ec_hdr+0x68/0x214)

> > [    1.335937] [<c0243d20>] (ubi_io_read_ec_hdr+0x68/0x214) from

> [<c024804c>] (u

> > bi_attach+0x104/0x13e4)

> > [    1.343750] [<c024804c>] (ubi_attach+0x104/0x13e4) from

> [<c023e514>] (ubi_att

> > ach_mtd_dev+0x5a4/0xb94)

> > [    1.355468] [<c023e514>] (ubi_attach_mtd_dev+0x5a4/0xb94) from

> [<c04d09dc>] (

> > ubi_init+0x1d8/0x2d8)

> > [    1.363281] [<c04d09dc>] (ubi_init+0x1d8/0x2d8) from [<c0008860>]

> (do_one_ini

> > tcall+0x90/0x168)

> > [    1.371093] [<c0008860>] (do_one_initcall+0x90/0x168) from

> [<c03686a4>] (kern

> > el_init+0xe8/0x2a0)

> > [    1.378906] [<c03686a4>] (kernel_init+0xe8/0x2a0) from

> [<c00093f0>] (ret_from

> > _fork+0x14/0x24)

> > [    1.386718] UBI error: ubi_attach_mtd_dev: failed to attach mtd1,

> error -5

> > [    1.394531] UBI error: ubi_init: cannot attach mtd1

> > [    1.402343] drivers/rtc/hctosys.c: unable to open rtc device

> (rtc0)

> > [    1.410156] UBIFS error (pid 1): ubifs_mount: cannot open

> "ubi0:rootfs", erro

> > r -19

> > [    1.417968] VFS: Cannot open root device "ubi0:rootfs" or unknown-

> block(0,0):

> >   error -19

> > [    1.425781] Please append a correct "root=" boot option; here are

> the availab

> > le partitions:

> > [    1.433593] 1f00            8192 mtdblock0  (driver?)

> > [    1.437500] 1f01          253952 mtdblock1  (driver?)

> > [    1.441406] Kernel panic - not syncing: VFS: Unable to mount root

> fs on unkno

> > wn-block(0,0)

> >

> >
Wu, Josh - Dec. 7, 2012, 9:30 a.m.
Hi, Bryan

Thanks for doing such test. see my comment below:

On 12/6/2012 9:20 PM, Bryan Evenson wrote:
>> -----Original Message-----
>> From: Josh Wu [mailto:josh.wu@atmel.com]
>> Sent: Thursday, December 06, 2012 5:30 AM
>> To: Bryan Evenson
>> Cc: linux-arm-kernel@lists.infradead.org
>> Subject: Re: at91: Status of NAND flash access
>>
>> On 12/6/2012 11:13 AM, Bryan Evenson wrote:
>>> Josh,
>>>
>>> I spoke too soon.  I was able to read and use the filesystem from
>> NAND
>>> flash with the patch you provided when I applied it to the Atmel 3.4
>>> kernel fork over at https://github.com/linux4sam/linux-at91/ (master
>> branch).
>>> When I applied the same patch to the recent mainline kernel (3.7-
>> rc8),
>>> it's still having problems accessing flash.  The boot log shows that
>>> it is setting up for PMECC correctly, but it has errors when it tries
>>> to read from the filesystem.
>> It is strange.  The 3.4 kernel from at91 github just have a few
>> changes.
>> so rationally it behavior the same at PMECC function. From your log,
>> the
>> 3.7-rc8 kernel says the PMECC found uncorrectable errors.
>>
>> Can you try to dump or read from the u-boot? to see whether u-boot can
>> recognize the same nand page that "too many errors" happened in kernel?
>> I will do some test to see whether the 3.7-rc8 can work in my side or
>> not.
> U-Boot> nand read 0x22000000 0x800000 0x1D00000
>
> NAND read: device 0 offset 0x800000, size 0x1d00000
> PMECC: Too many errors
> NAND read from offset 800000 failed -5
>   0 bytes read: ERROR
>
> So u-boot has the same issue.
seems some page are really damaged or the error correction code has bugs.

> However, changing the kernel to the linux-at91
> forked kernel produced different results.  That kernel noted the PMECC errors
> but was still able to load the filesystem.
I don't find the 3.4 kernel noted the PMECC errors in your attached log.

>    My boot output from the successful
> filesystem load is below.  Is the 3.4 kernel performing corrections that the
> mainline is not,

no. I don't think so. The PMECC part of patch is the almost same. Only 
some minor change are made in v3.4 for back port.

> or is it just ignoring errors that it should not be ignoring?

This is more possible. I means maybe 3.4 kernel doesn't check some area 
3.7-rc8 checked.

>
> I'm hesitant to make any filesystem changes on this board because I know test
> cases like this where it works one way but not the other are kind of rare.  Let
> me know if you have similar results on your end.
I tested in two version of kernel my side:
  1. https://github.com/linux4sam/linux-at91/commits/at91-3.4-trunk_merge
           fcf88e036fce6c382510874b1dc90e9b49608ccf (Merge branch 
'at91-3.4-trunk/v3.4.x_gmac' into at91-3.4-trunk_merge)
  2. v3.7-rc8 plus the patch I sent to you to enable PMECC in dtsi.

I cannot reproduce the situation you met In my side. Both can boot the 
ubi rootfs system correctly.

So the your case is rare.

To find out why those two kernel work differently, could you help me to do:

    1. use u-boot "nand read" to do some bisect in nand flash offset, 
which we can narrow down the page that has uncorrectable pmecc errors.

    2. use u-boot "nand dump offset" to show the raw data of that page. 
please send me the log. I can generate the same page from your log. and 
check whether it can be corrected in my side.

    3. in 3.4 kernel, use dd command to read that page, to see any 
uncorrectable pmecc error happen.
          if no error happens in 3.4, then it means it correct that 
v3.7-rc8 cannot. There mush be something different in 3.4 kernel pmecc 
between mainline.
          if error happens, that means 3.4 kernel skips those area but 
3.7-rc8 does not. So I suspect it maybe caused by some code of UBI part 
changes.

Best Regards,
Josh Wu

>
> -Bryan
>
> Uncompressing Linux... done, booting the kernel.
> Booting Linux on physical CPU 0
> Linux version 3.4.0 (xxxx@xxxx) (gcc version 4.5.3 20110311 (prerelease) (
> GCC) ) #2 Wed Dec 5 15:36:29 EST 2012
> CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
> CPU: VIVT data cache, VIVT instruction cache
> Machine: Atmel AT91SAM (Device Tree), model: Atmel AT91SAM9G25-EK
> Memory policy: ECC disabled, Data cache writeback
> AT91: Detected soc type: at91sam9x5
> AT91: Detected soc subtype: at91sam9g25
> AT91: sram at 0x300000 of 0x8000 mapped at 0xfef70000
> Clocks: CPU 400 MHz, master 133 MHz, main 12.000 MHz
> gpiochip_add: registered GPIOs 0 to 31 on device: pioA
> gpiochip_add: registered GPIOs 32 to 63 on device: pioB
> gpiochip_add: registered GPIOs 64 to 95 on device: pioC
> gpiochip_add: registered GPIOs 96 to 127 on device: pioD
> Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512
> Kernel command line: mem=128M console=ttyS0,115200 mtdparts=atmel_nand:8M(bootst
> rap/uboot/kernel)ro,-(rootfs) root=/dev/mtdblock1 rw rootfstype=ubifs ubi.mtd=1
> root=ubi0:rootfs
> PID hash table entries: 512 (order: -1, 2048 bytes)
> Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
> Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
> Memory: 128MB = 128MB total
> Memory: 119856k/119856k available, 11216k reserved, 0K highmem
> Virtual kernel memory layout:
>      vector  : 0xffff0000 - 0xffff1000   (   4 kB)
>      fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
>      vmalloc : 0xc8800000 - 0xff000000   ( 872 MB)
>      lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)
>      modules : 0xbf000000 - 0xc0000000   (  16 MB)
>        .text : 0xc0008000 - 0xc04650d4   (4469 kB)
>        .init : 0xc0466000 - 0xc048a000   ( 144 kB)
>        .data : 0xc048a000 - 0xc04c4420   ( 234 kB)
>         .bss : 0xc04c4444 - 0xc09c66e4   (5129 kB)
> NR_IRQS:192
> sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every 4294967286ms
> Console: colour dummy device 80x30
> Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar
> ... MAX_LOCKDEP_SUBCLASSES:  8
> ... MAX_LOCK_DEPTH:          48
> ... MAX_LOCKDEP_KEYS:        8191
> ... CLASSHASH_SIZE:          4096
> ... MAX_LOCKDEP_ENTRIES:     16384
> ... MAX_LOCKDEP_CHAINS:      32768
> ... CHAINHASH_SIZE:          16384
>   memory used by lock dependency info: 3695 kB
>   per task-struct memory footprint: 1152 bytes
> ------------------------
> | Locking API testsuite:
> ----------------------------------------------------------------------------
>                                   | spin |wlock |rlock |mutex | wsem | rsem |
>    --------------------------------------------------------------------------
>                       A-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
>                   A-B-B-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
>               A-B-B-C-C-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
>               A-B-C-A-B-C deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
>           A-B-B-C-C-D-D-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
>           A-B-C-D-B-D-D-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
>           A-B-C-D-B-C-D-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
>                      double unlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
>                    initialize held:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
>                   bad unlock order:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
>    --------------------------------------------------------------------------
>                recursive read-lock:             |  ok  |             |  ok  |
>             recursive read-lock #2:             |  ok  |             |  ok  |
>              mixed read-write-lock:             |  ok  |             |  ok  |
>              mixed write-read-lock:             |  ok  |             |  ok  |
>    --------------------------------------------------------------------------
>       hard-irqs-on + irq-safe-A/12:  ok  |  ok  |  ok  |
>       soft-irqs-on + irq-safe-A/12:  ok  |  ok  |  ok  |
>       hard-irqs-on + irq-safe-A/21:  ok  |  ok  |  ok  |
>       soft-irqs-on + irq-safe-A/21:  ok  |  ok  |  ok  |
>         sirq-safe-A => hirqs-on/12:  ok  |  ok  |  ok  |
>         sirq-safe-A => hirqs-on/21:  ok  |  ok  |  ok  |
>           hard-safe-A + irqs-on/12:  ok  |  ok  |  ok  |
>           soft-safe-A + irqs-on/12:  ok  |  ok  |  ok  |
>           hard-safe-A + irqs-on/21:  ok  |  ok  |  ok  |
>           soft-safe-A + irqs-on/21:  ok  |  ok  |  ok  |
>      hard-safe-A + unsafe-B #1/123:  ok  |  ok  |  ok  |
>      soft-safe-A + unsafe-B #1/123:  ok  |  ok  |  ok  |
>      hard-safe-A + unsafe-B #1/132:  ok  |  ok  |  ok  |
>      soft-safe-A + unsafe-B #1/132:  ok  |  ok  |  ok  |
>      hard-safe-A + unsafe-B #1/213:  ok  |  ok  |  ok  |
>      soft-safe-A + unsafe-B #1/213:  ok  |  ok  |  ok  |
>      hard-safe-A + unsafe-B #1/231:  ok  |  ok  |  ok  |
>      soft-safe-A + unsafe-B #1/231:  ok  |  ok  |  ok  |
>      hard-safe-A + unsafe-B #1/312:  ok  |  ok  |  ok  |
>      soft-safe-A + unsafe-B #1/312:  ok  |  ok  |  ok  |
>      hard-safe-A + unsafe-B #1/321:  ok  |  ok  |  ok  |
>      soft-safe-A + unsafe-B #1/321:  ok  |  ok  |  ok  |
>      hard-safe-A + unsafe-B #2/123:  ok  |  ok  |  ok  |
>      soft-safe-A + unsafe-B #2/123:  ok  |  ok  |  ok  |
>      hard-safe-A + unsafe-B #2/132:  ok  |  ok  |  ok  |
>      soft-safe-A + unsafe-B #2/132:  ok  |  ok  |  ok  |
>      hard-safe-A + unsafe-B #2/213:  ok  |  ok  |  ok  |
>      soft-safe-A + unsafe-B #2/213:  ok  |  ok  |  ok  |
>      hard-safe-A + unsafe-B #2/231:  ok  |  ok  |  ok  |
>      soft-safe-A + unsafe-B #2/231:  ok  |  ok  |  ok  |
>      hard-safe-A + unsafe-B #2/312:  ok  |  ok  |  ok  |
>      soft-safe-A + unsafe-B #2/312:  ok  |  ok  |  ok  |
>      hard-safe-A + unsafe-B #2/321:  ok  |  ok  |  ok  |
>      soft-safe-A + unsafe-B #2/321:  ok  |  ok  |  ok  |
>        hard-irq lock-inversion/123:  ok  |  ok  |  ok  |
>        soft-irq lock-inversion/123:  ok  |  ok  |  ok  |
>        hard-irq lock-inversion/132:  ok  |  ok  |  ok  |
>        soft-irq lock-inversion/132:  ok  |  ok  |  ok  |
>        hard-irq lock-inversion/213:  ok  |  ok  |  ok  |
>        soft-irq lock-inversion/213:  ok  |  ok  |  ok  |
>        hard-irq lock-inversion/231:  ok  |  ok  |  ok  |
>        soft-irq lock-inversion/231:  ok  |  ok  |  ok  |
>        hard-irq lock-inversion/312:  ok  |  ok  |  ok  |
>        soft-irq lock-inversion/312:  ok  |  ok  |  ok  |
>        hard-irq lock-inversion/321:  ok  |  ok  |  ok  |
>        soft-irq lock-inversion/321:  ok  |  ok  |  ok  |
>        hard-irq read-recursion/123:  ok  |
>        soft-irq read-recursion/123:  ok  |
>        hard-irq read-recursion/132:  ok  |
>        soft-irq read-recursion/132:  ok  |
>        hard-irq read-recursion/213:  ok  |
>        soft-irq read-recursion/213:  ok  |
>        hard-irq read-recursion/231:  ok  |
>        soft-irq read-recursion/231:  ok  |
>        hard-irq read-recursion/312:  ok  |
>        soft-irq read-recursion/312:  ok  |
>        hard-irq read-recursion/321:  ok  |
>        soft-irq read-recursion/321:  ok  |
> -------------------------------------------------------
> Good, all 218 testcases passed! |
> ---------------------------------
> Calibrating delay loop... 198.04 BogoMIPS (lpj=990208)
> pid_max: default: 32768 minimum: 301
> Mount-cache hash table entries: 512
> CPU: Testing write buffer coherency: ok
> Setting up static identity map for 0x2033ced8 - 0x2033cf30
> devtmpfs: initialized
> dummy:
> NET: Registered protocol family 16
> AT91: Power Management (with slow clock mode)
> AT91: Starting after power-restored wakeup
> bio: create slab <bio-0> at 0
> at_hdmac ffffec00.dma-controller: Atmel AHB DMA Controller ( cpy slave ), 8 chan
> nels
> at_hdmac ffffee00.dma-controller: Atmel AHB DMA Controller ( cpy slave ), 8 chan
> nels
> SCSI subsystem initialized
> usbcore: registered new interface driver usbfs
> usbcore: registered new interface driver hub
> usbcore: registered new device driver usb
> cfg80211: Calling CRDA to update world regulatory domain
> Switching to clocksource tcb_clksrc
> NET: Registered protocol family 2
> IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
> TCP established hash table entries: 4096 (order: 3, 32768 bytes)
> TCP bind hash table entries: 4096 (order: 5, 147456 bytes)
> TCP: Hash tables configured (established 4096 bind 4096)
> TCP: reno registered
> UDP hash table entries: 64 (order: 0, 5120 bytes)
> UDP-Lite hash table entries: 64 (order: 0, 5120 bytes)
> NET: Registered protocol family 1
> RPC: Registered named UNIX socket transport module.
> RPC: Registered udp transport module.
> RPC: Registered tcp transport module.
> RPC: Registered tcp NFSv4.1 backchannel transport module.
> NFS: Registering the id_resolver key type
> jffs2: version 2.2. (NAND) (SUMMARY)  �© 2001-2006 Red Hat, Inc.
> msgmni has been set to 234
> Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
> io scheduler noop registered (default)
> fffff200.serial: ttyS0 at MMIO 0xfffff200 (irq = 1) is a ATMEL_SERIAL
> console [ttyS0] enabled
> f801c000.serial: ttyS1 at MMIO 0xf801c000 (irq = 5) is a ATMEL_SERIAL
> f8020000.serial: ttyS2 at MMIO 0xf8020000 (irq = 6) is a ATMEL_SERIAL
> f8028000.serial: ttyS4 at MMIO 0xf8028000 (irq = 8) is a ATMEL_SERIAL
> brd: module loaded
> loop: module loaded
> mtdoops: mtd device (mtddev=name/number) must be supplied
> atmel_nand: Use On Flash BBT
> atmel_nand 40000000.nand: No DMA support for NAND access.
> ONFI param page 0 valid
> ONFI flash detected
> NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda (Micron MT29F2G08AAD)
> Bad block table found at page 131008, version 0x01
> Bad block table found at page 130944, version 0x01
> nand_read_bbt: bad block at 0x000009380000
> 2 cmdlinepart partitions found on MTD device atmel_nand
> Creating 2 MTD partitions on "atmel_nand":
> 0x000000000000-0x000000800000 : "bootstrap/uboot/kernel"
> 0x000000800000-0x000010000000 : "rootfs"
> UBI: attaching mtd1 to ubi0
> UBI: physical eraseblock size:   131072 bytes (128 KiB)
> UBI: logical eraseblock size:    126976 bytes
> UBI: smallest flash I/O unit:    2048
> UBI: VID header offset:          2048 (aligned 2048)
> UBI: data offset:                4096
> UBI: max. sequence number:       4249
> UBI warning: print_rsvd_warning: cannot reserve enough PEBs for bad PEB handling
> , reserved 15, need 19
> UBI: attached mtd1 to ubi0
> UBI: MTD device name:            "rootfs"
> UBI: MTD device size:            248 MiB
> UBI: number of good PEBs:        1979
> UBI: number of bad PEBs:         5
> UBI: number of corrupted PEBs:   0
> UBI: max. allowed volumes:       128
> UBI: wear-leveling threshold:    4096
> UBI: number of internal volumes: 1
> UBI: number of user volumes:     1
> UBI: available PEBs:             0
> UBI: total number of reserved PEBs: 1979
> UBI: number of PEBs reserved for bad PEB handling: 15
> UBI: max/mean erase counter: 5/2
> UBI: image sequence number:  191777507
> UBI: background thread "ubi_bgt0d" started, PID 31
> UBI error: ubi_init: cannot attach mtd1
> tun: Universal TUN/TAP device driver, 1.6
> tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>
> macb f802c000.ethernet: (unregistered net_device): invalid hw address, using ran
> dom
> MACB_mii_bus: probed
> macb f802c000.ethernet: eth0: Cadence MACB at 0xf802c000 irq 24 (4a:15:f4:49:94:
> a4)
> macb f802c000.ethernet: eth0: attached PHY driver [Davicom DM9161A] (mii_bus:phy
> _addr=f802c000.etherne:00, irq=-1)
> PPP generic driver version 2.4.2
> NET: Registered protocol family 24
> usbcore: registered new interface driver asix
> usbcore: registered new interface driver cdc_ether
> usbcore: registered new interface driver cdc_eem
> usbcore: registered new interface driver net1080
> usbcore: registered new interface driver cdc_subset
> usbcore: registered new interface driver zaurus
> usbcore: registered new interface driver ipheth
> usbcore: registered new interface driver cdc_ncm
> ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
> atmel-ehci 700000.ehci: Atmel EHCI UHP HS
> atmel-ehci 700000.ehci: new USB bus registered, assigned bus number 1
> atmel-ehci 700000.ehci: irq 22, io mem 0x00700000
> atmel-ehci 700000.ehci: USB 2.0 started, EHCI 1.00
> usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
> usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
> usb usb1: Product: Atmel EHCI UHP HS
> usb usb1: Manufacturer: Linux 3.4.0 ehci_hcd
> usb usb1: SerialNumber: 700000.ehci
> hub 1-0:1.0: USB hub found
> hub 1-0:1.0: 3 ports detected
> ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
> at91_ohci 600000.ohci: AT91 OHCI
> at91_ohci 600000.ohci: new USB bus registered, assigned bus number 2
> at91_ohci 600000.ohci: irq 22, io mem 0x00600000
> usb usb2: New USB device found, idVendor=1d6b, idProduct=0001
> usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
> usb usb2: Product: AT91 OHCI
> usb usb2: Manufacturer: Linux 3.4.0 ohci_hcd
> usb usb2: SerialNumber: at91
> hub 2-0:1.0: USB hub found
> hub 2-0:1.0: 2 ports detected
> usbcore: registered new interface driver cdc_acm
> cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
> Initializing USB Mass Storage driver...
> usbcore: registered new interface driver usb-storage
> USB Mass Storage support registered.
> usbcore: registered new interface driver libusual
> usbcore: registered new interface driver usbserial
> usbcore: registered new interface driver usbserial_generic
> USB Serial support registered for generic
> usbserial: USB Serial Driver core
> usbcore: registered new interface driver moto-modem
> USB Serial support registered for moto-modem
> usbcore: registered new interface driver opticon
> USB Serial support registered for opticon
> usbcore: registered new interface driver pl2303
> USB Serial support registered for pl2303
> usbcore: registered new interface driver qcserial
> USB Serial support registered for Qualcomm USB modem
> usbcore: registered new interface driver symbol
> USB Serial support registered for symbol
> i2c /dev entries driver
> usbcore: registered new interface driver usbhid
> usbhid: USB HID core driver
> nf_conntrack version 0.5.0 (1872 buckets, 7488 max)
> IPv4 over IPv4 tunneling driver
> ip_tables: (C) 2000-2006 Netfilter Core Team
> TCP: cubic registered
> NET: Registered protocol family 17
> lib80211: common routines for IEEE802.11 drivers
> Registering the dns_resolver key type
> drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
> UBIFS: recovery needed
> UBIFS: recovery completed
> UBIFS: mounted UBI device 0, volume 0, name "rootfs"
> UBIFS: file system size:   247476224 bytes (241676 KiB, 236 MiB, 1949 LEBs)
> UBIFS: journal size:       9023488 bytes (8812 KiB, 8 MiB, 72 LEBs)
> UBIFS: media format:       w4/r0 (latest is w4/r0)
> UBIFS: default compressor: lzo
> UBIFS: reserved for root:  0 bytes (0 KiB)
> VFS: Mounted root (ubifs filesystem) on device 0:11.
> devtmpfs: mounted
> Freeing init memory: 144K
> INIT: version 2.86 booting
> Please wait: booting...
> Starting udev
> udev[62]: starting version 165
> Root filesystem already rw, not remounting
> Caching udev devnodes
> Populating dev cache
> logger: mount: mount point /proc/bus/usb does not exist
> ALSA: Restoring mixer settings...
> /usr/sbin/alsactl: load_state:1625: No soundcards found...
> Configuring network interfaces... eth0      no wireless extensions.
>
> udhcpc (v1.18.3) started
> run-parts: /etc/udhcpc.d/00avahi-autoipd exited with code 1
> Sending discover...
> Sending discover...
> Sending discover...
> netlink: 12 bytes leftover after parsing attributes.
> netlink: 12 bytes leftover after parsing attributes.
> netlink: 12 bytes leftover after parsing attributes.
> No lease, failing
> done.
> Starting portmap daemon: portmap.
> net.ipv4.conf.default.rp_filter = 1
> net.ipv4.conf.all.rp_filter = 1
> kernel.panic = 10
> hwclock: can't open '/dev/misc/rtc': No such file or directory
> Mon Nov  5 09:47:00 EST 2012
> hwclock: can't open '/dev/misc/rtc': No such file or directory
> INIT: Entering runlevel: 5
> Starting system message bus: dbus.
> Starting Dropbear SSH server: dropbear.
> starting Busybox HTTP Daemon: httpd... done.
> Starting Vixie-cron.
> Starting ntpd: done
> Starting syslogd/klogd: done
>   * Starting Avahi mDNS/DNS-SD Daemon: avahi-daemon
>     ...done.
>
>>> I noticed over at the linux-at91 fork that you had applied the PMECC
>>> support on the 3.4.x_pmecc_dt_9x5 branch a few months ago.  From
>>> browsing the mainline I didn't see some of your changes from that
>>> branch in the mainline.  Are there some changes from the linux-at91
>> fork that are still scheduled for mainlining?
>> yes, this patch is not push to mainline yet. Currently the only concern
>> is we are think about the PMECC error correct bits need to adjust by
>> ONFI parameters that read from nand flash.
>> But it is not decide yet. if no exception, this patch will push to
>> mainline soon.
>>
>> Best Regards,
>> Josh Wu
>>
>>> If it helps, here is the boot log when I tried to boot using a 3.7-
>> rc8
>>> kernel and DT.
>>>
>>> Thanks,
>>> Bryan
>>>
>>> Uncompressing Linux... done, booting the kernel.
>>> [    0.000000] Booting Linux on physical CPU 0
>>> [    0.000000] Linux version 3.7.0-rc8-armv5-x0.16 (xxxx@xxxx) (gcc
>> versio
>>> n 4.6.2 20121016 (release) [ARM/embedded-4_6-branch revision 192487]
>>> (GNU Tools for ARM Embedded Processors) ) #1 Wed Dec 5 16:11:30 EST
>> 2012
>>> [    0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ),
>> cr=00053177
>>> [    0.000000] CPU: VIVT data cache, VIVT instruction cache
>>> [    0.000000] Machine: Atmel AT91SAM (Device Tree), model: Atmel
>> AT91SAM9G25-EK
>>> [    0.000000] Memory policy: ECC disabled, Data cache writeback
>>> [    0.000000] AT91: Detected soc type: at91sam9x5
>>> [    0.000000] AT91: Detected soc subtype: at91sam9g25
>>> [    0.000000] AT91: sram at 0x300000 of 0x8000 mapped at 0xfef70000
>>> [    0.000000] Clocks: CPU 400 MHz, master 133 MHz, main 12.000 MHz
>>> [    0.000000] Built 1 zonelists in Zone order, mobility grouping on.
>> Total pag
>>> es: 32512
>>> [    0.000000] Kernel command line: mem=128M console=ttyS0,115200
>> mtdparts=atmel
>>> _nand:8M(bootstrap/uboot/kernel)ro,-(rootfs) root=/dev/mtdblock1 rw
>>> rootfstype=u bifs ubi.mtd=1 root=ubi0:rootfs
>>> [    0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)
>>> [    0.000000] Dentry cache hash table entries: 16384 (order: 4,
>> 65536 bytes)
>>> [    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768
>> bytes)
>>> [    0.000000] Memory: 128MB = 128MB total
>>> [    0.000000] Memory: 124276k/124276k available, 6796k reserved, 0K
>> highmem
>>> [    0.000000] Virtual kernel memory layout:
>>> [    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
>>> [    0.000000]     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
>>> [    0.000000]     vmalloc : 0xc8800000 - 0xff000000   ( 872 MB)
>>> [    0.000000]     lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)
>>> [    0.000000]     modules : 0xbf000000 - 0xc0000000   (  16 MB)
>>> [    0.000000]       .text : 0xc0008000 - 0xc04b8630   (4802 kB)
>>> [    0.000000]       .init : 0xc04b9000 - 0xc04e45c4   ( 174 kB)
>>> [    0.000000]       .data : 0xc04e6000 - 0xc0516ce0   ( 196 kB)
>>> [    0.000000]        .bss : 0xc0516d04 - 0xc05760bc   ( 381 kB)
>>> [    0.000000] NR_IRQS:16 nr_irqs:16 16
>>> [    0.000000] sched_clock: 32 bits at 256 Hz, resolution 3906250ns,
>> wraps every
>>>    3892314108ms
>>> [    0.000000] Console: colour dummy device 80x30
>>> [    0.035156] Calibrating delay loop... 199.80 BogoMIPS (lpj=389120)
>>> [    0.035156] pid_max: default: 32768 minimum: 301
>>> [    0.035156] Mount-cache hash table entries: 512
>>> [    0.039062] CPU: Testing write buffer coherency: ok
>>> [    0.039062] Setting up static identity map for 0x20371d48 -
>> 0x20371da0
>>> [    0.039062] devtmpfs: initialized
>>> [    0.042968] NET: Registered protocol family 16
>>> [    0.042968] DMA: preallocated 256 KiB pool for atomic coherent
>> allocations
>>> [    0.070312] No ATAGs?
>>> [    0.070312] AT91: Power Management
>>> [    0.070312] AT91: Starting after power-restored wakeup
>>> [    0.121093] bio: create slab <bio-0> at 0
>>> [    0.125000] SCSI subsystem initialized
>>> [    0.128906] usbcore: registered new interface driver usbfs
>>> [    0.128906] usbcore: registered new interface driver hub
>>> [    0.128906] usbcore: registered new device driver usb
>>> [    0.132812] at91_i2c f8010000.i2c: AT91 i2c bus driver.
>>> [    0.132812] at91_i2c f8014000.i2c: AT91 i2c bus driver.
>>> [    0.136718] at91_i2c f8018000.i2c: AT91 i2c bus driver.
>>> [    0.140625] Switching to clocksource tcb_clksrc
>>> [    0.195312] NET: Registered protocol family 2
>>> [    0.199218] TCP established hash table entries: 4096 (order: 3,
>> 32768 bytes)
>>> [    0.199218] TCP bind hash table entries: 4096 (order: 2, 16384
>> bytes)
>>> [    0.199218] TCP: Hash tables configured (established 4096 bind
>> 4096)
>>> [    0.199218] TCP: reno registered
>>> [    0.199218] UDP hash table entries: 256 (order: 0, 4096 bytes)
>>> [    0.199218] UDP-Lite hash table entries: 256 (order: 0, 4096
>> bytes)
>>> [    0.199218] NET: Registered protocol family 1
>>> [    0.199218] RPC: Registered named UNIX socket transport module.
>>> [    0.199218] RPC: Registered udp transport module.
>>> [    0.199218] RPC: Registered tcp transport module.
>>> [    0.199218] RPC: Registered tcp NFSv4.1 backchannel transport
>> module.
>>> [    0.207031] NFS: Registering the id_resolver key type
>>> [    0.207031] Key type id_resolver registered
>>> [    0.207031] Key type id_legacy registered
>>> [    0.207031] jffs2: version 2.2. (NAND) �© 2001-2006 Red Hat,
>> Inc.
>>> [    0.207031] msgmni has been set to 242
>>> [    0.210937] io scheduler noop registered (default)
>>> [    0.218750] fffff200.serial: ttyS0 at MMIO 0xfffff200 (irq = 18)
>> is a ATMEL_S
>>> ERIAL
>>> [    0.609375] console [ttyS0] enabled
>>> [    0.613281] f801c000.serial: ttyS1 at MMIO 0xf801c000 (irq = 22)
>> is a ATMEL_S
>>> ERIAL
>>> [    0.632812] brd: module loaded
>>> [    0.652343] loop: module loaded
>>> [    0.667968] atmel_nand: Use On Flash BBT
>>> [    0.671875] atmel_nand 40000000.nand: No DMA support for NAND
>> access.
>>> [    0.675781] ONFI param page 0 valid
>>> [    0.679687] ONFI flash detected
>>> [    0.683593] NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda
>> (Micron MT29F2G
>>> 08AAD), page size: 2048, OOB size: 64
>>> [    0.695312] atmel_nand 40000000.nand: Initialize PMECC params,
>> cap: 2, sector
>>> : 512
>>> [    0.703125] Bad block table found at page 131008, version 0x01
>>> [    0.707031] Bad block table found at page 130944, version 0x01
>>> [    0.714843] nand_read_bbt: bad block at 0x000009380000
>>> [    0.718750] 2 cmdlinepart partitions found on MTD device
>> atmel_nand
>>> [    0.726562] Creating 2 MTD partitions on "atmel_nand":
>>> [    0.730468] 0x000000000000-0x000000800000 :
>> "bootstrap/uboot/kernel"
>>> [    0.742187] 0x000000800000-0x000010000000 : "rootfs"
>>> [    0.757812] macb f802c000.ethernet (unregistered net_device):
>> invalid hw addr
>>> ess, using random
>>> [    0.773437] libphy: MACB_mii_bus: probed
>>> [    0.777343] macb f802c000.ethernet eth0: Cadence MACB at
>> 0xf802c000 irq 23 (c
>>> a:2c:e6:c3:59:8f)
>>> [    0.785156] macb f802c000.ethernet eth0: attached PHY driver
>> [Davicom DM9161A
>>> ] (mii_bus:phy_addr=f802c000.etherne:00, irq=-1)
>>> [    0.796875] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI)
>> Driver
>>> [    0.804687] atmel-ehci 700000.ehci: Atmel EHCI UHP HS
>>> [    0.808593] atmel-ehci 700000.ehci: new USB bus registered,
>> assigned bus numb
>>> er 1
>>> [    0.816406] atmel-ehci 700000.ehci: irq 28, io mem 0x00700000
>>> [    0.835937] atmel-ehci 700000.ehci: USB 2.0 started, EHCI 1.00
>>> [    0.839843] usb usb1: New USB device found, idVendor=1d6b,
>> idProduct=0002
>>> [    0.847656] usb usb1: New USB device strings: Mfr=3, Product=2,
>> SerialNumber=
>>> 1
>>> [    0.855468] usb usb1: Product: Atmel EHCI UHP HS
>>> [    0.859375] usb usb1: Manufacturer: Linux 3.7.0-rc8-armv5-x0.16
>> ehci_hcd
>>> [    0.867187] usb usb1: SerialNumber: 700000.ehci
>>> [    0.871093] hub 1-0:1.0: USB hub found
>>> [    0.875000] hub 1-0:1.0: 3 ports detected
>>> [    0.878906] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
>>> [    0.886718] at91_ohci 600000.ohci: AT91 OHCI
>>> [    0.890625] at91_ohci 600000.ohci: new USB bus registered,
>> assigned bus numbe
>>> r 2
>>> [    0.898437] at91_ohci 600000.ohci: irq 28, io mem 0x00600000
>>> [    0.964843] usb usb2: New USB device found, idVendor=1d6b,
>> idProduct=0001
>>> [    0.968750] usb usb2: New USB device strings: Mfr=3, Product=2,
>> SerialNumber=
>>> 1
>>> [    0.976562] usb usb2: Product: AT91 OHCI
>>> [    0.980468] usb usb2: Manufacturer: Linux 3.7.0-rc8-armv5-x0.16
>> ohci_hcd
>>> [    0.988281] usb usb2: SerialNumber: at91
>>> [    0.992187] hub 2-0:1.0: USB hub found
>>> [    0.996093] hub 2-0:1.0: 2 ports detected
>>> [    1.003906] usbcore: registered new interface driver cdc_acm
>>> [    1.007812] cdc_acm: USB Abstract Control Model driver for USB
>> modems and ISD
>>> N adapters
>>> [    1.019531] usbcore: registered new interface driver uas
>>> [    1.023437] Initializing USB Mass Storage driver...
>>> [    1.027343] usbcore: registered new interface driver usb-storage
>>> [    1.035156] USB Mass Storage support registered.
>>> [    1.039062] usbcore: registered new interface driver ums-alauda
>>> [    1.046875] usbcore: registered new interface driver ums-cypress
>>> [    1.054687] usbcore: registered new interface driver ums-datafab
>>> [    1.058593] usbcore: registered new interface driver ums_eneub6250
>>> [    1.066406] usbcore: registered new interface driver ums-freecom
>>> [    1.074218] usbcore: registered new interface driver ums-isd200
>>> [    1.078125] usbcore: registered new interface driver ums-jumpshot
>>> [    1.085937] usbcore: registered new interface driver ums-karma
>>> [    1.093750] usbcore: registered new interface driver ums-onetouch
>>> [    1.097656] usbcore: registered new interface driver ums-realtek
>>> [    1.105468] usbcore: registered new interface driver ums-sddr09
>>> [    1.113281] usbcore: registered new interface driver ums-sddr55
>>> [    1.117187] usbcore: registered new interface driver ums-usbat
>>> [    1.125000] usbcore: registered new interface driver usbserial
>>> [    1.132812] usbcore: registered new interface driver
>> usbserial_generic
>>> [    1.140625] usbserial: USB Serial support registered for generic
>>> [    1.144531] usbcore: registered new interface driver ftdi_sio
>>> [    1.152343] usbserial: USB Serial support registered for FTDI USB
>> Serial Devi
>>> ce
>>> [    1.160156] usbcore: registered new interface driver pl2303
>>> [    1.167968] usbserial: USB Serial support registered for pl2303
>>> [    1.171875] mousedev: PS/2 mouse device common for all mice
>>> [    1.179687] i2c /dev entries driver
>>> [    1.191406] usbcore: registered new interface driver usbhid
>>> [    1.199218] usbhid: USB HID core driver
>>> [    1.207031] usb 1-2: new high-speed USB device number 2 using
>> atmel-ehci
>>> [    1.214843] TCP: cubic registered
>>> [    1.218750] NET: Registered protocol family 10
>>> [    1.222656] sit: IPv6 over IPv4 tunneling driver
>>> [    1.230468] NET: Registered protocol family 17
>>> [    1.234375] Key type dns_resolver registered
>>> [    1.246093] UBI: attaching mtd1 to ubi0
>>> [    1.253906] atmel_nand 40000000.nand: PMECC: Too many errors
>>> [    1.261718] UBI warning: ubi_io_read: error -5 while reading 64
>> bytes from PE
>>> B 10:0, read only 0 bytes, retry
>>> [    1.269531] atmel_nand 40000000.nand: PMECC: Too many errors
>>> [    1.277343] UBI warning: ubi_io_read: error -5 while reading 64
>> bytes from PE
>>> B 10:0, read only 0 bytes, retry
>>> [    1.285156] atmel_nand 40000000.nand: PMECC: Too many errors
>>> [    1.292968] UBI warning: ubi_io_read: error -5 while reading 64
>> bytes from PE
>>> B 10:0, read only 0 bytes, retry
>>> [    1.304687] atmel_nand 40000000.nand: PMECC: Too many errors
>>> [    1.308593] UBI error: ubi_io_read: error -5 while reading 64
>> bytes from PEB
>>> 10:0, read 0 bytes
>>> [    1.316406] [<c000d2bc>] (unwind_backtrace+0x0/0xe0) from
>> [<c0243a10>] (ubi_i
>>> o_read+0x1d4/0x2a4)
>>> [    1.328125] [<c0243a10>] (ubi_io_read+0x1d4/0x2a4) from
>> [<c0243d20>] (ubi_io_
>>> read_ec_hdr+0x68/0x214)
>>> [    1.335937] [<c0243d20>] (ubi_io_read_ec_hdr+0x68/0x214) from
>> [<c024804c>] (u
>>> bi_attach+0x104/0x13e4)
>>> [    1.343750] [<c024804c>] (ubi_attach+0x104/0x13e4) from
>> [<c023e514>] (ubi_att
>>> ach_mtd_dev+0x5a4/0xb94)
>>> [    1.355468] [<c023e514>] (ubi_attach_mtd_dev+0x5a4/0xb94) from
>> [<c04d09dc>] (
>>> ubi_init+0x1d8/0x2d8)
>>> [    1.363281] [<c04d09dc>] (ubi_init+0x1d8/0x2d8) from [<c0008860>]
>> (do_one_ini
>>> tcall+0x90/0x168)
>>> [    1.371093] [<c0008860>] (do_one_initcall+0x90/0x168) from
>> [<c03686a4>] (kern
>>> el_init+0xe8/0x2a0)
>>> [    1.378906] [<c03686a4>] (kernel_init+0xe8/0x2a0) from
>> [<c00093f0>] (ret_from
>>> _fork+0x14/0x24)
>>> [    1.386718] UBI error: ubi_attach_mtd_dev: failed to attach mtd1,
>> error -5
>>> [    1.394531] UBI error: ubi_init: cannot attach mtd1
>>> [    1.402343] drivers/rtc/hctosys.c: unable to open rtc device
>> (rtc0)
>>> [    1.410156] UBIFS error (pid 1): ubifs_mount: cannot open
>> "ubi0:rootfs", erro
>>> r -19
>>> [    1.417968] VFS: Cannot open root device "ubi0:rootfs" or unknown-
>> block(0,0):
>>>    error -19
>>> [    1.425781] Please append a correct "root=" boot option; here are
>> the availab
>>> le partitions:
>>> [    1.433593] 1f00            8192 mtdblock0  (driver?)
>>> [    1.437500] 1f01          253952 mtdblock1  (driver?)
>>> [    1.441406] Kernel panic - not syncing: VFS: Unable to mount root
>> fs on unkno
>>> wn-block(0,0)
>>>
>>>
Bryan Evenson - Dec. 7, 2012, 1:51 p.m.
Josh,

I wanted to make sure you got this message before you
left for the day (not sure when that is for you).  I
will be sending a separate message with the applicable
test data soon.

In changing back and forth between kernels, I believe I
see how the filesystem errors were created on my end.
I have been writing my DTB at 0x700000 using SAM-BA, since
this is plenty of room for the DTB before the filesystem
starts at 0x800000.  However, last time I burned the DTB I
noticed that SAM-BA said it wrote 0x20000 bytes to flash,
thus overwriting part of the first filesystem page.  To test
this theory out, I reflashed the filesystem and was able to
boot using the 3.7-rc8 kernel.  I then reflashed DTB with
SAM-BA and reproduced the error.

I have a Dropbox account in which I am putting some test
builds in place.  If you are interested in the exact DTB
and kernel binaries that I am using, I'll send you a share
invite offline.

Regards,
Bryan

> -----Original Message-----

> From: Josh Wu [mailto:josh.wu@atmel.com]

> Sent: Friday, December 07, 2012 4:31 AM

> To: Bryan Evenson

> Cc: linux-arm-kernel@lists.infradead.org

> Subject: Re: at91: Status of NAND flash access

>

> Hi, Bryan

>

> Thanks for doing such test. see my comment below:

>

> On 12/6/2012 9:20 PM, Bryan Evenson wrote:

> >> -----Original Message-----

> >> From: Josh Wu [mailto:josh.wu@atmel.com]

> >> Sent: Thursday, December 06, 2012 5:30 AM

> >> To: Bryan Evenson

> >> Cc: linux-arm-kernel@lists.infradead.org

> >> Subject: Re: at91: Status of NAND flash access

> >>

> >> On 12/6/2012 11:13 AM, Bryan Evenson wrote:

> >>> Josh,

> >>>

> >>> I spoke too soon.  I was able to read and use the filesystem from

> >> NAND

> >>> flash with the patch you provided when I applied it to the Atmel

> 3.4

> >>> kernel fork over at https://github.com/linux4sam/linux-at91/

> (master

> >> branch).

> >>> When I applied the same patch to the recent mainline kernel (3.7-

> >> rc8),

> >>> it's still having problems accessing flash.  The boot log shows

> that

> >>> it is setting up for PMECC correctly, but it has errors when it

> >>> tries to read from the filesystem.

> >> It is strange.  The 3.4 kernel from at91 github just have a few

> >> changes.

> >> so rationally it behavior the same at PMECC function. From your log,

> >> the

> >> 3.7-rc8 kernel says the PMECC found uncorrectable errors.

> >>

> >> Can you try to dump or read from the u-boot? to see whether u-boot

> >> can recognize the same nand page that "too many errors" happened in

> kernel?

> >> I will do some test to see whether the 3.7-rc8 can work in my side

> or

> >> not.

> > U-Boot> nand read 0x22000000 0x800000 0x1D00000

> >

> > NAND read: device 0 offset 0x800000, size 0x1d00000

> > PMECC: Too many errors

> > NAND read from offset 800000 failed -5

> >   0 bytes read: ERROR

> >

> > So u-boot has the same issue.

> seems some page are really damaged or the error correction code has

> bugs.

>

> > However, changing the kernel to the linux-at91 forked kernel produced

> > different results.  That kernel noted the PMECC errors but was still

> > able to load the filesystem.

> I don't find the 3.4 kernel noted the PMECC errors in your attached

> log.

>

> >    My boot output from the successful

> > filesystem load is below.  Is the 3.4 kernel performing corrections

> > that the mainline is not,

>

> no. I don't think so. The PMECC part of patch is the almost same. Only

> some minor change are made in v3.4 for back port.

>

> > or is it just ignoring errors that it should not be ignoring?

>

> This is more possible. I means maybe 3.4 kernel doesn't check some area

> 3.7-rc8 checked.

>

> >

> > I'm hesitant to make any filesystem changes on this board because I

> > know test cases like this where it works one way but not the other

> are

> > kind of rare.  Let me know if you have similar results on your end.

> I tested in two version of kernel my side:

>   1. https://github.com/linux4sam/linux-at91/commits/at91-3.4-

> trunk_merge

>            fcf88e036fce6c382510874b1dc90e9b49608ccf (Merge branch

> 'at91-3.4-trunk/v3.4.x_gmac' into at91-3.4-trunk_merge)

>   2. v3.7-rc8 plus the patch I sent to you to enable PMECC in dtsi.

>

> I cannot reproduce the situation you met In my side. Both can boot the

> ubi rootfs system correctly.

>

> So the your case is rare.

>

> To find out why those two kernel work differently, could you help me to

> do:

>

>     1. use u-boot "nand read" to do some bisect in nand flash offset,

> which we can narrow down the page that has uncorrectable pmecc errors.

>

>     2. use u-boot "nand dump offset" to show the raw data of that page.

> please send me the log. I can generate the same page from your log. and

> check whether it can be corrected in my side.

>

>     3. in 3.4 kernel, use dd command to read that page, to see any

> uncorrectable pmecc error happen.

>           if no error happens in 3.4, then it means it correct that

> v3.7-rc8 cannot. There mush be something different in 3.4 kernel pmecc

> between mainline.

>           if error happens, that means 3.4 kernel skips those area but

> 3.7-rc8 does not. So I suspect it maybe caused by some code of UBI part

> changes.

>

> Best Regards,

> Josh Wu

>

> >

> > -Bryan

> >

> > Uncompressing Linux... done, booting the kernel.

> > Booting Linux on physical CPU 0

> > Linux version 3.4.0 (xxxx@xxxx) (gcc version 4.5.3 20110311

> > (prerelease) (

> > GCC) ) #2 Wed Dec 5 15:36:29 EST 2012

> > CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177

> > CPU: VIVT data cache, VIVT instruction cache

> > Machine: Atmel AT91SAM (Device Tree), model: Atmel AT91SAM9G25-EK

> > Memory policy: ECC disabled, Data cache writeback

> > AT91: Detected soc type: at91sam9x5

> > AT91: Detected soc subtype: at91sam9g25

> > AT91: sram at 0x300000 of 0x8000 mapped at 0xfef70000

> > Clocks: CPU 400 MHz, master 133 MHz, main 12.000 MHz

> > gpiochip_add: registered GPIOs 0 to 31 on device: pioA

> > gpiochip_add: registered GPIOs 32 to 63 on device: pioB

> > gpiochip_add: registered GPIOs 64 to 95 on device: pioC

> > gpiochip_add: registered GPIOs 96 to 127 on device: pioD Built 1

> > zonelists in Zone order, mobility grouping on.  Total pages: 32512

> > Kernel command line: mem=128M console=ttyS0,115200

> > mtdparts=atmel_nand:8M(bootst

> > rap/uboot/kernel)ro,-(rootfs) root=/dev/mtdblock1 rw rootfstype=ubifs

> > ubi.mtd=1 root=ubi0:rootfs PID hash table entries: 512 (order: -1,

> > 2048 bytes) Dentry cache hash table entries: 16384 (order: 4, 65536

> > bytes) Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)

> > Memory: 128MB = 128MB total

> > Memory: 119856k/119856k available, 11216k reserved, 0K highmem

> Virtual

> > kernel memory layout:

> >      vector  : 0xffff0000 - 0xffff1000   (   4 kB)

> >      fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)

> >      vmalloc : 0xc8800000 - 0xff000000   ( 872 MB)

> >      lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)

> >      modules : 0xbf000000 - 0xc0000000   (  16 MB)

> >        .text : 0xc0008000 - 0xc04650d4   (4469 kB)

> >        .init : 0xc0466000 - 0xc048a000   ( 144 kB)

> >        .data : 0xc048a000 - 0xc04c4420   ( 234 kB)

> >         .bss : 0xc04c4444 - 0xc09c66e4   (5129 kB)

> > NR_IRQS:192

> > sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every

> > 4294967286ms

> > Console: colour dummy device 80x30

> > Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo

> > Molnar ... MAX_LOCKDEP_SUBCLASSES:  8

> > ... MAX_LOCK_DEPTH:          48

> > ... MAX_LOCKDEP_KEYS:        8191

> > ... CLASSHASH_SIZE:          4096

> > ... MAX_LOCKDEP_ENTRIES:     16384

> > ... MAX_LOCKDEP_CHAINS:      32768

> > ... CHAINHASH_SIZE:          16384

> >   memory used by lock dependency info: 3695 kB

> >   per task-struct memory footprint: 1152 bytes

> > ------------------------

> > | Locking API testsuite:

> > ---------------------------------------------------------------------

> -------

> >                                   | spin |wlock |rlock |mutex | wsem

> | rsem |

> >    ------------------------------------------------------------------

> --------

> >                       A-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >                   A-B-B-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >               A-B-B-C-C-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >               A-B-C-A-B-C deadlock:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >           A-B-B-C-C-D-D-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >           A-B-C-D-B-D-D-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >           A-B-C-D-B-C-D-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >                      double unlock:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >                    initialize held:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >                   bad unlock order:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >    ------------------------------------------------------------------

> --------

> >                recursive read-lock:             |  ok  |

> |  ok  |

> >             recursive read-lock #2:             |  ok  |

> |  ok  |

> >              mixed read-write-lock:             |  ok  |

> |  ok  |

> >              mixed write-read-lock:             |  ok  |

> |  ok  |

> >    ------------------------------------------------------------------

> --------

> >       hard-irqs-on + irq-safe-A/12:  ok  |  ok  |  ok  |

> >       soft-irqs-on + irq-safe-A/12:  ok  |  ok  |  ok  |

> >       hard-irqs-on + irq-safe-A/21:  ok  |  ok  |  ok  |

> >       soft-irqs-on + irq-safe-A/21:  ok  |  ok  |  ok  |

> >         sirq-safe-A => hirqs-on/12:  ok  |  ok  |  ok  |

> >         sirq-safe-A => hirqs-on/21:  ok  |  ok  |  ok  |

> >           hard-safe-A + irqs-on/12:  ok  |  ok  |  ok  |

> >           soft-safe-A + irqs-on/12:  ok  |  ok  |  ok  |

> >           hard-safe-A + irqs-on/21:  ok  |  ok  |  ok  |

> >           soft-safe-A + irqs-on/21:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #1/123:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #1/123:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #1/132:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #1/132:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #1/213:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #1/213:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #1/231:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #1/231:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #1/312:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #1/312:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #1/321:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #1/321:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #2/123:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #2/123:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #2/132:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #2/132:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #2/213:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #2/213:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #2/231:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #2/231:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #2/312:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #2/312:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #2/321:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #2/321:  ok  |  ok  |  ok  |

> >        hard-irq lock-inversion/123:  ok  |  ok  |  ok  |

> >        soft-irq lock-inversion/123:  ok  |  ok  |  ok  |

> >        hard-irq lock-inversion/132:  ok  |  ok  |  ok  |

> >        soft-irq lock-inversion/132:  ok  |  ok  |  ok  |

> >        hard-irq lock-inversion/213:  ok  |  ok  |  ok  |

> >        soft-irq lock-inversion/213:  ok  |  ok  |  ok  |

> >        hard-irq lock-inversion/231:  ok  |  ok  |  ok  |

> >        soft-irq lock-inversion/231:  ok  |  ok  |  ok  |

> >        hard-irq lock-inversion/312:  ok  |  ok  |  ok  |

> >        soft-irq lock-inversion/312:  ok  |  ok  |  ok  |

> >        hard-irq lock-inversion/321:  ok  |  ok  |  ok  |

> >        soft-irq lock-inversion/321:  ok  |  ok  |  ok  |

> >        hard-irq read-recursion/123:  ok  |

> >        soft-irq read-recursion/123:  ok  |

> >        hard-irq read-recursion/132:  ok  |

> >        soft-irq read-recursion/132:  ok  |

> >        hard-irq read-recursion/213:  ok  |

> >        soft-irq read-recursion/213:  ok  |

> >        hard-irq read-recursion/231:  ok  |

> >        soft-irq read-recursion/231:  ok  |

> >        hard-irq read-recursion/312:  ok  |

> >        soft-irq read-recursion/312:  ok  |

> >        hard-irq read-recursion/321:  ok  |

> >        soft-irq read-recursion/321:  ok  |

> > -------------------------------------------------------

> > Good, all 218 testcases passed! |

> > ---------------------------------

> > Calibrating delay loop... 198.04 BogoMIPS (lpj=990208)

> > pid_max: default: 32768 minimum: 301

> > Mount-cache hash table entries: 512

> > CPU: Testing write buffer coherency: ok Setting up static identity

> map

> > for 0x2033ced8 - 0x2033cf30

> > devtmpfs: initialized

> > dummy:

> > NET: Registered protocol family 16

> > AT91: Power Management (with slow clock mode)

> > AT91: Starting after power-restored wakeup

> > bio: create slab <bio-0> at 0

> > at_hdmac ffffec00.dma-controller: Atmel AHB DMA Controller ( cpy

> slave

> > ), 8 chan nels at_hdmac ffffee00.dma-controller: Atmel AHB DMA

> > Controller ( cpy slave ), 8 chan nels SCSI subsystem initialized

> > usbcore: registered new interface driver usbfs

> > usbcore: registered new interface driver hub

> > usbcore: registered new device driver usb

> > cfg80211: Calling CRDA to update world regulatory domain Switching to

> > clocksource tcb_clksrc

> > NET: Registered protocol family 2

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

> > established hash table entries: 4096 (order: 3, 32768 bytes) TCP bind

> > hash table entries: 4096 (order: 5, 147456 bytes)

> > TCP: Hash tables configured (established 4096 bind 4096)

> > TCP: reno registered

> > UDP hash table entries: 64 (order: 0, 5120 bytes) UDP-Lite hash table

> > entries: 64 (order: 0, 5120 bytes)

> > NET: Registered protocol family 1

> > RPC: Registered named UNIX socket transport module.

> > RPC: Registered udp transport module.

> > RPC: Registered tcp transport module.

> > RPC: Registered tcp NFSv4.1 backchannel transport module.

> > NFS: Registering the id_resolver key type

> > jffs2: version 2.2. (NAND) (SUMMARY)   © 2001-2006 Red Hat, Inc.

> > msgmni has been set to 234

> > Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)

> > io scheduler noop registered (default)

> > fffff200.serial: ttyS0 at MMIO 0xfffff200 (irq = 1) is a ATMEL_SERIAL

> > console [ttyS0] enabled

> > f801c000.serial: ttyS1 at MMIO 0xf801c000 (irq = 5) is a ATMEL_SERIAL

> > f8020000.serial: ttyS2 at MMIO 0xf8020000 (irq = 6) is a ATMEL_SERIAL

> > f8028000.serial: ttyS4 at MMIO 0xf8028000 (irq = 8) is a ATMEL_SERIAL

> > brd: module loaded

> > loop: module loaded

> > mtdoops: mtd device (mtddev=name/number) must be supplied

> > atmel_nand: Use On Flash BBT

> > atmel_nand 40000000.nand: No DMA support for NAND access.

> > ONFI param page 0 valid

> > ONFI flash detected

> > NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda (Micron

> > MT29F2G08AAD) Bad block table found at page 131008, version 0x01 Bad

> > block table found at page 130944, version 0x01

> > nand_read_bbt: bad block at 0x000009380000

> > 2 cmdlinepart partitions found on MTD device atmel_nand Creating 2

> MTD

> > partitions on "atmel_nand":

> > 0x000000000000-0x000000800000 : "bootstrap/uboot/kernel"

> > 0x000000800000-0x000010000000 : "rootfs"

> > UBI: attaching mtd1 to ubi0

> > UBI: physical eraseblock size:   131072 bytes (128 KiB)

> > UBI: logical eraseblock size:    126976 bytes

> > UBI: smallest flash I/O unit:    2048

> > UBI: VID header offset:          2048 (aligned 2048)

> > UBI: data offset:                4096

> > UBI: max. sequence number:       4249

> > UBI warning: print_rsvd_warning: cannot reserve enough PEBs for bad

> > PEB handling , reserved 15, need 19

> > UBI: attached mtd1 to ubi0

> > UBI: MTD device name:            "rootfs"

> > UBI: MTD device size:            248 MiB

> > UBI: number of good PEBs:        1979

> > UBI: number of bad PEBs:         5

> > UBI: number of corrupted PEBs:   0

> > UBI: max. allowed volumes:       128

> > UBI: wear-leveling threshold:    4096

> > UBI: number of internal volumes: 1

> > UBI: number of user volumes:     1

> > UBI: available PEBs:             0

> > UBI: total number of reserved PEBs: 1979

> > UBI: number of PEBs reserved for bad PEB handling: 15

> > UBI: max/mean erase counter: 5/2

> > UBI: image sequence number:  191777507

> > UBI: background thread "ubi_bgt0d" started, PID 31 UBI error:

> > ubi_init: cannot attach mtd1

> > tun: Universal TUN/TAP device driver, 1.6

> > tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com> macb

> > f802c000.ethernet: (unregistered net_device): invalid hw address,

> > using ran dom

> > MACB_mii_bus: probed

> > macb f802c000.ethernet: eth0: Cadence MACB at 0xf802c000 irq 24

> (4a:15:f4:49:94:

> > a4)

> > macb f802c000.ethernet: eth0: attached PHY driver [Davicom DM9161A]

> > (mii_bus:phy _addr=f802c000.etherne:00, irq=-1) PPP generic driver

> > version 2.4.2

> > NET: Registered protocol family 24

> > usbcore: registered new interface driver asix

> > usbcore: registered new interface driver cdc_ether

> > usbcore: registered new interface driver cdc_eem

> > usbcore: registered new interface driver net1080

> > usbcore: registered new interface driver cdc_subset

> > usbcore: registered new interface driver zaurus

> > usbcore: registered new interface driver ipheth

> > usbcore: registered new interface driver cdc_ncm

> > ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver atmel-ehci

> > 700000.ehci: Atmel EHCI UHP HS atmel-ehci 700000.ehci: new USB bus

> > registered, assigned bus number 1 atmel-ehci 700000.ehci: irq 22, io

> > mem 0x00700000 atmel-ehci 700000.ehci: USB 2.0 started, EHCI 1.00 usb

> > usb1: New USB device found, idVendor=1d6b, idProduct=0002 usb usb1:

> > New USB device strings: Mfr=3, Product=2, SerialNumber=1 usb usb1:

> > Product: Atmel EHCI UHP HS usb usb1: Manufacturer: Linux 3.4.0

> > ehci_hcd usb usb1: SerialNumber: 700000.ehci hub 1-0:1.0: USB hub

> > found hub 1-0:1.0: 3 ports detected

> > ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver at91_ohci

> > 600000.ohci: AT91 OHCI at91_ohci 600000.ohci: new USB bus registered,

> > assigned bus number 2 at91_ohci 600000.ohci: irq 22, io mem

> 0x00600000

> > usb usb2: New USB device found, idVendor=1d6b, idProduct=0001 usb

> > usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1 usb

> > usb2: Product: AT91 OHCI usb usb2: Manufacturer: Linux 3.4.0 ohci_hcd

> > usb usb2: SerialNumber: at91 hub 2-0:1.0: USB hub found hub 2-0:1.0:

> 2

> > ports detected

> > usbcore: registered new interface driver cdc_acm

> > cdc_acm: USB Abstract Control Model driver for USB modems and ISDN

> > adapters Initializing USB Mass Storage driver...

> > usbcore: registered new interface driver usb-storage USB Mass Storage

> > support registered.

> > usbcore: registered new interface driver libusual

> > usbcore: registered new interface driver usbserial

> > usbcore: registered new interface driver usbserial_generic USB Serial

> > support registered for generic

> > usbserial: USB Serial Driver core

> > usbcore: registered new interface driver moto-modem USB Serial

> support

> > registered for moto-modem

> > usbcore: registered new interface driver opticon USB Serial support

> > registered for opticon

> > usbcore: registered new interface driver pl2303 USB Serial support

> > registered for pl2303

> > usbcore: registered new interface driver qcserial USB Serial support

> > registered for Qualcomm USB modem

> > usbcore: registered new interface driver symbol USB Serial support

> > registered for symbol i2c /dev entries driver

> > usbcore: registered new interface driver usbhid

> > usbhid: USB HID core driver

> > nf_conntrack version 0.5.0 (1872 buckets, 7488 max)

> > IPv4 over IPv4 tunneling driver

> > ip_tables: (C) 2000-2006 Netfilter Core Team

> > TCP: cubic registered

> > NET: Registered protocol family 17

> > lib80211: common routines for IEEE802.11 drivers Registering the

> > dns_resolver key type

> > drivers/rtc/hctosys.c: unable to open rtc device (rtc0)

> > UBIFS: recovery needed

> > UBIFS: recovery completed

> > UBIFS: mounted UBI device 0, volume 0, name "rootfs"

> > UBIFS: file system size:   247476224 bytes (241676 KiB, 236 MiB, 1949

> LEBs)

> > UBIFS: journal size:       9023488 bytes (8812 KiB, 8 MiB, 72 LEBs)

> > UBIFS: media format:       w4/r0 (latest is w4/r0)

> > UBIFS: default compressor: lzo

> > UBIFS: reserved for root:  0 bytes (0 KiB)

> > VFS: Mounted root (ubifs filesystem) on device 0:11.

> > devtmpfs: mounted

> > Freeing init memory: 144K

> > INIT: version 2.86 booting

> > Please wait: booting...

> > Starting udev

> > udev[62]: starting version 165

> > Root filesystem already rw, not remounting Caching udev devnodes

> > Populating dev cache

> > logger: mount: mount point /proc/bus/usb does not exist

> > ALSA: Restoring mixer settings...

> > /usr/sbin/alsactl: load_state:1625: No soundcards found...

> > Configuring network interfaces... eth0      no wireless extensions.

> >

> > udhcpc (v1.18.3) started

> > run-parts: /etc/udhcpc.d/00avahi-autoipd exited with code 1 Sending

> > discover...

> > Sending discover...

> > Sending discover...

> > netlink: 12 bytes leftover after parsing attributes.

> > netlink: 12 bytes leftover after parsing attributes.

> > netlink: 12 bytes leftover after parsing attributes.

> > No lease, failing

> > done.

> > Starting portmap daemon: portmap.

> > net.ipv4.conf.default.rp_filter = 1

> > net.ipv4.conf.all.rp_filter = 1

> > kernel.panic = 10

> > hwclock: can't open '/dev/misc/rtc': No such file or directory Mon

> Nov

> > 5 09:47:00 EST 2012

> > hwclock: can't open '/dev/misc/rtc': No such file or directory

> > INIT: Entering runlevel: 5

> > Starting system message bus: dbus.

> > Starting Dropbear SSH server: dropbear.

> > starting Busybox HTTP Daemon: httpd... done.

> > Starting Vixie-cron.

> > Starting ntpd: done

> > Starting syslogd/klogd: done

> >   * Starting Avahi mDNS/DNS-SD Daemon: avahi-daemon

> >     ...done.

> >

> >>> I noticed over at the linux-at91 fork that you had applied the

> PMECC

> >>> support on the 3.4.x_pmecc_dt_9x5 branch a few months ago.  From

> >>> browsing the mainline I didn't see some of your changes from that

> >>> branch in the mainline.  Are there some changes from the linux-at91

> >> fork that are still scheduled for mainlining?

> >> yes, this patch is not push to mainline yet. Currently the only

> >> concern is we are think about the PMECC error correct bits need to

> >> adjust by ONFI parameters that read from nand flash.

> >> But it is not decide yet. if no exception, this patch will push to

> >> mainline soon.

> >>

> >> Best Regards,

> >> Josh Wu

> >>

> >>> If it helps, here is the boot log when I tried to boot using a 3.7-

> >> rc8

> >>> kernel and DT.

> >>>

> >>> Thanks,

> >>> Bryan

> >>>

> >>> Uncompressing Linux... done, booting the kernel.

> >>> [    0.000000] Booting Linux on physical CPU 0

> >>> [    0.000000] Linux version 3.7.0-rc8-armv5-x0.16 (xxxx@xxxx) (gcc

> >> versio

> >>> n 4.6.2 20121016 (release) [ARM/embedded-4_6-branch revision

> 192487]

> >>> (GNU Tools for ARM Embedded Processors) ) #1 Wed Dec 5 16:11:30 EST

> >> 2012

> >>> [    0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ),

> >> cr=00053177

> >>> [    0.000000] CPU: VIVT data cache, VIVT instruction cache

> >>> [    0.000000] Machine: Atmel AT91SAM (Device Tree), model: Atmel

> >> AT91SAM9G25-EK

> >>> [    0.000000] Memory policy: ECC disabled, Data cache writeback

> >>> [    0.000000] AT91: Detected soc type: at91sam9x5

> >>> [    0.000000] AT91: Detected soc subtype: at91sam9g25

> >>> [    0.000000] AT91: sram at 0x300000 of 0x8000 mapped at

> 0xfef70000

> >>> [    0.000000] Clocks: CPU 400 MHz, master 133 MHz, main 12.000 MHz

> >>> [    0.000000] Built 1 zonelists in Zone order, mobility grouping

> on.

> >> Total pag

> >>> es: 32512

> >>> [    0.000000] Kernel command line: mem=128M console=ttyS0,115200

> >> mtdparts=atmel

> >>> _nand:8M(bootstrap/uboot/kernel)ro,-(rootfs) root=/dev/mtdblock1 rw

> >>> rootfstype=u bifs ubi.mtd=1 root=ubi0:rootfs

> >>> [    0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)

> >>> [    0.000000] Dentry cache hash table entries: 16384 (order: 4,

> >> 65536 bytes)

> >>> [    0.000000] Inode-cache hash table entries: 8192 (order: 3,

> 32768

> >> bytes)

> >>> [    0.000000] Memory: 128MB = 128MB total

> >>> [    0.000000] Memory: 124276k/124276k available, 6796k reserved,

> 0K

> >> highmem

> >>> [    0.000000] Virtual kernel memory layout:

> >>> [    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)

> >>> [    0.000000]     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)

> >>> [    0.000000]     vmalloc : 0xc8800000 - 0xff000000   ( 872 MB)

> >>> [    0.000000]     lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)

> >>> [    0.000000]     modules : 0xbf000000 - 0xc0000000   (  16 MB)

> >>> [    0.000000]       .text : 0xc0008000 - 0xc04b8630   (4802 kB)

> >>> [    0.000000]       .init : 0xc04b9000 - 0xc04e45c4   ( 174 kB)

> >>> [    0.000000]       .data : 0xc04e6000 - 0xc0516ce0   ( 196 kB)

> >>> [    0.000000]        .bss : 0xc0516d04 - 0xc05760bc   ( 381 kB)

> >>> [    0.000000] NR_IRQS:16 nr_irqs:16 16

> >>> [    0.000000] sched_clock: 32 bits at 256 Hz, resolution

> 3906250ns,

> >> wraps every

> >>>    3892314108ms

> >>> [    0.000000] Console: colour dummy device 80x30

> >>> [    0.035156] Calibrating delay loop... 199.80 BogoMIPS

> (lpj=389120)

> >>> [    0.035156] pid_max: default: 32768 minimum: 301

> >>> [    0.035156] Mount-cache hash table entries: 512

> >>> [    0.039062] CPU: Testing write buffer coherency: ok

> >>> [    0.039062] Setting up static identity map for 0x20371d48 -

> >> 0x20371da0

> >>> [    0.039062] devtmpfs: initialized

> >>> [    0.042968] NET: Registered protocol family 16

> >>> [    0.042968] DMA: preallocated 256 KiB pool for atomic coherent

> >> allocations

> >>> [    0.070312] No ATAGs?

> >>> [    0.070312] AT91: Power Management

> >>> [    0.070312] AT91: Starting after power-restored wakeup

> >>> [    0.121093] bio: create slab <bio-0> at 0

> >>> [    0.125000] SCSI subsystem initialized

> >>> [    0.128906] usbcore: registered new interface driver usbfs

> >>> [    0.128906] usbcore: registered new interface driver hub

> >>> [    0.128906] usbcore: registered new device driver usb

> >>> [    0.132812] at91_i2c f8010000.i2c: AT91 i2c bus driver.

> >>> [    0.132812] at91_i2c f8014000.i2c: AT91 i2c bus driver.

> >>> [    0.136718] at91_i2c f8018000.i2c: AT91 i2c bus driver.

> >>> [    0.140625] Switching to clocksource tcb_clksrc

> >>> [    0.195312] NET: Registered protocol family 2

> >>> [    0.199218] TCP established hash table entries: 4096 (order: 3,

> >> 32768 bytes)

> >>> [    0.199218] TCP bind hash table entries: 4096 (order: 2, 16384

> >> bytes)

> >>> [    0.199218] TCP: Hash tables configured (established 4096 bind

> >> 4096)

> >>> [    0.199218] TCP: reno registered

> >>> [    0.199218] UDP hash table entries: 256 (order: 0, 4096 bytes)

> >>> [    0.199218] UDP-Lite hash table entries: 256 (order: 0, 4096

> >> bytes)

> >>> [    0.199218] NET: Registered protocol family 1

> >>> [    0.199218] RPC: Registered named UNIX socket transport module.

> >>> [    0.199218] RPC: Registered udp transport module.

> >>> [    0.199218] RPC: Registered tcp transport module.

> >>> [    0.199218] RPC: Registered tcp NFSv4.1 backchannel transport

> >> module.

> >>> [    0.207031] NFS: Registering the id_resolver key type

> >>> [    0.207031] Key type id_resolver registered

> >>> [    0.207031] Key type id_legacy registered

> >>> [    0.207031] jffs2: version 2.2. (NAND) �© 2001-2006 Red Hat,

> >> Inc.

> >>> [    0.207031] msgmni has been set to 242

> >>> [    0.210937] io scheduler noop registered (default)

> >>> [    0.218750] fffff200.serial: ttyS0 at MMIO 0xfffff200 (irq = 18)

> >> is a ATMEL_S

> >>> ERIAL

> >>> [    0.609375] console [ttyS0] enabled

> >>> [    0.613281] f801c000.serial: ttyS1 at MMIO 0xf801c000 (irq = 22)

> >> is a ATMEL_S

> >>> ERIAL

> >>> [    0.632812] brd: module loaded

> >>> [    0.652343] loop: module loaded

> >>> [    0.667968] atmel_nand: Use On Flash BBT

> >>> [    0.671875] atmel_nand 40000000.nand: No DMA support for NAND

> >> access.

> >>> [    0.675781] ONFI param page 0 valid

> >>> [    0.679687] ONFI flash detected

> >>> [    0.683593] NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda

> >> (Micron MT29F2G

> >>> 08AAD), page size: 2048, OOB size: 64

> >>> [    0.695312] atmel_nand 40000000.nand: Initialize PMECC params,

> >> cap: 2, sector

> >>> : 512

> >>> [    0.703125] Bad block table found at page 131008, version 0x01

> >>> [    0.707031] Bad block table found at page 130944, version 0x01

> >>> [    0.714843] nand_read_bbt: bad block at 0x000009380000

> >>> [    0.718750] 2 cmdlinepart partitions found on MTD device

> >> atmel_nand

> >>> [    0.726562] Creating 2 MTD partitions on "atmel_nand":

> >>> [    0.730468] 0x000000000000-0x000000800000 :

> >> "bootstrap/uboot/kernel"

> >>> [    0.742187] 0x000000800000-0x000010000000 : "rootfs"

> >>> [    0.757812] macb f802c000.ethernet (unregistered net_device):

> >> invalid hw addr

> >>> ess, using random

> >>> [    0.773437] libphy: MACB_mii_bus: probed

> >>> [    0.777343] macb f802c000.ethernet eth0: Cadence MACB at

> >> 0xf802c000 irq 23 (c

> >>> a:2c:e6:c3:59:8f)

> >>> [    0.785156] macb f802c000.ethernet eth0: attached PHY driver

> >> [Davicom DM9161A

> >>> ] (mii_bus:phy_addr=f802c000.etherne:00, irq=-1)

> >>> [    0.796875] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI)

> >> Driver

> >>> [    0.804687] atmel-ehci 700000.ehci: Atmel EHCI UHP HS

> >>> [    0.808593] atmel-ehci 700000.ehci: new USB bus registered,

> >> assigned bus numb

> >>> er 1

> >>> [    0.816406] atmel-ehci 700000.ehci: irq 28, io mem 0x00700000

> >>> [    0.835937] atmel-ehci 700000.ehci: USB 2.0 started, EHCI 1.00

> >>> [    0.839843] usb usb1: New USB device found, idVendor=1d6b,

> >> idProduct=0002

> >>> [    0.847656] usb usb1: New USB device strings: Mfr=3, Product=2,

> >> SerialNumber=

> >>> 1

> >>> [    0.855468] usb usb1: Product: Atmel EHCI UHP HS

> >>> [    0.859375] usb usb1: Manufacturer: Linux 3.7.0-rc8-armv5-x0.16

> >> ehci_hcd

> >>> [    0.867187] usb usb1: SerialNumber: 700000.ehci

> >>> [    0.871093] hub 1-0:1.0: USB hub found

> >>> [    0.875000] hub 1-0:1.0: 3 ports detected

> >>> [    0.878906] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI)

> Driver

> >>> [    0.886718] at91_ohci 600000.ohci: AT91 OHCI

> >>> [    0.890625] at91_ohci 600000.ohci: new USB bus registered,

> >> assigned bus numbe

> >>> r 2

> >>> [    0.898437] at91_ohci 600000.ohci: irq 28, io mem 0x00600000

> >>> [    0.964843] usb usb2: New USB device found, idVendor=1d6b,

> >> idProduct=0001

> >>> [    0.968750] usb usb2: New USB device strings: Mfr=3, Product=2,

> >> SerialNumber=

> >>> 1

> >>> [    0.976562] usb usb2: Product: AT91 OHCI

> >>> [    0.980468] usb usb2: Manufacturer: Linux 3.7.0-rc8-armv5-x0.16

> >> ohci_hcd

> >>> [    0.988281] usb usb2: SerialNumber: at91

> >>> [    0.992187] hub 2-0:1.0: USB hub found

> >>> [    0.996093] hub 2-0:1.0: 2 ports detected

> >>> [    1.003906] usbcore: registered new interface driver cdc_acm

> >>> [    1.007812] cdc_acm: USB Abstract Control Model driver for USB

> >> modems and ISD

> >>> N adapters

> >>> [    1.019531] usbcore: registered new interface driver uas

> >>> [    1.023437] Initializing USB Mass Storage driver...

> >>> [    1.027343] usbcore: registered new interface driver usb-storage

> >>> [    1.035156] USB Mass Storage support registered.

> >>> [    1.039062] usbcore: registered new interface driver ums-alauda

> >>> [    1.046875] usbcore: registered new interface driver ums-cypress

> >>> [    1.054687] usbcore: registered new interface driver ums-datafab

> >>> [    1.058593] usbcore: registered new interface driver

> ums_eneub6250

> >>> [    1.066406] usbcore: registered new interface driver ums-freecom

> >>> [    1.074218] usbcore: registered new interface driver ums-isd200

> >>> [    1.078125] usbcore: registered new interface driver ums-

> jumpshot

> >>> [    1.085937] usbcore: registered new interface driver ums-karma

> >>> [    1.093750] usbcore: registered new interface driver ums-

> onetouch

> >>> [    1.097656] usbcore: registered new interface driver ums-realtek

> >>> [    1.105468] usbcore: registered new interface driver ums-sddr09

> >>> [    1.113281] usbcore: registered new interface driver ums-sddr55

> >>> [    1.117187] usbcore: registered new interface driver ums-usbat

> >>> [    1.125000] usbcore: registered new interface driver usbserial

> >>> [    1.132812] usbcore: registered new interface driver

> >> usbserial_generic

> >>> [    1.140625] usbserial: USB Serial support registered for generic

> >>> [    1.144531] usbcore: registered new interface driver ftdi_sio

> >>> [    1.152343] usbserial: USB Serial support registered for FTDI

> USB

> >> Serial Devi

> >>> ce

> >>> [    1.160156] usbcore: registered new interface driver pl2303

> >>> [    1.167968] usbserial: USB Serial support registered for pl2303

> >>> [    1.171875] mousedev: PS/2 mouse device common for all mice

> >>> [    1.179687] i2c /dev entries driver

> >>> [    1.191406] usbcore: registered new interface driver usbhid

> >>> [    1.199218] usbhid: USB HID core driver

> >>> [    1.207031] usb 1-2: new high-speed USB device number 2 using

> >> atmel-ehci

> >>> [    1.214843] TCP: cubic registered

> >>> [    1.218750] NET: Registered protocol family 10

> >>> [    1.222656] sit: IPv6 over IPv4 tunneling driver

> >>> [    1.230468] NET: Registered protocol family 17

> >>> [    1.234375] Key type dns_resolver registered

> >>> [    1.246093] UBI: attaching mtd1 to ubi0

> >>> [    1.253906] atmel_nand 40000000.nand: PMECC: Too many errors

> >>> [    1.261718] UBI warning: ubi_io_read: error -5 while reading 64

> >> bytes from PE

> >>> B 10:0, read only 0 bytes, retry

> >>> [    1.269531] atmel_nand 40000000.nand: PMECC: Too many errors

> >>> [    1.277343] UBI warning: ubi_io_read: error -5 while reading 64

> >> bytes from PE

> >>> B 10:0, read only 0 bytes, retry

> >>> [    1.285156] atmel_nand 40000000.nand: PMECC: Too many errors

> >>> [    1.292968] UBI warning: ubi_io_read: error -5 while reading 64

> >> bytes from PE

> >>> B 10:0, read only 0 bytes, retry

> >>> [    1.304687] atmel_nand 40000000.nand: PMECC: Too many errors

> >>> [    1.308593] UBI error: ubi_io_read: error -5 while reading 64

> >> bytes from PEB

> >>> 10:0, read 0 bytes

> >>> [    1.316406] [<c000d2bc>] (unwind_backtrace+0x0/0xe0) from

> >> [<c0243a10>] (ubi_i

> >>> o_read+0x1d4/0x2a4)

> >>> [    1.328125] [<c0243a10>] (ubi_io_read+0x1d4/0x2a4) from

> >> [<c0243d20>] (ubi_io_

> >>> read_ec_hdr+0x68/0x214)

> >>> [    1.335937] [<c0243d20>] (ubi_io_read_ec_hdr+0x68/0x214) from

> >> [<c024804c>] (u

> >>> bi_attach+0x104/0x13e4)

> >>> [    1.343750] [<c024804c>] (ubi_attach+0x104/0x13e4) from

> >> [<c023e514>] (ubi_att

> >>> ach_mtd_dev+0x5a4/0xb94)

> >>> [    1.355468] [<c023e514>] (ubi_attach_mtd_dev+0x5a4/0xb94) from

> >> [<c04d09dc>] (

> >>> ubi_init+0x1d8/0x2d8)

> >>> [    1.363281] [<c04d09dc>] (ubi_init+0x1d8/0x2d8) from

> [<c0008860>]

> >> (do_one_ini

> >>> tcall+0x90/0x168)

> >>> [    1.371093] [<c0008860>] (do_one_initcall+0x90/0x168) from

> >> [<c03686a4>] (kern

> >>> el_init+0xe8/0x2a0)

> >>> [    1.378906] [<c03686a4>] (kernel_init+0xe8/0x2a0) from

> >> [<c00093f0>] (ret_from

> >>> _fork+0x14/0x24)

> >>> [    1.386718] UBI error: ubi_attach_mtd_dev: failed to attach

> mtd1,

> >> error -5

> >>> [    1.394531] UBI error: ubi_init: cannot attach mtd1

> >>> [    1.402343] drivers/rtc/hctosys.c: unable to open rtc device

> >> (rtc0)

> >>> [    1.410156] UBIFS error (pid 1): ubifs_mount: cannot open

> >> "ubi0:rootfs", erro

> >>> r -19

> >>> [    1.417968] VFS: Cannot open root device "ubi0:rootfs" or

> unknown-

> >> block(0,0):

> >>>    error -19

> >>> [    1.425781] Please append a correct "root=" boot option; here

> are

> >> the availab

> >>> le partitions:

> >>> [    1.433593] 1f00            8192 mtdblock0  (driver?)

> >>> [    1.437500] 1f01          253952 mtdblock1  (driver?)

> >>> [    1.441406] Kernel panic - not syncing: VFS: Unable to mount

> root

> >> fs on unkno

> >>> wn-block(0,0)

> >>>

> >>>
Bryan Evenson - Dec. 7, 2012, 2:47 p.m.
Josh,

Answers below.

Regards,
Bryan

> -----Original Message-----

> From: Josh Wu [mailto:josh.wu@atmel.com]

> Sent: Friday, December 07, 2012 4:31 AM

> To: Bryan Evenson

> Cc: linux-arm-kernel@lists.infradead.org

> Subject: Re: at91: Status of NAND flash access

>

> Hi, Bryan

>

> Thanks for doing such test. see my comment below:

>

> On 12/6/2012 9:20 PM, Bryan Evenson wrote:

> >> -----Original Message-----

> >> From: Josh Wu [mailto:josh.wu@atmel.com]

> >> Sent: Thursday, December 06, 2012 5:30 AM

> >> To: Bryan Evenson

> >> Cc: linux-arm-kernel@lists.infradead.org

> >> Subject: Re: at91: Status of NAND flash access

> >>

> >> On 12/6/2012 11:13 AM, Bryan Evenson wrote:

> >>> Josh,

> >>>

> >>> I spoke too soon.  I was able to read and use the filesystem from

> >> NAND

> >>> flash with the patch you provided when I applied it to the Atmel

> 3.4

> >>> kernel fork over at https://github.com/linux4sam/linux-at91/

> (master

> >> branch).

> >>> When I applied the same patch to the recent mainline kernel (3.7-

> >> rc8),

> >>> it's still having problems accessing flash.  The boot log shows

> that

> >>> it is setting up for PMECC correctly, but it has errors when it

> >>> tries to read from the filesystem.

> >> It is strange.  The 3.4 kernel from at91 github just have a few

> >> changes.

> >> so rationally it behavior the same at PMECC function. From your log,

> >> the

> >> 3.7-rc8 kernel says the PMECC found uncorrectable errors.

> >>

> >> Can you try to dump or read from the u-boot? to see whether u-boot

> >> can recognize the same nand page that "too many errors" happened in

> kernel?

> >> I will do some test to see whether the 3.7-rc8 can work in my side

> or

> >> not.

> > U-Boot> nand read 0x22000000 0x800000 0x1D00000

> >

> > NAND read: device 0 offset 0x800000, size 0x1d00000

> > PMECC: Too many errors

> > NAND read from offset 800000 failed -5

> >   0 bytes read: ERROR

> >

> > So u-boot has the same issue.

> seems some page are really damaged or the error correction code has

> bugs.

>

> > However, changing the kernel to the linux-at91 forked kernel produced

> > different results.  That kernel noted the PMECC errors but was still

> > able to load the filesystem.

> I don't find the 3.4 kernel noted the PMECC errors in your attached

> log.

>

> >    My boot output from the successful

> > filesystem load is below.  Is the 3.4 kernel performing corrections

> > that the mainline is not,

>

> no. I don't think so. The PMECC part of patch is the almost same. Only

> some minor change are made in v3.4 for back port.

>

> > or is it just ignoring errors that it should not be ignoring?

>

> This is more possible. I means maybe 3.4 kernel doesn't check some area

> 3.7-rc8 checked.

>

> >

> > I'm hesitant to make any filesystem changes on this board because I

> > know test cases like this where it works one way but not the other

> are

> > kind of rare.  Let me know if you have similar results on your end.

> I tested in two version of kernel my side:

>   1. https://github.com/linux4sam/linux-at91/commits/at91-3.4-

> trunk_merge

>            fcf88e036fce6c382510874b1dc90e9b49608ccf (Merge branch

> 'at91-3.4-trunk/v3.4.x_gmac' into at91-3.4-trunk_merge)

>   2. v3.7-rc8 plus the patch I sent to you to enable PMECC in dtsi.

>

> I cannot reproduce the situation you met In my side. Both can boot the

> ubi rootfs system correctly.

>

> So the your case is rare.

>

> To find out why those two kernel work differently, could you help me to

> do:

>

>     1. use u-boot "nand read" to do some bisect in nand flash offset,

> which we can narrow down the page that has uncorrectable pmecc errors.

>

After trial and error, I got down to this:
nand read 0x22000000 0x865000 0x100

NAND read: device 0 offset 0x865000, size 0x100
PMECC: Too many errors
NAND read from offset 865000 failed -5
 0 bytes read: ERROR

>     2. use u-boot "nand dump offset" to show the raw data of that page.

> please send me the log. I can generate the same page from your log. and

> check whether it can be corrected in my side.


U-Boot> nand dump 0x865000
Page 00865000 dump:
        31 18 10 06 52 bd c6 c9  5d 44 02 00 00 00 00 00
        00 02 00 00 07 00 00 00  04 15 00 00 00 00 00 00
        05 00 00 00 00 00 00 00  03 00 00 00 04 00 00 00
        0f 01 00 00 c8 5a 00 00  58 00 00 00 d8 00 00 00
        0f 01 00 00 00 60 00 00  30 3b 0b 00 00 00 00 00
        00 18 7a 0c 00 00 00 00  08 2f 84 00 00 00 00 00
        c8 ad b6 01 00 00 00 00  c0 5a 02 00 00 00 00 00
        08 06 a3 00 00 00 00 00  08 00 00 00 e2 28 00 00
        08 00 00 00 00 30 00 00  08 00 00 00 00 28 00 00
        00 00 00 00 00 00 00 00  67 01 00 00 6e 06 00 00
        07 00 00 00 a8 07 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        31 18 10 06 ef de 0e ee  00 00 00 00 00 00 00 00
        1c 00 00 00 05 00 00 00  e4 05 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
        00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
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 3f 00 02 00
>

>     3. in 3.4 kernel, use dd command to read that page, to see any

> uncorrectable pmecc error happen.

>           if no error happens in 3.4, then it means it correct that

> v3.7-rc8 cannot. There mush be something different in 3.4 kernel pmecc

> between mainline.

>           if error happens, that means 3.4 kernel skips those area but

> 3.7-rc8 does not. So I suspect it maybe caused by some code of UBI part

> changes.


root@at91sam9x5ek:~# dd if=/dev/mtd1 of=/var/log/dump.bin bs=1k count=1 skip=65
1+0 records in
1+0 records out
1024 bytes (1.0KB) copied, 0.001962 seconds, 509.7KB/s

If I understand dd correctly, that should be reading 1KB of data starting at
0x865000 (/dev/mtd1 starts at 0x800000, plus offset of 65 1KB blocks).  If I
read the wrong block, let me know what the correct command line should be.

>

> Best Regards,

> Josh Wu

>

> >

> > -Bryan

> >

> > Uncompressing Linux... done, booting the kernel.

> > Booting Linux on physical CPU 0

> > Linux version 3.4.0 (xxxx@xxxx) (gcc version 4.5.3 20110311

> > (prerelease) (

> > GCC) ) #2 Wed Dec 5 15:36:29 EST 2012

> > CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177

> > CPU: VIVT data cache, VIVT instruction cache

> > Machine: Atmel AT91SAM (Device Tree), model: Atmel AT91SAM9G25-EK

> > Memory policy: ECC disabled, Data cache writeback

> > AT91: Detected soc type: at91sam9x5

> > AT91: Detected soc subtype: at91sam9g25

> > AT91: sram at 0x300000 of 0x8000 mapped at 0xfef70000

> > Clocks: CPU 400 MHz, master 133 MHz, main 12.000 MHz

> > gpiochip_add: registered GPIOs 0 to 31 on device: pioA

> > gpiochip_add: registered GPIOs 32 to 63 on device: pioB

> > gpiochip_add: registered GPIOs 64 to 95 on device: pioC

> > gpiochip_add: registered GPIOs 96 to 127 on device: pioD Built 1

> > zonelists in Zone order, mobility grouping on.  Total pages: 32512

> > Kernel command line: mem=128M console=ttyS0,115200

> > mtdparts=atmel_nand:8M(bootst

> > rap/uboot/kernel)ro,-(rootfs) root=/dev/mtdblock1 rw rootfstype=ubifs

> > ubi.mtd=1 root=ubi0:rootfs PID hash table entries: 512 (order: -1,

> > 2048 bytes) Dentry cache hash table entries: 16384 (order: 4, 65536

> > bytes) Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)

> > Memory: 128MB = 128MB total

> > Memory: 119856k/119856k available, 11216k reserved, 0K highmem

> Virtual

> > kernel memory layout:

> >      vector  : 0xffff0000 - 0xffff1000   (   4 kB)

> >      fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)

> >      vmalloc : 0xc8800000 - 0xff000000   ( 872 MB)

> >      lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)

> >      modules : 0xbf000000 - 0xc0000000   (  16 MB)

> >        .text : 0xc0008000 - 0xc04650d4   (4469 kB)

> >        .init : 0xc0466000 - 0xc048a000   ( 144 kB)

> >        .data : 0xc048a000 - 0xc04c4420   ( 234 kB)

> >         .bss : 0xc04c4444 - 0xc09c66e4   (5129 kB)

> > NR_IRQS:192

> > sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every

> > 4294967286ms

> > Console: colour dummy device 80x30

> > Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo

> > Molnar ... MAX_LOCKDEP_SUBCLASSES:  8

> > ... MAX_LOCK_DEPTH:          48

> > ... MAX_LOCKDEP_KEYS:        8191

> > ... CLASSHASH_SIZE:          4096

> > ... MAX_LOCKDEP_ENTRIES:     16384

> > ... MAX_LOCKDEP_CHAINS:      32768

> > ... CHAINHASH_SIZE:          16384

> >   memory used by lock dependency info: 3695 kB

> >   per task-struct memory footprint: 1152 bytes

> > ------------------------

> > | Locking API testsuite:

> > ---------------------------------------------------------------------

> -------

> >                                   | spin |wlock |rlock |mutex | wsem

> | rsem |

> >    ------------------------------------------------------------------

> --------

> >                       A-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >                   A-B-B-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >               A-B-B-C-C-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >               A-B-C-A-B-C deadlock:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >           A-B-B-C-C-D-D-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >           A-B-C-D-B-D-D-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >           A-B-C-D-B-C-D-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >                      double unlock:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >                    initialize held:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >                   bad unlock order:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >    ------------------------------------------------------------------

> --------

> >                recursive read-lock:             |  ok  |

> |  ok  |

> >             recursive read-lock #2:             |  ok  |

> |  ok  |

> >              mixed read-write-lock:             |  ok  |

> |  ok  |

> >              mixed write-read-lock:             |  ok  |

> |  ok  |

> >    ------------------------------------------------------------------

> --------

> >       hard-irqs-on + irq-safe-A/12:  ok  |  ok  |  ok  |

> >       soft-irqs-on + irq-safe-A/12:  ok  |  ok  |  ok  |

> >       hard-irqs-on + irq-safe-A/21:  ok  |  ok  |  ok  |

> >       soft-irqs-on + irq-safe-A/21:  ok  |  ok  |  ok  |

> >         sirq-safe-A => hirqs-on/12:  ok  |  ok  |  ok  |

> >         sirq-safe-A => hirqs-on/21:  ok  |  ok  |  ok  |

> >           hard-safe-A + irqs-on/12:  ok  |  ok  |  ok  |

> >           soft-safe-A + irqs-on/12:  ok  |  ok  |  ok  |

> >           hard-safe-A + irqs-on/21:  ok  |  ok  |  ok  |

> >           soft-safe-A + irqs-on/21:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #1/123:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #1/123:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #1/132:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #1/132:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #1/213:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #1/213:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #1/231:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #1/231:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #1/312:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #1/312:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #1/321:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #1/321:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #2/123:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #2/123:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #2/132:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #2/132:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #2/213:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #2/213:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #2/231:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #2/231:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #2/312:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #2/312:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #2/321:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #2/321:  ok  |  ok  |  ok  |

> >        hard-irq lock-inversion/123:  ok  |  ok  |  ok  |

> >        soft-irq lock-inversion/123:  ok  |  ok  |  ok  |

> >        hard-irq lock-inversion/132:  ok  |  ok  |  ok  |

> >        soft-irq lock-inversion/132:  ok  |  ok  |  ok  |

> >        hard-irq lock-inversion/213:  ok  |  ok  |  ok  |

> >        soft-irq lock-inversion/213:  ok  |  ok  |  ok  |

> >        hard-irq lock-inversion/231:  ok  |  ok  |  ok  |

> >        soft-irq lock-inversion/231:  ok  |  ok  |  ok  |

> >        hard-irq lock-inversion/312:  ok  |  ok  |  ok  |

> >        soft-irq lock-inversion/312:  ok  |  ok  |  ok  |

> >        hard-irq lock-inversion/321:  ok  |  ok  |  ok  |

> >        soft-irq lock-inversion/321:  ok  |  ok  |  ok  |

> >        hard-irq read-recursion/123:  ok  |

> >        soft-irq read-recursion/123:  ok  |

> >        hard-irq read-recursion/132:  ok  |

> >        soft-irq read-recursion/132:  ok  |

> >        hard-irq read-recursion/213:  ok  |

> >        soft-irq read-recursion/213:  ok  |

> >        hard-irq read-recursion/231:  ok  |

> >        soft-irq read-recursion/231:  ok  |

> >        hard-irq read-recursion/312:  ok  |

> >        soft-irq read-recursion/312:  ok  |

> >        hard-irq read-recursion/321:  ok  |

> >        soft-irq read-recursion/321:  ok  |

> > -------------------------------------------------------

> > Good, all 218 testcases passed! |

> > ---------------------------------

> > Calibrating delay loop... 198.04 BogoMIPS (lpj=990208)

> > pid_max: default: 32768 minimum: 301

> > Mount-cache hash table entries: 512

> > CPU: Testing write buffer coherency: ok Setting up static identity

> map

> > for 0x2033ced8 - 0x2033cf30

> > devtmpfs: initialized

> > dummy:

> > NET: Registered protocol family 16

> > AT91: Power Management (with slow clock mode)

> > AT91: Starting after power-restored wakeup

> > bio: create slab <bio-0> at 0

> > at_hdmac ffffec00.dma-controller: Atmel AHB DMA Controller ( cpy

> slave

> > ), 8 chan nels at_hdmac ffffee00.dma-controller: Atmel AHB DMA

> > Controller ( cpy slave ), 8 chan nels SCSI subsystem initialized

> > usbcore: registered new interface driver usbfs

> > usbcore: registered new interface driver hub

> > usbcore: registered new device driver usb

> > cfg80211: Calling CRDA to update world regulatory domain Switching to

> > clocksource tcb_clksrc

> > NET: Registered protocol family 2

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

> > established hash table entries: 4096 (order: 3, 32768 bytes) TCP bind

> > hash table entries: 4096 (order: 5, 147456 bytes)

> > TCP: Hash tables configured (established 4096 bind 4096)

> > TCP: reno registered

> > UDP hash table entries: 64 (order: 0, 5120 bytes) UDP-Lite hash table

> > entries: 64 (order: 0, 5120 bytes)

> > NET: Registered protocol family 1

> > RPC: Registered named UNIX socket transport module.

> > RPC: Registered udp transport module.

> > RPC: Registered tcp transport module.

> > RPC: Registered tcp NFSv4.1 backchannel transport module.

> > NFS: Registering the id_resolver key type

> > jffs2: version 2.2. (NAND) (SUMMARY)   © 2001-2006 Red Hat, Inc.

> > msgmni has been set to 234

> > Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)

> > io scheduler noop registered (default)

> > fffff200.serial: ttyS0 at MMIO 0xfffff200 (irq = 1) is a ATMEL_SERIAL

> > console [ttyS0] enabled

> > f801c000.serial: ttyS1 at MMIO 0xf801c000 (irq = 5) is a ATMEL_SERIAL

> > f8020000.serial: ttyS2 at MMIO 0xf8020000 (irq = 6) is a ATMEL_SERIAL

> > f8028000.serial: ttyS4 at MMIO 0xf8028000 (irq = 8) is a ATMEL_SERIAL

> > brd: module loaded

> > loop: module loaded

> > mtdoops: mtd device (mtddev=name/number) must be supplied

> > atmel_nand: Use On Flash BBT

> > atmel_nand 40000000.nand: No DMA support for NAND access.

> > ONFI param page 0 valid

> > ONFI flash detected

> > NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda (Micron

> > MT29F2G08AAD) Bad block table found at page 131008, version 0x01 Bad

> > block table found at page 130944, version 0x01

> > nand_read_bbt: bad block at 0x000009380000

> > 2 cmdlinepart partitions found on MTD device atmel_nand Creating 2

> MTD

> > partitions on "atmel_nand":

> > 0x000000000000-0x000000800000 : "bootstrap/uboot/kernel"

> > 0x000000800000-0x000010000000 : "rootfs"

> > UBI: attaching mtd1 to ubi0

> > UBI: physical eraseblock size:   131072 bytes (128 KiB)

> > UBI: logical eraseblock size:    126976 bytes

> > UBI: smallest flash I/O unit:    2048

> > UBI: VID header offset:          2048 (aligned 2048)

> > UBI: data offset:                4096

> > UBI: max. sequence number:       4249

> > UBI warning: print_rsvd_warning: cannot reserve enough PEBs for bad

> > PEB handling , reserved 15, need 19

> > UBI: attached mtd1 to ubi0

> > UBI: MTD device name:            "rootfs"

> > UBI: MTD device size:            248 MiB

> > UBI: number of good PEBs:        1979

> > UBI: number of bad PEBs:         5

> > UBI: number of corrupted PEBs:   0

> > UBI: max. allowed volumes:       128

> > UBI: wear-leveling threshold:    4096

> > UBI: number of internal volumes: 1

> > UBI: number of user volumes:     1

> > UBI: available PEBs:             0

> > UBI: total number of reserved PEBs: 1979

> > UBI: number of PEBs reserved for bad PEB handling: 15

> > UBI: max/mean erase counter: 5/2

> > UBI: image sequence number:  191777507

> > UBI: background thread "ubi_bgt0d" started, PID 31 UBI error:

> > ubi_init: cannot attach mtd1

> > tun: Universal TUN/TAP device driver, 1.6

> > tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com> macb

> > f802c000.ethernet: (unregistered net_device): invalid hw address,

> > using ran dom

> > MACB_mii_bus: probed

> > macb f802c000.ethernet: eth0: Cadence MACB at 0xf802c000 irq 24

> (4a:15:f4:49:94:

> > a4)

> > macb f802c000.ethernet: eth0: attached PHY driver [Davicom DM9161A]

> > (mii_bus:phy _addr=f802c000.etherne:00, irq=-1) PPP generic driver

> > version 2.4.2

> > NET: Registered protocol family 24

> > usbcore: registered new interface driver asix

> > usbcore: registered new interface driver cdc_ether

> > usbcore: registered new interface driver cdc_eem

> > usbcore: registered new interface driver net1080

> > usbcore: registered new interface driver cdc_subset

> > usbcore: registered new interface driver zaurus

> > usbcore: registered new interface driver ipheth

> > usbcore: registered new interface driver cdc_ncm

> > ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver atmel-ehci

> > 700000.ehci: Atmel EHCI UHP HS atmel-ehci 700000.ehci: new USB bus

> > registered, assigned bus number 1 atmel-ehci 700000.ehci: irq 22, io

> > mem 0x00700000 atmel-ehci 700000.ehci: USB 2.0 started, EHCI 1.00 usb

> > usb1: New USB device found, idVendor=1d6b, idProduct=0002 usb usb1:

> > New USB device strings: Mfr=3, Product=2, SerialNumber=1 usb usb1:

> > Product: Atmel EHCI UHP HS usb usb1: Manufacturer: Linux 3.4.0

> > ehci_hcd usb usb1: SerialNumber: 700000.ehci hub 1-0:1.0: USB hub

> > found hub 1-0:1.0: 3 ports detected

> > ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver at91_ohci

> > 600000.ohci: AT91 OHCI at91_ohci 600000.ohci: new USB bus registered,

> > assigned bus number 2 at91_ohci 600000.ohci: irq 22, io mem

> 0x00600000

> > usb usb2: New USB device found, idVendor=1d6b, idProduct=0001 usb

> > usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1 usb

> > usb2: Product: AT91 OHCI usb usb2: Manufacturer: Linux 3.4.0 ohci_hcd

> > usb usb2: SerialNumber: at91 hub 2-0:1.0: USB hub found hub 2-0:1.0:

> 2

> > ports detected

> > usbcore: registered new interface driver cdc_acm

> > cdc_acm: USB Abstract Control Model driver for USB modems and ISDN

> > adapters Initializing USB Mass Storage driver...

> > usbcore: registered new interface driver usb-storage USB Mass Storage

> > support registered.

> > usbcore: registered new interface driver libusual

> > usbcore: registered new interface driver usbserial

> > usbcore: registered new interface driver usbserial_generic USB Serial

> > support registered for generic

> > usbserial: USB Serial Driver core

> > usbcore: registered new interface driver moto-modem USB Serial

> support

> > registered for moto-modem

> > usbcore: registered new interface driver opticon USB Serial support

> > registered for opticon

> > usbcore: registered new interface driver pl2303 USB Serial support

> > registered for pl2303

> > usbcore: registered new interface driver qcserial USB Serial support

> > registered for Qualcomm USB modem

> > usbcore: registered new interface driver symbol USB Serial support

> > registered for symbol i2c /dev entries driver

> > usbcore: registered new interface driver usbhid

> > usbhid: USB HID core driver

> > nf_conntrack version 0.5.0 (1872 buckets, 7488 max)

> > IPv4 over IPv4 tunneling driver

> > ip_tables: (C) 2000-2006 Netfilter Core Team

> > TCP: cubic registered

> > NET: Registered protocol family 17

> > lib80211: common routines for IEEE802.11 drivers Registering the

> > dns_resolver key type

> > drivers/rtc/hctosys.c: unable to open rtc device (rtc0)

> > UBIFS: recovery needed

> > UBIFS: recovery completed

> > UBIFS: mounted UBI device 0, volume 0, name "rootfs"

> > UBIFS: file system size:   247476224 bytes (241676 KiB, 236 MiB, 1949

> LEBs)

> > UBIFS: journal size:       9023488 bytes (8812 KiB, 8 MiB, 72 LEBs)

> > UBIFS: media format:       w4/r0 (latest is w4/r0)

> > UBIFS: default compressor: lzo

> > UBIFS: reserved for root:  0 bytes (0 KiB)

> > VFS: Mounted root (ubifs filesystem) on device 0:11.

> > devtmpfs: mounted

> > Freeing init memory: 144K

> > INIT: version 2.86 booting

> > Please wait: booting...

> > Starting udev

> > udev[62]: starting version 165

> > Root filesystem already rw, not remounting Caching udev devnodes

> > Populating dev cache

> > logger: mount: mount point /proc/bus/usb does not exist

> > ALSA: Restoring mixer settings...

> > /usr/sbin/alsactl: load_state:1625: No soundcards found...

> > Configuring network interfaces... eth0      no wireless extensions.

> >

> > udhcpc (v1.18.3) started

> > run-parts: /etc/udhcpc.d/00avahi-autoipd exited with code 1 Sending

> > discover...

> > Sending discover...

> > Sending discover...

> > netlink: 12 bytes leftover after parsing attributes.

> > netlink: 12 bytes leftover after parsing attributes.

> > netlink: 12 bytes leftover after parsing attributes.

> > No lease, failing

> > done.

> > Starting portmap daemon: portmap.

> > net.ipv4.conf.default.rp_filter = 1

> > net.ipv4.conf.all.rp_filter = 1

> > kernel.panic = 10

> > hwclock: can't open '/dev/misc/rtc': No such file or directory Mon

> Nov

> > 5 09:47:00 EST 2012

> > hwclock: can't open '/dev/misc/rtc': No such file or directory

> > INIT: Entering runlevel: 5

> > Starting system message bus: dbus.

> > Starting Dropbear SSH server: dropbear.

> > starting Busybox HTTP Daemon: httpd... done.

> > Starting Vixie-cron.

> > Starting ntpd: done

> > Starting syslogd/klogd: done

> >   * Starting Avahi mDNS/DNS-SD Daemon: avahi-daemon

> >     ...done.

> >

> >>> I noticed over at the linux-at91 fork that you had applied the

> PMECC

> >>> support on the 3.4.x_pmecc_dt_9x5 branch a few months ago.  From

> >>> browsing the mainline I didn't see some of your changes from that

> >>> branch in the mainline.  Are there some changes from the linux-at91

> >> fork that are still scheduled for mainlining?

> >> yes, this patch is not push to mainline yet. Currently the only

> >> concern is we are think about the PMECC error correct bits need to

> >> adjust by ONFI parameters that read from nand flash.

> >> But it is not decide yet. if no exception, this patch will push to

> >> mainline soon.

> >>

> >> Best Regards,

> >> Josh Wu

> >>

> >>> If it helps, here is the boot log when I tried to boot using a 3.7-

> >> rc8

> >>> kernel and DT.

> >>>

> >>> Thanks,

> >>> Bryan

> >>>

> >>> Uncompressing Linux... done, booting the kernel.

> >>> [    0.000000] Booting Linux on physical CPU 0

> >>> [    0.000000] Linux version 3.7.0-rc8-armv5-x0.16 (xxxx@xxxx) (gcc

> >> versio

> >>> n 4.6.2 20121016 (release) [ARM/embedded-4_6-branch revision

> 192487]

> >>> (GNU Tools for ARM Embedded Processors) ) #1 Wed Dec 5 16:11:30 EST

> >> 2012

> >>> [    0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ),

> >> cr=00053177

> >>> [    0.000000] CPU: VIVT data cache, VIVT instruction cache

> >>> [    0.000000] Machine: Atmel AT91SAM (Device Tree), model: Atmel

> >> AT91SAM9G25-EK

> >>> [    0.000000] Memory policy: ECC disabled, Data cache writeback

> >>> [    0.000000] AT91: Detected soc type: at91sam9x5

> >>> [    0.000000] AT91: Detected soc subtype: at91sam9g25

> >>> [    0.000000] AT91: sram at 0x300000 of 0x8000 mapped at

> 0xfef70000

> >>> [    0.000000] Clocks: CPU 400 MHz, master 133 MHz, main 12.000 MHz

> >>> [    0.000000] Built 1 zonelists in Zone order, mobility grouping

> on.

> >> Total pag

> >>> es: 32512

> >>> [    0.000000] Kernel command line: mem=128M console=ttyS0,115200

> >> mtdparts=atmel

> >>> _nand:8M(bootstrap/uboot/kernel)ro,-(rootfs) root=/dev/mtdblock1 rw

> >>> rootfstype=u bifs ubi.mtd=1 root=ubi0:rootfs

> >>> [    0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)

> >>> [    0.000000] Dentry cache hash table entries: 16384 (order: 4,

> >> 65536 bytes)

> >>> [    0.000000] Inode-cache hash table entries: 8192 (order: 3,

> 32768

> >> bytes)

> >>> [    0.000000] Memory: 128MB = 128MB total

> >>> [    0.000000] Memory: 124276k/124276k available, 6796k reserved,

> 0K

> >> highmem

> >>> [    0.000000] Virtual kernel memory layout:

> >>> [    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)

> >>> [    0.000000]     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)

> >>> [    0.000000]     vmalloc : 0xc8800000 - 0xff000000   ( 872 MB)

> >>> [    0.000000]     lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)

> >>> [    0.000000]     modules : 0xbf000000 - 0xc0000000   (  16 MB)

> >>> [    0.000000]       .text : 0xc0008000 - 0xc04b8630   (4802 kB)

> >>> [    0.000000]       .init : 0xc04b9000 - 0xc04e45c4   ( 174 kB)

> >>> [    0.000000]       .data : 0xc04e6000 - 0xc0516ce0   ( 196 kB)

> >>> [    0.000000]        .bss : 0xc0516d04 - 0xc05760bc   ( 381 kB)

> >>> [    0.000000] NR_IRQS:16 nr_irqs:16 16

> >>> [    0.000000] sched_clock: 32 bits at 256 Hz, resolution

> 3906250ns,

> >> wraps every

> >>>    3892314108ms

> >>> [    0.000000] Console: colour dummy device 80x30

> >>> [    0.035156] Calibrating delay loop... 199.80 BogoMIPS

> (lpj=389120)

> >>> [    0.035156] pid_max: default: 32768 minimum: 301

> >>> [    0.035156] Mount-cache hash table entries: 512

> >>> [    0.039062] CPU: Testing write buffer coherency: ok

> >>> [    0.039062] Setting up static identity map for 0x20371d48 -

> >> 0x20371da0

> >>> [    0.039062] devtmpfs: initialized

> >>> [    0.042968] NET: Registered protocol family 16

> >>> [    0.042968] DMA: preallocated 256 KiB pool for atomic coherent

> >> allocations

> >>> [    0.070312] No ATAGs?

> >>> [    0.070312] AT91: Power Management

> >>> [    0.070312] AT91: Starting after power-restored wakeup

> >>> [    0.121093] bio: create slab <bio-0> at 0

> >>> [    0.125000] SCSI subsystem initialized

> >>> [    0.128906] usbcore: registered new interface driver usbfs

> >>> [    0.128906] usbcore: registered new interface driver hub

> >>> [    0.128906] usbcore: registered new device driver usb

> >>> [    0.132812] at91_i2c f8010000.i2c: AT91 i2c bus driver.

> >>> [    0.132812] at91_i2c f8014000.i2c: AT91 i2c bus driver.

> >>> [    0.136718] at91_i2c f8018000.i2c: AT91 i2c bus driver.

> >>> [    0.140625] Switching to clocksource tcb_clksrc

> >>> [    0.195312] NET: Registered protocol family 2

> >>> [    0.199218] TCP established hash table entries: 4096 (order: 3,

> >> 32768 bytes)

> >>> [    0.199218] TCP bind hash table entries: 4096 (order: 2, 16384

> >> bytes)

> >>> [    0.199218] TCP: Hash tables configured (established 4096 bind

> >> 4096)

> >>> [    0.199218] TCP: reno registered

> >>> [    0.199218] UDP hash table entries: 256 (order: 0, 4096 bytes)

> >>> [    0.199218] UDP-Lite hash table entries: 256 (order: 0, 4096

> >> bytes)

> >>> [    0.199218] NET: Registered protocol family 1

> >>> [    0.199218] RPC: Registered named UNIX socket transport module.

> >>> [    0.199218] RPC: Registered udp transport module.

> >>> [    0.199218] RPC: Registered tcp transport module.

> >>> [    0.199218] RPC: Registered tcp NFSv4.1 backchannel transport

> >> module.

> >>> [    0.207031] NFS: Registering the id_resolver key type

> >>> [    0.207031] Key type id_resolver registered

> >>> [    0.207031] Key type id_legacy registered

> >>> [    0.207031] jffs2: version 2.2. (NAND) �© 2001-2006 Red Hat,

> >> Inc.

> >>> [    0.207031] msgmni has been set to 242

> >>> [    0.210937] io scheduler noop registered (default)

> >>> [    0.218750] fffff200.serial: ttyS0 at MMIO 0xfffff200 (irq = 18)

> >> is a ATMEL_S

> >>> ERIAL

> >>> [    0.609375] console [ttyS0] enabled

> >>> [    0.613281] f801c000.serial: ttyS1 at MMIO 0xf801c000 (irq = 22)

> >> is a ATMEL_S

> >>> ERIAL

> >>> [    0.632812] brd: module loaded

> >>> [    0.652343] loop: module loaded

> >>> [    0.667968] atmel_nand: Use On Flash BBT

> >>> [    0.671875] atmel_nand 40000000.nand: No DMA support for NAND

> >> access.

> >>> [    0.675781] ONFI param page 0 valid

> >>> [    0.679687] ONFI flash detected

> >>> [    0.683593] NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda

> >> (Micron MT29F2G

> >>> 08AAD), page size: 2048, OOB size: 64

> >>> [    0.695312] atmel_nand 40000000.nand: Initialize PMECC params,

> >> cap: 2, sector

> >>> : 512

> >>> [    0.703125] Bad block table found at page 131008, version 0x01

> >>> [    0.707031] Bad block table found at page 130944, version 0x01

> >>> [    0.714843] nand_read_bbt: bad block at 0x000009380000

> >>> [    0.718750] 2 cmdlinepart partitions found on MTD device

> >> atmel_nand

> >>> [    0.726562] Creating 2 MTD partitions on "atmel_nand":

> >>> [    0.730468] 0x000000000000-0x000000800000 :

> >> "bootstrap/uboot/kernel"

> >>> [    0.742187] 0x000000800000-0x000010000000 : "rootfs"

> >>> [    0.757812] macb f802c000.ethernet (unregistered net_device):

> >> invalid hw addr

> >>> ess, using random

> >>> [    0.773437] libphy: MACB_mii_bus: probed

> >>> [    0.777343] macb f802c000.ethernet eth0: Cadence MACB at

> >> 0xf802c000 irq 23 (c

> >>> a:2c:e6:c3:59:8f)

> >>> [    0.785156] macb f802c000.ethernet eth0: attached PHY driver

> >> [Davicom DM9161A

> >>> ] (mii_bus:phy_addr=f802c000.etherne:00, irq=-1)

> >>> [    0.796875] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI)

> >> Driver

> >>> [    0.804687] atmel-ehci 700000.ehci: Atmel EHCI UHP HS

> >>> [    0.808593] atmel-ehci 700000.ehci: new USB bus registered,

> >> assigned bus numb

> >>> er 1

> >>> [    0.816406] atmel-ehci 700000.ehci: irq 28, io mem 0x00700000

> >>> [    0.835937] atmel-ehci 700000.ehci: USB 2.0 started, EHCI 1.00

> >>> [    0.839843] usb usb1: New USB device found, idVendor=1d6b,

> >> idProduct=0002

> >>> [    0.847656] usb usb1: New USB device strings: Mfr=3, Product=2,

> >> SerialNumber=

> >>> 1

> >>> [    0.855468] usb usb1: Product: Atmel EHCI UHP HS

> >>> [    0.859375] usb usb1: Manufacturer: Linux 3.7.0-rc8-armv5-x0.16

> >> ehci_hcd

> >>> [    0.867187] usb usb1: SerialNumber: 700000.ehci

> >>> [    0.871093] hub 1-0:1.0: USB hub found

> >>> [    0.875000] hub 1-0:1.0: 3 ports detected

> >>> [    0.878906] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI)

> Driver

> >>> [    0.886718] at91_ohci 600000.ohci: AT91 OHCI

> >>> [    0.890625] at91_ohci 600000.ohci: new USB bus registered,

> >> assigned bus numbe

> >>> r 2

> >>> [    0.898437] at91_ohci 600000.ohci: irq 28, io mem 0x00600000

> >>> [    0.964843] usb usb2: New USB device found, idVendor=1d6b,

> >> idProduct=0001

> >>> [    0.968750] usb usb2: New USB device strings: Mfr=3, Product=2,

> >> SerialNumber=

> >>> 1

> >>> [    0.976562] usb usb2: Product: AT91 OHCI

> >>> [    0.980468] usb usb2: Manufacturer: Linux 3.7.0-rc8-armv5-x0.16

> >> ohci_hcd

> >>> [    0.988281] usb usb2: SerialNumber: at91

> >>> [    0.992187] hub 2-0:1.0: USB hub found

> >>> [    0.996093] hub 2-0:1.0: 2 ports detected

> >>> [    1.003906] usbcore: registered new interface driver cdc_acm

> >>> [    1.007812] cdc_acm: USB Abstract Control Model driver for USB

> >> modems and ISD

> >>> N adapters

> >>> [    1.019531] usbcore: registered new interface driver uas

> >>> [    1.023437] Initializing USB Mass Storage driver...

> >>> [    1.027343] usbcore: registered new interface driver usb-storage

> >>> [    1.035156] USB Mass Storage support registered.

> >>> [    1.039062] usbcore: registered new interface driver ums-alauda

> >>> [    1.046875] usbcore: registered new interface driver ums-cypress

> >>> [    1.054687] usbcore: registered new interface driver ums-datafab

> >>> [    1.058593] usbcore: registered new interface driver

> ums_eneub6250

> >>> [    1.066406] usbcore: registered new interface driver ums-freecom

> >>> [    1.074218] usbcore: registered new interface driver ums-isd200

> >>> [    1.078125] usbcore: registered new interface driver ums-

> jumpshot

> >>> [    1.085937] usbcore: registered new interface driver ums-karma

> >>> [    1.093750] usbcore: registered new interface driver ums-

> onetouch

> >>> [    1.097656] usbcore: registered new interface driver ums-realtek

> >>> [    1.105468] usbcore: registered new interface driver ums-sddr09

> >>> [    1.113281] usbcore: registered new interface driver ums-sddr55

> >>> [    1.117187] usbcore: registered new interface driver ums-usbat

> >>> [    1.125000] usbcore: registered new interface driver usbserial

> >>> [    1.132812] usbcore: registered new interface driver

> >> usbserial_generic

> >>> [    1.140625] usbserial: USB Serial support registered for generic

> >>> [    1.144531] usbcore: registered new interface driver ftdi_sio

> >>> [    1.152343] usbserial: USB Serial support registered for FTDI

> USB

> >> Serial Devi

> >>> ce

> >>> [    1.160156] usbcore: registered new interface driver pl2303

> >>> [    1.167968] usbserial: USB Serial support registered for pl2303

> >>> [    1.171875] mousedev: PS/2 mouse device common for all mice

> >>> [    1.179687] i2c /dev entries driver

> >>> [    1.191406] usbcore: registered new interface driver usbhid

> >>> [    1.199218] usbhid: USB HID core driver

> >>> [    1.207031] usb 1-2: new high-speed USB device number 2 using

> >> atmel-ehci

> >>> [    1.214843] TCP: cubic registered

> >>> [    1.218750] NET: Registered protocol family 10

> >>> [    1.222656] sit: IPv6 over IPv4 tunneling driver

> >>> [    1.230468] NET: Registered protocol family 17

> >>> [    1.234375] Key type dns_resolver registered

> >>> [    1.246093] UBI: attaching mtd1 to ubi0

> >>> [    1.253906] atmel_nand 40000000.nand: PMECC: Too many errors

> >>> [    1.261718] UBI warning: ubi_io_read: error -5 while reading 64

> >> bytes from PE

> >>> B 10:0, read only 0 bytes, retry

> >>> [    1.269531] atmel_nand 40000000.nand: PMECC: Too many errors

> >>> [    1.277343] UBI warning: ubi_io_read: error -5 while reading 64

> >> bytes from PE

> >>> B 10:0, read only 0 bytes, retry

> >>> [    1.285156] atmel_nand 40000000.nand: PMECC: Too many errors

> >>> [    1.292968] UBI warning: ubi_io_read: error -5 while reading 64

> >> bytes from PE

> >>> B 10:0, read only 0 bytes, retry

> >>> [    1.304687] atmel_nand 40000000.nand: PMECC: Too many errors

> >>> [    1.308593] UBI error: ubi_io_read: error -5 while reading 64

> >> bytes from PEB

> >>> 10:0, read 0 bytes

> >>> [    1.316406] [<c000d2bc>] (unwind_backtrace+0x0/0xe0) from

> >> [<c0243a10>] (ubi_i

> >>> o_read+0x1d4/0x2a4)

> >>> [    1.328125] [<c0243a10>] (ubi_io_read+0x1d4/0x2a4) from

> >> [<c0243d20>] (ubi_io_

> >>> read_ec_hdr+0x68/0x214)

> >>> [    1.335937] [<c0243d20>] (ubi_io_read_ec_hdr+0x68/0x214) from

> >> [<c024804c>] (u

> >>> bi_attach+0x104/0x13e4)

> >>> [    1.343750] [<c024804c>] (ubi_attach+0x104/0x13e4) from

> >> [<c023e514>] (ubi_att

> >>> ach_mtd_dev+0x5a4/0xb94)

> >>> [    1.355468] [<c023e514>] (ubi_attach_mtd_dev+0x5a4/0xb94) from

> >> [<c04d09dc>] (

> >>> ubi_init+0x1d8/0x2d8)

> >>> [    1.363281] [<c04d09dc>] (ubi_init+0x1d8/0x2d8) from

> [<c0008860>]

> >> (do_one_ini

> >>> tcall+0x90/0x168)

> >>> [    1.371093] [<c0008860>] (do_one_initcall+0x90/0x168) from

> >> [<c03686a4>] (kern

> >>> el_init+0xe8/0x2a0)

> >>> [    1.378906] [<c03686a4>] (kernel_init+0xe8/0x2a0) from

> >> [<c00093f0>] (ret_from

> >>> _fork+0x14/0x24)

> >>> [    1.386718] UBI error: ubi_attach_mtd_dev: failed to attach

> mtd1,

> >> error -5

> >>> [    1.394531] UBI error: ubi_init: cannot attach mtd1

> >>> [    1.402343] drivers/rtc/hctosys.c: unable to open rtc device

> >> (rtc0)

> >>> [    1.410156] UBIFS error (pid 1): ubifs_mount: cannot open

> >> "ubi0:rootfs", erro

> >>> r -19

> >>> [    1.417968] VFS: Cannot open root device "ubi0:rootfs" or

> unknown-

> >> block(0,0):

> >>>    error -19

> >>> [    1.425781] Please append a correct "root=" boot option; here

> are

> >> the availab

> >>> le partitions:

> >>> [    1.433593] 1f00            8192 mtdblock0  (driver?)

> >>> [    1.437500] 1f01          253952 mtdblock1  (driver?)

> >>> [    1.441406] Kernel panic - not syncing: VFS: Unable to mount

> root

> >> fs on unkno

> >>> wn-block(0,0)

> >>>

> >>>
Wu, Josh - Dec. 10, 2012, 10:51 a.m.
Hi, Bryan

On 12/7/2012 10:47 PM, Bryan Evenson wrote:
> Josh,
>
> Answers below.
>
> Regards,
> Bryan
>
>> -----Original Message-----
>> From: Josh Wu [mailto:josh.wu@atmel.com]
>> Sent: Friday, December 07, 2012 4:31 AM
>> To: Bryan Evenson
>> Cc: linux-arm-kernel@lists.infradead.org
>> Subject: Re: at91: Status of NAND flash access
>>
>> Hi, Bryan
>>
>> Thanks for doing such test. see my comment below:
>>
>> On 12/6/2012 9:20 PM, Bryan Evenson wrote:
>>>> -----Original Message-----
>>>> From: Josh Wu [mailto:josh.wu@atmel.com]
>>>> Sent: Thursday, December 06, 2012 5:30 AM
>>>> To: Bryan Evenson
>>>> Cc: linux-arm-kernel@lists.infradead.org
>>>> Subject: Re: at91: Status of NAND flash access
>>>>
>>>> On 12/6/2012 11:13 AM, Bryan Evenson wrote:
>>>>> Josh,
>>>>>
>>>>> I spoke too soon.  I was able to read and use the filesystem from
>>>> NAND
>>>>> flash with the patch you provided when I applied it to the Atmel
>> 3.4
>>>>> kernel fork over at https://github.com/linux4sam/linux-at91/
>> (master
>>>> branch).
>>>>> When I applied the same patch to the recent mainline kernel (3.7-
>>>> rc8),
>>>>> it's still having problems accessing flash.  The boot log shows
>> that
>>>>> it is setting up for PMECC correctly, but it has errors when it
>>>>> tries to read from the filesystem.
>>>> It is strange.  The 3.4 kernel from at91 github just have a few
>>>> changes.
>>>> so rationally it behavior the same at PMECC function. From your log,
>>>> the
>>>> 3.7-rc8 kernel says the PMECC found uncorrectable errors.
>>>>
>>>> Can you try to dump or read from the u-boot? to see whether u-boot
>>>> can recognize the same nand page that "too many errors" happened in
>> kernel?
>>>> I will do some test to see whether the 3.7-rc8 can work in my side
>> or
>>>> not.
>>> U-Boot> nand read 0x22000000 0x800000 0x1D00000
>>>
>>> NAND read: device 0 offset 0x800000, size 0x1d00000
>>> PMECC: Too many errors
>>> NAND read from offset 800000 failed -5
>>>    0 bytes read: ERROR
>>>
>>> So u-boot has the same issue.
>> seems some page are really damaged or the error correction code has
>> bugs.
>>
>>> However, changing the kernel to the linux-at91 forked kernel produced
>>> different results.  That kernel noted the PMECC errors but was still
>>> able to load the filesystem.
>> I don't find the 3.4 kernel noted the PMECC errors in your attached
>> log.
>>
>>>     My boot output from the successful
>>> filesystem load is below.  Is the 3.4 kernel performing corrections
>>> that the mainline is not,
>> no. I don't think so. The PMECC part of patch is the almost same. Only
>> some minor change are made in v3.4 for back port.
>>
>>> or is it just ignoring errors that it should not be ignoring?
>> This is more possible. I means maybe 3.4 kernel doesn't check some area
>> 3.7-rc8 checked.
>>
>>> I'm hesitant to make any filesystem changes on this board because I
>>> know test cases like this where it works one way but not the other
>> are
>>> kind of rare.  Let me know if you have similar results on your end.
>> I tested in two version of kernel my side:
>>    1. https://github.com/linux4sam/linux-at91/commits/at91-3.4-
>> trunk_merge
>>             fcf88e036fce6c382510874b1dc90e9b49608ccf (Merge branch
>> 'at91-3.4-trunk/v3.4.x_gmac' into at91-3.4-trunk_merge)
>>    2. v3.7-rc8 plus the patch I sent to you to enable PMECC in dtsi.
>>
>> I cannot reproduce the situation you met In my side. Both can boot the
>> ubi rootfs system correctly.
>>
>> So the your case is rare.
>>
>> To find out why those two kernel work differently, could you help me to
>> do:
>>
>>      1. use u-boot "nand read" to do some bisect in nand flash offset,
>> which we can narrow down the page that has uncorrectable pmecc errors.
>>
> After trial and error, I got down to this:
> nand read 0x22000000 0x865000 0x100
>
> NAND read: device 0 offset 0x865000, size 0x100
> PMECC: Too many errors
> NAND read from offset 865000 failed -5
>   0 bytes read: ERROR
>
>>      2. use u-boot "nand dump offset" to show the raw data of that page.
>> please send me the log. I can generate the same page from your log. and
>> check whether it can be corrected in my side.
> U-Boot> nand dump 0x865000
> Page 00865000 dump:
>          31 18 10 06 52 bd c6 c9  5d 44 02 00 00 00 00 00
>          00 02 00 00 07 00 00 00  04 15 00 00 00 00 00 00
>          05 00 00 00 00 00 00 00  03 00 00 00 04 00 00 00
>          0f 01 00 00 c8 5a 00 00  58 00 00 00 d8 00 00 00
>          0f 01 00 00 00 60 00 00  30 3b 0b 00 00 00 00 00
>          00 18 7a 0c 00 00 00 00  08 2f 84 00 00 00 00 00
>          c8 ad b6 01 00 00 00 00  c0 5a 02 00 00 00 00 00
>          08 06 a3 00 00 00 00 00  08 00 00 00 e2 28 00 00
>          08 00 00 00 00 30 00 00  08 00 00 00 00 28 00 00
>          00 00 00 00 00 00 00 00  67 01 00 00 6e 06 00 00
>          07 00 00 00 a8 07 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          31 18 10 06 ef de 0e ee  00 00 00 00 00 00 00 00
>          1c 00 00 00 05 00 00 00  e4 05 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>          00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
> 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 3f 00 02 00

If we enable 2 bits PMECC with sector size "512", then this page is 
uncorrectable.
in this case, all PMECC byte should be last 16 bytes in the end of oob. 
Every sector (512 bytes) has 4 bytes pmecc bytes
And "0xff 0xff 0xff 0xff" means the whole sector is "0xff".
so in your page's ecc value, the first 3 sector are all "0xff", but the 
the first 3 sector data are not "0xff".

I write same data in my nand flash with 2bit PMECC, the oob should be:

U-Boot> nand dump b0000
Page 000b0000 dump:
         31 18 10 06 52 bd c6 c9  5d 44 02 00 00 00 00 00
         00 02 00 00 07 00 00 00  04 15 00 00 00 00 00 00
         05 00 00 00 00 00 00 00  03 00 00 00 04 00 00 00
         0f 01 00 00 c8 5a 00 00  58 00 00 00 d8 00 00 00
         0f 01 00 00 00 60 00 00  30 3b 0b 00 00 00 00 00
         00 18 7a 0c 00 00 00 00  08 2f 84 00 00 00 00 00
         c8 ad b6 01 00 00 00 00  c0 5a 02 00 00 00 00 00
         08 06 a3 00 00 00 00 00  08 00 00 00 e2 28 00 00
         08 00 00 00 00 30 00 00  08 00 00 00 00 28 00 00
         00 00 00 00 00 00 00 00  67 01 00 00 6e 06 00 00
         07 00 00 00 a8 07 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         31 18 10 06 ef de 0e ee  00 00 00 00 00 00 00 00
         1c 00 00 00 05 00 00 00  e4 05 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
         00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
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
         20 02 b8 03 a3 e6 97 01
         00 00 00 00 00 00 00 00

So I wondering that the pmecc is set correctly or not.

>>      3. in 3.4 kernel, use dd command to read that page, to see any
>> uncorrectable pmecc error happen.
>>            if no error happens in 3.4, then it means it correct that
>> v3.7-rc8 cannot. There mush be something different in 3.4 kernel pmecc
>> between mainline.
>>            if error happens, that means 3.4 kernel skips those area but
>> 3.7-rc8 does not. So I suspect it maybe caused by some code of UBI part
>> changes.
> root@at91sam9x5ek:~# dd if=/dev/mtd1 of=/var/log/dump.bin bs=1k count=1 skip=65
> 1+0 records in
> 1+0 records out
> 1024 bytes (1.0KB) copied, 0.001962 seconds, 509.7KB/s
>
> If I understand dd correctly, that should be reading 1KB of data starting at
> 0x865000 (/dev/mtd1 starts at 0x800000, plus offset of 65 1KB blocks).

hmm, the 0x1000 is not 1k, it is 4k.
and the skip block number should be 0x65, that means 101.
so the command line in your case should be:

dd if=/dev/mtd1 of=/var/log/dump.bin bs=4k count=1 skip=101

the better idea is, use following command to check the result to make 
sure your dump right offset.
   hexdump -C /var/log/dump.bin


>   If I
> read the wrong block, let me know what the correct command line should be.
>
>> Best Regards,
>> Josh Wu
>>
>>> -Bryan
>>>
>>>
[snip]

I my thought, the situation in your side is:
    1. The same board and the nand flash rootfs is the same. same 
bootargs for the mtd partitions.
    2. Only use tftp to load different dtb and uImage via u-boot. (3.4 
and 3.7-rc8)
    3. Different kernel cause different result.

So my suggested test is base on above assumption.

But since you flush the dtb into nand flash (in your readme file of the 
dropbox), so it is not like the situation as I list above.

Since I already got your shared file in dropbox, so I will test your 
kernel in my 9g25ek board tomorrow in Shanghai time zone to see what 
will happen in my side. :)

Best Regards,
Josh Wu
Wu, Josh - Dec. 11, 2012, 8:46 a.m.
Hi, Bryan

I tested your kernel & dtb (both 3.4 and 3.7-rc8) that you shared in 
dropbox. I can produce your situation. in my case the pmecc error offset 
is 0x86a000.
the test steps is:
    1. use a sd card boot at91bootstrap and u-boot to boot a 
at91sam9g25ek board.
    2. use u-boot command to flush a ubi rootfs in 0x800000.
    3. load your 3.4 kernel and dtb. it will boot ok.
    4. load your 3.7-rc8 kernel and dtb. it will fail to boot. "too many 
errors" happens.

But use the test step (not load 3.4 kernel & dtb):
    1. use a sd card boot at91bootstrap and u-boot to boot a 
at91sam9g25ek board.
    2. use u-boot command to flush a ubi rootfs in 0x800000.
    3. load your 3.7-rc8 kernel and dtb. it will boot ok. (use my own 
3.4 kernel & my dtb is also boot ok.)

Since I don't write DTB in nand flash at all. so it is not caused by 
write dtb in nand flash.

So I suspect your 3.4 kernel cause those problem.
Check your kernel 3.4 boot log, I suspect that PMECC is not enabled in 
your 3.4 kernel. Since in the log, I don't find the line :  atmel_nand 
40000000.nand: Initialize PMECC params, cap: 2, sector: 512

After checking your 3.4 dtb. it shows below, and the PMECC parameters is 
set correctly.

U-Boot> tftp 21000000 josh/kernel/dt/zImage-3.4-r7-at91sam9x5ek.dtb
macb0: PHY present at 0
macb0: Starting autonegotiation...
macb0: Autonegotiation complete
macb0: link up, 100Mbps full-duplex (lpa: 0x45e1)
Using macb0 device
TFTP from server 10.217.6.34; our IP address is 10.217.3.136
Filename 'josh/kernel/dt/zImage-3.4-r7-at91sam9x5ek.dtb'.
Load address: 0x21000000
Loading: *###
done
Bytes transferred = 12288 (3000 hex)
U-Boot> fdt addr 21000000
U-Boot> fdt print
.......
         nand@40000000 {
             compatible = "atmel,at91rm9200-nand";
             #address-cells = <0x1>;
             #size-cells = <0x1>;
             reg = <0x40000000 0x10000000 0xffffe000 0x600 0xffffe600 
0x200 0x100000 0x100000>;
             atmel,pmecc-lookup-table-offset = <0x8000 0x10000>;
             atmel,nand-addr-offset = <0x15>;
             atmel,nand-cmd-offset = <0x16>;
             gpios = <0x2 0x5 0x0 0x2 0x4 0x0 0x0>;
             status = "okay";
             nand-bus-width = <0x8>;
             nand-ecc-mode = "hw";
             atmel,has-pmecc;
             atmel,pmecc-cap = <0x2>;
             atmel,pmecc-sector-size = <0x200>;
             nand-on-flash-bbt;
.......

but in the log (my comment is in below):

On 12/6/2012 9:20 PM, Bryan Evenson wrote:
>> -----Original Message-----
>> From: Josh Wu [mailto:josh.wu@atmel.com]
>> Sent: Thursday, December 06, 2012 5:30 AM
>> To: Bryan Evenson
>> Cc: linux-arm-kernel@lists.infradead.org
>> Subject: Re: at91: Status of NAND flash access
>>
>> On 12/6/2012 11:13 AM, Bryan Evenson wrote:
>>> Josh,
>>>
>>> I spoke too soon.  I was able to read and use the filesystem from
>> NAND
>>> flash with the patch you provided when I applied it to the Atmel 3.4
>>> kernel fork over at https://github.com/linux4sam/linux-at91/ (master
>> branch).
>>> When I applied the same patch to the recent mainline kernel (3.7-
>> rc8),
>>> it's still having problems accessing flash.  The boot log shows that
>>> it is setting up for PMECC correctly, but it has errors when it tries
>>> to read from the filesystem.
>> It is strange.  The 3.4 kernel from at91 github just have a few
>> changes.
>> so rationally it behavior the same at PMECC function. From your log,
>> the
>> 3.7-rc8 kernel says the PMECC found uncorrectable errors.
>>
>> Can you try to dump or read from the u-boot? to see whether u-boot can
>> recognize the same nand page that "too many errors" happened in kernel?
>> I will do some test to see whether the 3.7-rc8 can work in my side or
>> not.
> U-Boot> nand read 0x22000000 0x800000 0x1D00000
>
> NAND read: device 0 offset 0x800000, size 0x1d00000
> PMECC: Too many errors
> NAND read from offset 800000 failed -5
>   0 bytes read: ERROR
>
> So u-boot has the same issue.  However, changing the kernel to the linux-at91
> forked kernel produced different results.  That kernel noted the PMECC errors
> but was still able to load the filesystem.  My boot output from the successful
> filesystem load is below.  Is the 3.4 kernel performing corrections that the
> mainline is not, or is it just ignoring errors that it should not be ignoring?
>
> I'm hesitant to make any filesystem changes on this board because I know test
> cases like this where it works one way but not the other are kind of rare.  Let
> me know if you have similar results on your end.
>
> -Bryan
>
> Uncompressing Linux... done, booting the kernel.
> Booting Linux on physical CPU 0
> Linux version 3.4.0 (xxxx@xxxx) (gcc version 4.5.3 20110311 (prerelease) (
> GCC) ) #2 Wed Dec 5 15:36:29 EST 2012
> CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
> CPU: VIVT data cache, VIVT instruction cache
> Machine: Atmel AT91SAM (Device Tree), model: Atmel AT91SAM9G25-EK
> Memory policy: ECC disabled, Data cache writeback
> AT91: Detected soc type: at91sam9x5
> AT91: Detected soc subtype: at91sam9g25
> AT91: sram at 0x300000 of 0x8000 mapped at 0xfef70000
> Clocks: CPU 400 MHz, master 133 MHz, main 12.000 MHz
> gpiochip_add: registered GPIOs 0 to 31 on device: pioA
> gpiochip_add: registered GPIOs 32 to 63 on device: pioB
> gpiochip_add: registered GPIOs 64 to 95 on device: pioC
> gpiochip_add: registered GPIOs 96 to 127 on device: pioD
> Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512
> Kernel command line: mem=128M console=ttyS0,115200 mtdparts=atmel_nand:8M(bootst
> rap/uboot/kernel)ro,-(rootfs) root=/dev/mtdblock1 rw rootfstype=ubifs ubi.mtd=1
> root=ubi0:rootfs
> PID hash table entries: 512 (order: -1, 2048 bytes)
> Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
> Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
> Memory: 128MB = 128MB total
> Memory: 119856k/119856k available, 11216k reserved, 0K highmem
> Virtual kernel memory layout:
>      vector  : 0xffff0000 - 0xffff1000   (   4 kB)
>      fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
>      vmalloc : 0xc8800000 - 0xff000000   ( 872 MB)
>      lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)
>      modules : 0xbf000000 - 0xc0000000   (  16 MB)
>        .text : 0xc0008000 - 0xc04650d4   (4469 kB)
>        .init : 0xc0466000 - 0xc048a000   ( 144 kB)
>        .data : 0xc048a000 - 0xc04c4420   ( 234 kB)
>         .bss : 0xc04c4444 - 0xc09c66e4   (5129 kB)
> NR_IRQS:192
> sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every 4294967286ms
> Console: colour dummy device 80x30
> Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar
> ... MAX_LOCKDEP_SUBCLASSES:  8
> ... MAX_LOCK_DEPTH:          48
> ... MAX_LOCKDEP_KEYS:        8191
> ... CLASSHASH_SIZE:          4096
> ... MAX_LOCKDEP_ENTRIES:     16384
> ... MAX_LOCKDEP_CHAINS:      32768
> ... CHAINHASH_SIZE:          16384
>   memory used by lock dependency info: 3695 kB
>   per task-struct memory footprint: 1152 bytes
> ------------------------
> | Locking API testsuite:
> ----------------------------------------------------------------------------
>                                   | spin |wlock |rlock |mutex | wsem | rsem |
>    --------------------------------------------------------------------------
>                       A-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
>                   A-B-B-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
>               A-B-B-C-C-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
>               A-B-C-A-B-C deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
>           A-B-B-C-C-D-D-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
>           A-B-C-D-B-D-D-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
>           A-B-C-D-B-C-D-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
>                      double unlock:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
>                    initialize held:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
>                   bad unlock order:  ok  |  ok  |  ok  |  ok  |  ok  |  ok  |
>    --------------------------------------------------------------------------
>                recursive read-lock:             |  ok  |             |  ok  |
>             recursive read-lock #2:             |  ok  |             |  ok  |
>              mixed read-write-lock:             |  ok  |             |  ok  |
>              mixed write-read-lock:             |  ok  |             |  ok  |
>    --------------------------------------------------------------------------
>       hard-irqs-on + irq-safe-A/12:  ok  |  ok  |  ok  |
>       soft-irqs-on + irq-safe-A/12:  ok  |  ok  |  ok  |
>       hard-irqs-on + irq-safe-A/21:  ok  |  ok  |  ok  |
>       soft-irqs-on + irq-safe-A/21:  ok  |  ok  |  ok  |
>         sirq-safe-A => hirqs-on/12:  ok  |  ok  |  ok  |
>         sirq-safe-A => hirqs-on/21:  ok  |  ok  |  ok  |
>           hard-safe-A + irqs-on/12:  ok  |  ok  |  ok  |
>           soft-safe-A + irqs-on/12:  ok  |  ok  |  ok  |
>           hard-safe-A + irqs-on/21:  ok  |  ok  |  ok  |
>           soft-safe-A + irqs-on/21:  ok  |  ok  |  ok  |
>      hard-safe-A + unsafe-B #1/123:  ok  |  ok  |  ok  |
>      soft-safe-A + unsafe-B #1/123:  ok  |  ok  |  ok  |
>      hard-safe-A + unsafe-B #1/132:  ok  |  ok  |  ok  |
>      soft-safe-A + unsafe-B #1/132:  ok  |  ok  |  ok  |
>      hard-safe-A + unsafe-B #1/213:  ok  |  ok  |  ok  |
>      soft-safe-A + unsafe-B #1/213:  ok  |  ok  |  ok  |
>      hard-safe-A + unsafe-B #1/231:  ok  |  ok  |  ok  |
>      soft-safe-A + unsafe-B #1/231:  ok  |  ok  |  ok  |
>      hard-safe-A + unsafe-B #1/312:  ok  |  ok  |  ok  |
>      soft-safe-A + unsafe-B #1/312:  ok  |  ok  |  ok  |
>      hard-safe-A + unsafe-B #1/321:  ok  |  ok  |  ok  |
>      soft-safe-A + unsafe-B #1/321:  ok  |  ok  |  ok  |
>      hard-safe-A + unsafe-B #2/123:  ok  |  ok  |  ok  |
>      soft-safe-A + unsafe-B #2/123:  ok  |  ok  |  ok  |
>      hard-safe-A + unsafe-B #2/132:  ok  |  ok  |  ok  |
>      soft-safe-A + unsafe-B #2/132:  ok  |  ok  |  ok  |
>      hard-safe-A + unsafe-B #2/213:  ok  |  ok  |  ok  |
>      soft-safe-A + unsafe-B #2/213:  ok  |  ok  |  ok  |
>      hard-safe-A + unsafe-B #2/231:  ok  |  ok  |  ok  |
>      soft-safe-A + unsafe-B #2/231:  ok  |  ok  |  ok  |
>      hard-safe-A + unsafe-B #2/312:  ok  |  ok  |  ok  |
>      soft-safe-A + unsafe-B #2/312:  ok  |  ok  |  ok  |
>      hard-safe-A + unsafe-B #2/321:  ok  |  ok  |  ok  |
>      soft-safe-A + unsafe-B #2/321:  ok  |  ok  |  ok  |
>        hard-irq lock-inversion/123:  ok  |  ok  |  ok  |
>        soft-irq lock-inversion/123:  ok  |  ok  |  ok  |
>        hard-irq lock-inversion/132:  ok  |  ok  |  ok  |
>        soft-irq lock-inversion/132:  ok  |  ok  |  ok  |
>        hard-irq lock-inversion/213:  ok  |  ok  |  ok  |
>        soft-irq lock-inversion/213:  ok  |  ok  |  ok  |
>        hard-irq lock-inversion/231:  ok  |  ok  |  ok  |
>        soft-irq lock-inversion/231:  ok  |  ok  |  ok  |
>        hard-irq lock-inversion/312:  ok  |  ok  |  ok  |
>        soft-irq lock-inversion/312:  ok  |  ok  |  ok  |
>        hard-irq lock-inversion/321:  ok  |  ok  |  ok  |
>        soft-irq lock-inversion/321:  ok  |  ok  |  ok  |
>        hard-irq read-recursion/123:  ok  |
>        soft-irq read-recursion/123:  ok  |
>        hard-irq read-recursion/132:  ok  |
>        soft-irq read-recursion/132:  ok  |
>        hard-irq read-recursion/213:  ok  |
>        soft-irq read-recursion/213:  ok  |
>        hard-irq read-recursion/231:  ok  |
>        soft-irq read-recursion/231:  ok  |
>        hard-irq read-recursion/312:  ok  |
>        soft-irq read-recursion/312:  ok  |
>        hard-irq read-recursion/321:  ok  |
>        soft-irq read-recursion/321:  ok  |
> -------------------------------------------------------
> Good, all 218 testcases passed! |
> ---------------------------------
> Calibrating delay loop... 198.04 BogoMIPS (lpj=990208)
> pid_max: default: 32768 minimum: 301
> Mount-cache hash table entries: 512
> CPU: Testing write buffer coherency: ok
> Setting up static identity map for 0x2033ced8 - 0x2033cf30
> devtmpfs: initialized
> dummy:
> NET: Registered protocol family 16
> AT91: Power Management (with slow clock mode)
> AT91: Starting after power-restored wakeup
> bio: create slab <bio-0> at 0
> at_hdmac ffffec00.dma-controller: Atmel AHB DMA Controller ( cpy slave ), 8 chan
> nels
> at_hdmac ffffee00.dma-controller: Atmel AHB DMA Controller ( cpy slave ), 8 chan
> nels
> SCSI subsystem initialized
> usbcore: registered new interface driver usbfs
> usbcore: registered new interface driver hub
> usbcore: registered new device driver usb
> cfg80211: Calling CRDA to update world regulatory domain
> Switching to clocksource tcb_clksrc
> NET: Registered protocol family 2
> IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
> TCP established hash table entries: 4096 (order: 3, 32768 bytes)
> TCP bind hash table entries: 4096 (order: 5, 147456 bytes)
> TCP: Hash tables configured (established 4096 bind 4096)
> TCP: reno registered
> UDP hash table entries: 64 (order: 0, 5120 bytes)
> UDP-Lite hash table entries: 64 (order: 0, 5120 bytes)
> NET: Registered protocol family 1
> RPC: Registered named UNIX socket transport module.
> RPC: Registered udp transport module.
> RPC: Registered tcp transport module.
> RPC: Registered tcp NFSv4.1 backchannel transport module.
> NFS: Registering the id_resolver key type
> jffs2: version 2.2. (NAND) (SUMMARY)  �© 2001-2006 Red Hat, Inc.
> msgmni has been set to 234
> Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
> io scheduler noop registered (default)
> fffff200.serial: ttyS0 at MMIO 0xfffff200 (irq = 1) is a ATMEL_SERIAL
> console [ttyS0] enabled
> f801c000.serial: ttyS1 at MMIO 0xf801c000 (irq = 5) is a ATMEL_SERIAL
> f8020000.serial: ttyS2 at MMIO 0xf8020000 (irq = 6) is a ATMEL_SERIAL
> f8028000.serial: ttyS4 at MMIO 0xf8028000 (irq = 8) is a ATMEL_SERIAL
> brd: module loaded
> loop: module loaded
> mtdoops: mtd device (mtddev=name/number) must be supplied
> atmel_nand: Use On Flash BBT
> atmel_nand 40000000.nand: No DMA support for NAND access.
> ONFI param page 0 valid
> ONFI flash detected
> NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda (Micron MT29F2G08AAD)

Here, when PMECC is really enabled, the driver should show following 
message:
    atmel_nand 40000000.nand: Initialize PMECC params, cap: 2, sector: 512

But your 3.4's log doesn't have it. If the dtb is right then maybe the 
issue is caused in the driver?

Can you check your 3.4 kernel code, make sure the function 
atmel_pmecc_nand_init_params() is called or not?

Best Regards,
Josh Wu

> Bad block table found at page 131008, version 0x01
> Bad block table found at page 130944, version 0x01
> nand_read_bbt: bad block at 0x000009380000
> 2 cmdlinepart partitions found on MTD device atmel_nand
> Creating 2 MTD partitions on "atmel_nand":
> 0x000000000000-0x000000800000 : "bootstrap/uboot/kernel"
> 0x000000800000-0x000010000000 : "rootfs"
> UBI: attaching mtd1 to ubi0
> UBI: physical eraseblock size:   131072 bytes (128 KiB)
> UBI: logical eraseblock size:    126976 bytes
> UBI: smallest flash I/O unit:    2048
> UBI: VID header offset:          2048 (aligned 2048)
> UBI: data offset:                4096
> UBI: max. sequence number:       4249
> UBI warning: print_rsvd_warning: cannot reserve enough PEBs for bad PEB handling
> , reserved 15, need 19
> UBI: attached mtd1 to ubi0
> UBI: MTD device name:            "rootfs"
> UBI: MTD device size:            248 MiB
> UBI: number of good PEBs:        1979
> UBI: number of bad PEBs:         5
> UBI: number of corrupted PEBs:   0
> UBI: max. allowed volumes:       128
> UBI: wear-leveling threshold:    4096
> UBI: number of internal volumes: 1
> UBI: number of user volumes:     1
> UBI: available PEBs:             0
> UBI: total number of reserved PEBs: 1979
> UBI: number of PEBs reserved for bad PEB handling: 15
> UBI: max/mean erase counter: 5/2
> UBI: image sequence number:  191777507
> UBI: background thread "ubi_bgt0d" started, PID 31
> UBI error: ubi_init: cannot attach mtd1
> tun: Universal TUN/TAP device driver, 1.6
> tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>
> macb f802c000.ethernet: (unregistered net_device): invalid hw address, using ran
> dom
> MACB_mii_bus: probed
> macb f802c000.ethernet: eth0: Cadence MACB at 0xf802c000 irq 24 (4a:15:f4:49:94:
> a4)
> macb f802c000.ethernet: eth0: attached PHY driver [Davicom DM9161A] (mii_bus:phy
> _addr=f802c000.etherne:00, irq=-1)
> PPP generic driver version 2.4.2
> NET: Registered protocol family 24
> usbcore: registered new interface driver asix
> usbcore: registered new interface driver cdc_ether
> usbcore: registered new interface driver cdc_eem
> usbcore: registered new interface driver net1080
> usbcore: registered new interface driver cdc_subset
> usbcore: registered new interface driver zaurus
> usbcore: registered new interface driver ipheth
> usbcore: registered new interface driver cdc_ncm
> ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
> atmel-ehci 700000.ehci: Atmel EHCI UHP HS
> atmel-ehci 700000.ehci: new USB bus registered, assigned bus number 1
> atmel-ehci 700000.ehci: irq 22, io mem 0x00700000
> atmel-ehci 700000.ehci: USB 2.0 started, EHCI 1.00
> usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
> usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
> usb usb1: Product: Atmel EHCI UHP HS
> usb usb1: Manufacturer: Linux 3.4.0 ehci_hcd
> usb usb1: SerialNumber: 700000.ehci
> hub 1-0:1.0: USB hub found
> hub 1-0:1.0: 3 ports detected
> ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
> at91_ohci 600000.ohci: AT91 OHCI
> at91_ohci 600000.ohci: new USB bus registered, assigned bus number 2
> at91_ohci 600000.ohci: irq 22, io mem 0x00600000
> usb usb2: New USB device found, idVendor=1d6b, idProduct=0001
> usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
> usb usb2: Product: AT91 OHCI
> usb usb2: Manufacturer: Linux 3.4.0 ohci_hcd
> usb usb2: SerialNumber: at91
> hub 2-0:1.0: USB hub found
> hub 2-0:1.0: 2 ports detected
> usbcore: registered new interface driver cdc_acm
> cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
> Initializing USB Mass Storage driver...
> usbcore: registered new interface driver usb-storage
> USB Mass Storage support registered.
> usbcore: registered new interface driver libusual
> usbcore: registered new interface driver usbserial
> usbcore: registered new interface driver usbserial_generic
> USB Serial support registered for generic
> usbserial: USB Serial Driver core
> usbcore: registered new interface driver moto-modem
> USB Serial support registered for moto-modem
> usbcore: registered new interface driver opticon
> USB Serial support registered for opticon
> usbcore: registered new interface driver pl2303
> USB Serial support registered for pl2303
> usbcore: registered new interface driver qcserial
> USB Serial support registered for Qualcomm USB modem
> usbcore: registered new interface driver symbol
> USB Serial support registered for symbol
> i2c /dev entries driver
> usbcore: registered new interface driver usbhid
> usbhid: USB HID core driver
> nf_conntrack version 0.5.0 (1872 buckets, 7488 max)
> IPv4 over IPv4 tunneling driver
> ip_tables: (C) 2000-2006 Netfilter Core Team
> TCP: cubic registered
> NET: Registered protocol family 17
> lib80211: common routines for IEEE802.11 drivers
> Registering the dns_resolver key type
> drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
> UBIFS: recovery needed
> UBIFS: recovery completed
> UBIFS: mounted UBI device 0, volume 0, name "rootfs"
> UBIFS: file system size:   247476224 bytes (241676 KiB, 236 MiB, 1949 LEBs)
> UBIFS: journal size:       9023488 bytes (8812 KiB, 8 MiB, 72 LEBs)
> UBIFS: media format:       w4/r0 (latest is w4/r0)
> UBIFS: default compressor: lzo
> UBIFS: reserved for root:  0 bytes (0 KiB)
> VFS: Mounted root (ubifs filesystem) on device 0:11.
> devtmpfs: mounted
> Freeing init memory: 144K
> INIT: version 2.86 booting
> Please wait: booting...
> Starting udev
> udev[62]: starting version 165
> Root filesystem already rw, not remounting
> Caching udev devnodes
> Populating dev cache
> logger: mount: mount point /proc/bus/usb does not exist
> ALSA: Restoring mixer settings...
> /usr/sbin/alsactl: load_state:1625: No soundcards found...
> Configuring network interfaces... eth0      no wireless extensions.
>
> udhcpc (v1.18.3) started
> run-parts: /etc/udhcpc.d/00avahi-autoipd exited with code 1
> Sending discover...
> Sending discover...
> Sending discover...
> netlink: 12 bytes leftover after parsing attributes.
> netlink: 12 bytes leftover after parsing attributes.
> netlink: 12 bytes leftover after parsing attributes.
> No lease, failing
> done.
> Starting portmap daemon: portmap.
> net.ipv4.conf.default.rp_filter = 1
> net.ipv4.conf.all.rp_filter = 1
> kernel.panic = 10
> hwclock: can't open '/dev/misc/rtc': No such file or directory
> Mon Nov  5 09:47:00 EST 2012
> hwclock: can't open '/dev/misc/rtc': No such file or directory
> INIT: Entering runlevel: 5
> Starting system message bus: dbus.
> Starting Dropbear SSH server: dropbear.
> starting Busybox HTTP Daemon: httpd... done.
> Starting Vixie-cron.
> Starting ntpd: done
> Starting syslogd/klogd: done
>   * Starting Avahi mDNS/DNS-SD Daemon: avahi-daemon
>     ...done.
>
>>> I noticed over at the linux-at91 fork that you had applied the PMECC
>>> support on the 3.4.x_pmecc_dt_9x5 branch a few months ago.  From
>>> browsing the mainline I didn't see some of your changes from that
>>> branch in the mainline.  Are there some changes from the linux-at91
>> fork that are still scheduled for mainlining?
>> yes, this patch is not push to mainline yet. Currently the only concern
>> is we are think about the PMECC error correct bits need to adjust by
>> ONFI parameters that read from nand flash.
>> But it is not decide yet. if no exception, this patch will push to
>> mainline soon.
>>
>> Best Regards,
>> Josh Wu
>>
>>> If it helps, here is the boot log when I tried to boot using a 3.7-
>> rc8
>>> kernel and DT.
>>>
>>> Thanks,
>>> Bryan
>>>
>>> Uncompressing Linux... done, booting the kernel.
>>> [    0.000000] Booting Linux on physical CPU 0
>>> [    0.000000] Linux version 3.7.0-rc8-armv5-x0.16 (xxxx@xxxx) (gcc
>> versio
>>> n 4.6.2 20121016 (release) [ARM/embedded-4_6-branch revision 192487]
>>> (GNU Tools for ARM Embedded Processors) ) #1 Wed Dec 5 16:11:30 EST
>> 2012
>>> [    0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ),
>> cr=00053177
>>> [    0.000000] CPU: VIVT data cache, VIVT instruction cache
>>> [    0.000000] Machine: Atmel AT91SAM (Device Tree), model: Atmel
>> AT91SAM9G25-EK
>>> [    0.000000] Memory policy: ECC disabled, Data cache writeback
>>> [    0.000000] AT91: Detected soc type: at91sam9x5
>>> [    0.000000] AT91: Detected soc subtype: at91sam9g25
>>> [    0.000000] AT91: sram at 0x300000 of 0x8000 mapped at 0xfef70000
>>> [    0.000000] Clocks: CPU 400 MHz, master 133 MHz, main 12.000 MHz
>>> [    0.000000] Built 1 zonelists in Zone order, mobility grouping on.
>> Total pag
>>> es: 32512
>>> [    0.000000] Kernel command line: mem=128M console=ttyS0,115200
>> mtdparts=atmel
>>> _nand:8M(bootstrap/uboot/kernel)ro,-(rootfs) root=/dev/mtdblock1 rw
>>> rootfstype=u bifs ubi.mtd=1 root=ubi0:rootfs
>>> [    0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)
>>> [    0.000000] Dentry cache hash table entries: 16384 (order: 4,
>> 65536 bytes)
>>> [    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768
>> bytes)
>>> [    0.000000] Memory: 128MB = 128MB total
>>> [    0.000000] Memory: 124276k/124276k available, 6796k reserved, 0K
>> highmem
>>> [    0.000000] Virtual kernel memory layout:
>>> [    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
>>> [    0.000000]     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
>>> [    0.000000]     vmalloc : 0xc8800000 - 0xff000000   ( 872 MB)
>>> [    0.000000]     lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)
>>> [    0.000000]     modules : 0xbf000000 - 0xc0000000   (  16 MB)
>>> [    0.000000]       .text : 0xc0008000 - 0xc04b8630   (4802 kB)
>>> [    0.000000]       .init : 0xc04b9000 - 0xc04e45c4   ( 174 kB)
>>> [    0.000000]       .data : 0xc04e6000 - 0xc0516ce0   ( 196 kB)
>>> [    0.000000]        .bss : 0xc0516d04 - 0xc05760bc   ( 381 kB)
>>> [    0.000000] NR_IRQS:16 nr_irqs:16 16
>>> [    0.000000] sched_clock: 32 bits at 256 Hz, resolution 3906250ns,
>> wraps every
>>>    3892314108ms
>>> [    0.000000] Console: colour dummy device 80x30
>>> [    0.035156] Calibrating delay loop... 199.80 BogoMIPS (lpj=389120)
>>> [    0.035156] pid_max: default: 32768 minimum: 301
>>> [    0.035156] Mount-cache hash table entries: 512
>>> [    0.039062] CPU: Testing write buffer coherency: ok
>>> [    0.039062] Setting up static identity map for 0x20371d48 -
>> 0x20371da0
>>> [    0.039062] devtmpfs: initialized
>>> [    0.042968] NET: Registered protocol family 16
>>> [    0.042968] DMA: preallocated 256 KiB pool for atomic coherent
>> allocations
>>> [    0.070312] No ATAGs?
>>> [    0.070312] AT91: Power Management
>>> [    0.070312] AT91: Starting after power-restored wakeup
>>> [    0.121093] bio: create slab <bio-0> at 0
>>> [    0.125000] SCSI subsystem initialized
>>> [    0.128906] usbcore: registered new interface driver usbfs
>>> [    0.128906] usbcore: registered new interface driver hub
>>> [    0.128906] usbcore: registered new device driver usb
>>> [    0.132812] at91_i2c f8010000.i2c: AT91 i2c bus driver.
>>> [    0.132812] at91_i2c f8014000.i2c: AT91 i2c bus driver.
>>> [    0.136718] at91_i2c f8018000.i2c: AT91 i2c bus driver.
>>> [    0.140625] Switching to clocksource tcb_clksrc
>>> [    0.195312] NET: Registered protocol family 2
>>> [    0.199218] TCP established hash table entries: 4096 (order: 3,
>> 32768 bytes)
>>> [    0.199218] TCP bind hash table entries: 4096 (order: 2, 16384
>> bytes)
>>> [    0.199218] TCP: Hash tables configured (established 4096 bind
>> 4096)
>>> [    0.199218] TCP: reno registered
>>> [    0.199218] UDP hash table entries: 256 (order: 0, 4096 bytes)
>>> [    0.199218] UDP-Lite hash table entries: 256 (order: 0, 4096
>> bytes)
>>> [    0.199218] NET: Registered protocol family 1
>>> [    0.199218] RPC: Registered named UNIX socket transport module.
>>> [    0.199218] RPC: Registered udp transport module.
>>> [    0.199218] RPC: Registered tcp transport module.
>>> [    0.199218] RPC: Registered tcp NFSv4.1 backchannel transport
>> module.
>>> [    0.207031] NFS: Registering the id_resolver key type
>>> [    0.207031] Key type id_resolver registered
>>> [    0.207031] Key type id_legacy registered
>>> [    0.207031] jffs2: version 2.2. (NAND) �© 2001-2006 Red Hat,
>> Inc.
>>> [    0.207031] msgmni has been set to 242
>>> [    0.210937] io scheduler noop registered (default)
>>> [    0.218750] fffff200.serial: ttyS0 at MMIO 0xfffff200 (irq = 18)
>> is a ATMEL_S
>>> ERIAL
>>> [    0.609375] console [ttyS0] enabled
>>> [    0.613281] f801c000.serial: ttyS1 at MMIO 0xf801c000 (irq = 22)
>> is a ATMEL_S
>>> ERIAL
>>> [    0.632812] brd: module loaded
>>> [    0.652343] loop: module loaded
>>> [    0.667968] atmel_nand: Use On Flash BBT
>>> [    0.671875] atmel_nand 40000000.nand: No DMA support for NAND
>> access.
>>> [    0.675781] ONFI param page 0 valid
>>> [    0.679687] ONFI flash detected
>>> [    0.683593] NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda
>> (Micron MT29F2G
>>> 08AAD), page size: 2048, OOB size: 64
>>> [    0.695312] atmel_nand 40000000.nand: Initialize PMECC params,
>> cap: 2, sector
>>> : 512
>>> [    0.703125] Bad block table found at page 131008, version 0x01
>>> [    0.707031] Bad block table found at page 130944, version 0x01
>>> [    0.714843] nand_read_bbt: bad block at 0x000009380000
>>> [    0.718750] 2 cmdlinepart partitions found on MTD device
>> atmel_nand
>>> [    0.726562] Creating 2 MTD partitions on "atmel_nand":
>>> [    0.730468] 0x000000000000-0x000000800000 :
>> "bootstrap/uboot/kernel"
>>> [    0.742187] 0x000000800000-0x000010000000 : "rootfs"
>>> [    0.757812] macb f802c000.ethernet (unregistered net_device):
>> invalid hw addr
>>> ess, using random
>>> [    0.773437] libphy: MACB_mii_bus: probed
>>> [    0.777343] macb f802c000.ethernet eth0: Cadence MACB at
>> 0xf802c000 irq 23 (c
>>> a:2c:e6:c3:59:8f)
>>> [    0.785156] macb f802c000.ethernet eth0: attached PHY driver
>> [Davicom DM9161A
>>> ] (mii_bus:phy_addr=f802c000.etherne:00, irq=-1)
>>> [    0.796875] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI)
>> Driver
>>> [    0.804687] atmel-ehci 700000.ehci: Atmel EHCI UHP HS
>>> [    0.808593] atmel-ehci 700000.ehci: new USB bus registered,
>> assigned bus numb
>>> er 1
>>> [    0.816406] atmel-ehci 700000.ehci: irq 28, io mem 0x00700000
>>> [    0.835937] atmel-ehci 700000.ehci: USB 2.0 started, EHCI 1.00
>>> [    0.839843] usb usb1: New USB device found, idVendor=1d6b,
>> idProduct=0002
>>> [    0.847656] usb usb1: New USB device strings: Mfr=3, Product=2,
>> SerialNumber=
>>> 1
>>> [    0.855468] usb usb1: Product: Atmel EHCI UHP HS
>>> [    0.859375] usb usb1: Manufacturer: Linux 3.7.0-rc8-armv5-x0.16
>> ehci_hcd
>>> [    0.867187] usb usb1: SerialNumber: 700000.ehci
>>> [    0.871093] hub 1-0:1.0: USB hub found
>>> [    0.875000] hub 1-0:1.0: 3 ports detected
>>> [    0.878906] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
>>> [    0.886718] at91_ohci 600000.ohci: AT91 OHCI
>>> [    0.890625] at91_ohci 600000.ohci: new USB bus registered,
>> assigned bus numbe
>>> r 2
>>> [    0.898437] at91_ohci 600000.ohci: irq 28, io mem 0x00600000
>>> [    0.964843] usb usb2: New USB device found, idVendor=1d6b,
>> idProduct=0001
>>> [    0.968750] usb usb2: New USB device strings: Mfr=3, Product=2,
>> SerialNumber=
>>> 1
>>> [    0.976562] usb usb2: Product: AT91 OHCI
>>> [    0.980468] usb usb2: Manufacturer: Linux 3.7.0-rc8-armv5-x0.16
>> ohci_hcd
>>> [    0.988281] usb usb2: SerialNumber: at91
>>> [    0.992187] hub 2-0:1.0: USB hub found
>>> [    0.996093] hub 2-0:1.0: 2 ports detected
>>> [    1.003906] usbcore: registered new interface driver cdc_acm
>>> [    1.007812] cdc_acm: USB Abstract Control Model driver for USB
>> modems and ISD
>>> N adapters
>>> [    1.019531] usbcore: registered new interface driver uas
>>> [    1.023437] Initializing USB Mass Storage driver...
>>> [    1.027343] usbcore: registered new interface driver usb-storage
>>> [    1.035156] USB Mass Storage support registered.
>>> [    1.039062] usbcore: registered new interface driver ums-alauda
>>> [    1.046875] usbcore: registered new interface driver ums-cypress
>>> [    1.054687] usbcore: registered new interface driver ums-datafab
>>> [    1.058593] usbcore: registered new interface driver ums_eneub6250
>>> [    1.066406] usbcore: registered new interface driver ums-freecom
>>> [    1.074218] usbcore: registered new interface driver ums-isd200
>>> [    1.078125] usbcore: registered new interface driver ums-jumpshot
>>> [    1.085937] usbcore: registered new interface driver ums-karma
>>> [    1.093750] usbcore: registered new interface driver ums-onetouch
>>> [    1.097656] usbcore: registered new interface driver ums-realtek
>>> [    1.105468] usbcore: registered new interface driver ums-sddr09
>>> [    1.113281] usbcore: registered new interface driver ums-sddr55
>>> [    1.117187] usbcore: registered new interface driver ums-usbat
>>> [    1.125000] usbcore: registered new interface driver usbserial
>>> [    1.132812] usbcore: registered new interface driver
>> usbserial_generic
>>> [    1.140625] usbserial: USB Serial support registered for generic
>>> [    1.144531] usbcore: registered new interface driver ftdi_sio
>>> [    1.152343] usbserial: USB Serial support registered for FTDI USB
>> Serial Devi
>>> ce
>>> [    1.160156] usbcore: registered new interface driver pl2303
>>> [    1.167968] usbserial: USB Serial support registered for pl2303
>>> [    1.171875] mousedev: PS/2 mouse device common for all mice
>>> [    1.179687] i2c /dev entries driver
>>> [    1.191406] usbcore: registered new interface driver usbhid
>>> [    1.199218] usbhid: USB HID core driver
>>> [    1.207031] usb 1-2: new high-speed USB device number 2 using
>> atmel-ehci
>>> [    1.214843] TCP: cubic registered
>>> [    1.218750] NET: Registered protocol family 10
>>> [    1.222656] sit: IPv6 over IPv4 tunneling driver
>>> [    1.230468] NET: Registered protocol family 17
>>> [    1.234375] Key type dns_resolver registered
>>> [    1.246093] UBI: attaching mtd1 to ubi0
>>> [    1.253906] atmel_nand 40000000.nand: PMECC: Too many errors
>>> [    1.261718] UBI warning: ubi_io_read: error -5 while reading 64
>> bytes from PE
>>> B 10:0, read only 0 bytes, retry
>>> [    1.269531] atmel_nand 40000000.nand: PMECC: Too many errors
>>> [    1.277343] UBI warning: ubi_io_read: error -5 while reading 64
>> bytes from PE
>>> B 10:0, read only 0 bytes, retry
>>> [    1.285156] atmel_nand 40000000.nand: PMECC: Too many errors
>>> [    1.292968] UBI warning: ubi_io_read: error -5 while reading 64
>> bytes from PE
>>> B 10:0, read only 0 bytes, retry
>>> [    1.304687] atmel_nand 40000000.nand: PMECC: Too many errors
>>> [    1.308593] UBI error: ubi_io_read: error -5 while reading 64
>> bytes from PEB
>>> 10:0, read 0 bytes
>>> [    1.316406] [<c000d2bc>] (unwind_backtrace+0x0/0xe0) from
>> [<c0243a10>] (ubi_i
>>> o_read+0x1d4/0x2a4)
>>> [    1.328125] [<c0243a10>] (ubi_io_read+0x1d4/0x2a4) from
>> [<c0243d20>] (ubi_io_
>>> read_ec_hdr+0x68/0x214)
>>> [    1.335937] [<c0243d20>] (ubi_io_read_ec_hdr+0x68/0x214) from
>> [<c024804c>] (u
>>> bi_attach+0x104/0x13e4)
>>> [    1.343750] [<c024804c>] (ubi_attach+0x104/0x13e4) from
>> [<c023e514>] (ubi_att
>>> ach_mtd_dev+0x5a4/0xb94)
>>> [    1.355468] [<c023e514>] (ubi_attach_mtd_dev+0x5a4/0xb94) from
>> [<c04d09dc>] (
>>> ubi_init+0x1d8/0x2d8)
>>> [    1.363281] [<c04d09dc>] (ubi_init+0x1d8/0x2d8) from [<c0008860>]
>> (do_one_ini
>>> tcall+0x90/0x168)
>>> [    1.371093] [<c0008860>] (do_one_initcall+0x90/0x168) from
>> [<c03686a4>] (kern
>>> el_init+0xe8/0x2a0)
>>> [    1.378906] [<c03686a4>] (kernel_init+0xe8/0x2a0) from
>> [<c00093f0>] (ret_from
>>> _fork+0x14/0x24)
>>> [    1.386718] UBI error: ubi_attach_mtd_dev: failed to attach mtd1,
>> error -5
>>> [    1.394531] UBI error: ubi_init: cannot attach mtd1
>>> [    1.402343] drivers/rtc/hctosys.c: unable to open rtc device
>> (rtc0)
>>> [    1.410156] UBIFS error (pid 1): ubifs_mount: cannot open
>> "ubi0:rootfs", erro
>>> r -19
>>> [    1.417968] VFS: Cannot open root device "ubi0:rootfs" or unknown-
>> block(0,0):
>>>    error -19
>>> [    1.425781] Please append a correct "root=" boot option; here are
>> the availab
>>> le partitions:
>>> [    1.433593] 1f00            8192 mtdblock0  (driver?)
>>> [    1.437500] 1f01          253952 mtdblock1  (driver?)
>>> [    1.441406] Kernel panic - not syncing: VFS: Unable to mount root
>> fs on unkno
>>> wn-block(0,0)
>>>
>>>
Bryan Evenson - Dec. 11, 2012, 11:24 a.m.
Josh,

Thank you for the information.  Answers below.

Regards,
Bryan

> -----Original Message-----

> From: Josh Wu [mailto:josh.wu@atmel.com]

> Sent: Tuesday, December 11, 2012 3:46 AM

> To: Bryan Evenson

> Cc: linux-arm-kernel@lists.infradead.org

> Subject: Re: at91: Status of NAND flash access

>

> Hi, Bryan

>

> I tested your kernel & dtb (both 3.4 and 3.7-rc8) that you shared in

> dropbox. I can produce your situation. in my case the pmecc error

> offset is 0x86a000.

> the test steps is:

>     1. use a sd card boot at91bootstrap and u-boot to boot a

> at91sam9g25ek board.

>     2. use u-boot command to flush a ubi rootfs in 0x800000.

>     3. load your 3.4 kernel and dtb. it will boot ok.

>     4. load your 3.7-rc8 kernel and dtb. it will fail to boot. "too

> many errors" happens.

>

> But use the test step (not load 3.4 kernel & dtb):

>     1. use a sd card boot at91bootstrap and u-boot to boot a

> at91sam9g25ek board.

>     2. use u-boot command to flush a ubi rootfs in 0x800000.

>     3. load your 3.7-rc8 kernel and dtb. it will boot ok. (use my own

> 3.4 kernel & my dtb is also boot ok.)

>

> Since I don't write DTB in nand flash at all. so it is not caused by

> write dtb in nand flash.

>

> So I suspect your 3.4 kernel cause those problem.

> Check your kernel 3.4 boot log, I suspect that PMECC is not enabled in

> your 3.4 kernel. Since in the log, I don't find the line :  atmel_nand

> 40000000.nand: Initialize PMECC params, cap: 2, sector: 512

>

> After checking your 3.4 dtb. it shows below, and the PMECC parameters

> is set correctly.

>

> U-Boot> tftp 21000000 josh/kernel/dt/zImage-3.4-r7-at91sam9x5ek.dtb

> macb0: PHY present at 0

> macb0: Starting autonegotiation...

> macb0: Autonegotiation complete

> macb0: link up, 100Mbps full-duplex (lpa: 0x45e1) Using macb0 device

> TFTP from server 10.217.6.34; our IP address is 10.217.3.136 Filename

> 'josh/kernel/dt/zImage-3.4-r7-at91sam9x5ek.dtb'.

> Load address: 0x21000000

> Loading: *###

> done

> Bytes transferred = 12288 (3000 hex)

> U-Boot> fdt addr 21000000

> U-Boot> fdt print

> .......

>          nand@40000000 {

>              compatible = "atmel,at91rm9200-nand";

>              #address-cells = <0x1>;

>              #size-cells = <0x1>;

>              reg = <0x40000000 0x10000000 0xffffe000 0x600 0xffffe600

> 0x200 0x100000 0x100000>;

>              atmel,pmecc-lookup-table-offset = <0x8000 0x10000>;

>              atmel,nand-addr-offset = <0x15>;

>              atmel,nand-cmd-offset = <0x16>;

>              gpios = <0x2 0x5 0x0 0x2 0x4 0x0 0x0>;

>              status = "okay";

>              nand-bus-width = <0x8>;

>              nand-ecc-mode = "hw";

>              atmel,has-pmecc;

>              atmel,pmecc-cap = <0x2>;

>              atmel,pmecc-sector-size = <0x200>;

>              nand-on-flash-bbt;

> .......

>

> but in the log (my comment is in below):

>

> On 12/6/2012 9:20 PM, Bryan Evenson wrote:

> >> -----Original Message-----

> >> From: Josh Wu [mailto:josh.wu@atmel.com]

> >> Sent: Thursday, December 06, 2012 5:30 AM

> >> To: Bryan Evenson

> >> Cc: linux-arm-kernel@lists.infradead.org

> >> Subject: Re: at91: Status of NAND flash access

> >>

> >> On 12/6/2012 11:13 AM, Bryan Evenson wrote:

> >>> Josh,

> >>>

> >>> I spoke too soon.  I was able to read and use the filesystem from

> >> NAND

> >>> flash with the patch you provided when I applied it to the Atmel

> 3.4

> >>> kernel fork over at https://github.com/linux4sam/linux-at91/

> (master

> >> branch).

> >>> When I applied the same patch to the recent mainline kernel (3.7-

> >> rc8),

> >>> it's still having problems accessing flash.  The boot log shows

> that

> >>> it is setting up for PMECC correctly, but it has errors when it

> >>> tries to read from the filesystem.

> >> It is strange.  The 3.4 kernel from at91 github just have a few

> >> changes.

> >> so rationally it behavior the same at PMECC function. From your log,

> >> the

> >> 3.7-rc8 kernel says the PMECC found uncorrectable errors.

> >>

> >> Can you try to dump or read from the u-boot? to see whether u-boot

> >> can recognize the same nand page that "too many errors" happened in

> kernel?

> >> I will do some test to see whether the 3.7-rc8 can work in my side

> or

> >> not.

> > U-Boot> nand read 0x22000000 0x800000 0x1D00000

> >

> > NAND read: device 0 offset 0x800000, size 0x1d00000

> > PMECC: Too many errors

> > NAND read from offset 800000 failed -5

> >   0 bytes read: ERROR

> >

> > So u-boot has the same issue.  However, changing the kernel to the

> > linux-at91 forked kernel produced different results.  That kernel

> > noted the PMECC errors but was still able to load the filesystem.  My

> > boot output from the successful filesystem load is below.  Is the 3.4

> > kernel performing corrections that the mainline is not, or is it just

> ignoring errors that it should not be ignoring?

> >

> > I'm hesitant to make any filesystem changes on this board because I

> > know test cases like this where it works one way but not the other

> are

> > kind of rare.  Let me know if you have similar results on your end.

> >

> > -Bryan

> >

> > Uncompressing Linux... done, booting the kernel.

> > Booting Linux on physical CPU 0

> > Linux version 3.4.0 (xxxx@xxxx) (gcc version 4.5.3 20110311

> > (prerelease) (

> > GCC) ) #2 Wed Dec 5 15:36:29 EST 2012

> > CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177

> > CPU: VIVT data cache, VIVT instruction cache

> > Machine: Atmel AT91SAM (Device Tree), model: Atmel AT91SAM9G25-EK

> > Memory policy: ECC disabled, Data cache writeback

> > AT91: Detected soc type: at91sam9x5

> > AT91: Detected soc subtype: at91sam9g25

> > AT91: sram at 0x300000 of 0x8000 mapped at 0xfef70000

> > Clocks: CPU 400 MHz, master 133 MHz, main 12.000 MHz

> > gpiochip_add: registered GPIOs 0 to 31 on device: pioA

> > gpiochip_add: registered GPIOs 32 to 63 on device: pioB

> > gpiochip_add: registered GPIOs 64 to 95 on device: pioC

> > gpiochip_add: registered GPIOs 96 to 127 on device: pioD Built 1

> > zonelists in Zone order, mobility grouping on.  Total pages: 32512

> > Kernel command line: mem=128M console=ttyS0,115200

> > mtdparts=atmel_nand:8M(bootst

> > rap/uboot/kernel)ro,-(rootfs) root=/dev/mtdblock1 rw rootfstype=ubifs

> > ubi.mtd=1 root=ubi0:rootfs PID hash table entries: 512 (order: -1,

> > 2048 bytes) Dentry cache hash table entries: 16384 (order: 4, 65536

> > bytes) Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)

> > Memory: 128MB = 128MB total

> > Memory: 119856k/119856k available, 11216k reserved, 0K highmem

> Virtual

> > kernel memory layout:

> >      vector  : 0xffff0000 - 0xffff1000   (   4 kB)

> >      fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)

> >      vmalloc : 0xc8800000 - 0xff000000   ( 872 MB)

> >      lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)

> >      modules : 0xbf000000 - 0xc0000000   (  16 MB)

> >        .text : 0xc0008000 - 0xc04650d4   (4469 kB)

> >        .init : 0xc0466000 - 0xc048a000   ( 144 kB)

> >        .data : 0xc048a000 - 0xc04c4420   ( 234 kB)

> >         .bss : 0xc04c4444 - 0xc09c66e4   (5129 kB)

> > NR_IRQS:192

> > sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every

> > 4294967286ms

> > Console: colour dummy device 80x30

> > Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo

> > Molnar ... MAX_LOCKDEP_SUBCLASSES:  8

> > ... MAX_LOCK_DEPTH:          48

> > ... MAX_LOCKDEP_KEYS:        8191

> > ... CLASSHASH_SIZE:          4096

> > ... MAX_LOCKDEP_ENTRIES:     16384

> > ... MAX_LOCKDEP_CHAINS:      32768

> > ... CHAINHASH_SIZE:          16384

> >   memory used by lock dependency info: 3695 kB

> >   per task-struct memory footprint: 1152 bytes

> > ------------------------

> > | Locking API testsuite:

> > ---------------------------------------------------------------------

> -------

> >                                   | spin |wlock |rlock |mutex | wsem

> | rsem |

> >    ------------------------------------------------------------------

> --------

> >                       A-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >                   A-B-B-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >               A-B-B-C-C-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >               A-B-C-A-B-C deadlock:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >           A-B-B-C-C-D-D-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >           A-B-C-D-B-D-D-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >           A-B-C-D-B-C-D-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >                      double unlock:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >                    initialize held:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >                   bad unlock order:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >    ------------------------------------------------------------------

> --------

> >                recursive read-lock:             |  ok  |

> |  ok  |

> >             recursive read-lock #2:             |  ok  |

> |  ok  |

> >              mixed read-write-lock:             |  ok  |

> |  ok  |

> >              mixed write-read-lock:             |  ok  |

> |  ok  |

> >    ------------------------------------------------------------------

> --------

> >       hard-irqs-on + irq-safe-A/12:  ok  |  ok  |  ok  |

> >       soft-irqs-on + irq-safe-A/12:  ok  |  ok  |  ok  |

> >       hard-irqs-on + irq-safe-A/21:  ok  |  ok  |  ok  |

> >       soft-irqs-on + irq-safe-A/21:  ok  |  ok  |  ok  |

> >         sirq-safe-A => hirqs-on/12:  ok  |  ok  |  ok  |

> >         sirq-safe-A => hirqs-on/21:  ok  |  ok  |  ok  |

> >           hard-safe-A + irqs-on/12:  ok  |  ok  |  ok  |

> >           soft-safe-A + irqs-on/12:  ok  |  ok  |  ok  |

> >           hard-safe-A + irqs-on/21:  ok  |  ok  |  ok  |

> >           soft-safe-A + irqs-on/21:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #1/123:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #1/123:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #1/132:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #1/132:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #1/213:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #1/213:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #1/231:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #1/231:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #1/312:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #1/312:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #1/321:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #1/321:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #2/123:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #2/123:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #2/132:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #2/132:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #2/213:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #2/213:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #2/231:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #2/231:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #2/312:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #2/312:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #2/321:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #2/321:  ok  |  ok  |  ok  |

> >        hard-irq lock-inversion/123:  ok  |  ok  |  ok  |

> >        soft-irq lock-inversion/123:  ok  |  ok  |  ok  |

> >        hard-irq lock-inversion/132:  ok  |  ok  |  ok  |

> >        soft-irq lock-inversion/132:  ok  |  ok  |  ok  |

> >        hard-irq lock-inversion/213:  ok  |  ok  |  ok  |

> >        soft-irq lock-inversion/213:  ok  |  ok  |  ok  |

> >        hard-irq lock-inversion/231:  ok  |  ok  |  ok  |

> >        soft-irq lock-inversion/231:  ok  |  ok  |  ok  |

> >        hard-irq lock-inversion/312:  ok  |  ok  |  ok  |

> >        soft-irq lock-inversion/312:  ok  |  ok  |  ok  |

> >        hard-irq lock-inversion/321:  ok  |  ok  |  ok  |

> >        soft-irq lock-inversion/321:  ok  |  ok  |  ok  |

> >        hard-irq read-recursion/123:  ok  |

> >        soft-irq read-recursion/123:  ok  |

> >        hard-irq read-recursion/132:  ok  |

> >        soft-irq read-recursion/132:  ok  |

> >        hard-irq read-recursion/213:  ok  |

> >        soft-irq read-recursion/213:  ok  |

> >        hard-irq read-recursion/231:  ok  |

> >        soft-irq read-recursion/231:  ok  |

> >        hard-irq read-recursion/312:  ok  |

> >        soft-irq read-recursion/312:  ok  |

> >        hard-irq read-recursion/321:  ok  |

> >        soft-irq read-recursion/321:  ok  |

> > -------------------------------------------------------

> > Good, all 218 testcases passed! |

> > ---------------------------------

> > Calibrating delay loop... 198.04 BogoMIPS (lpj=990208)

> > pid_max: default: 32768 minimum: 301

> > Mount-cache hash table entries: 512

> > CPU: Testing write buffer coherency: ok Setting up static identity

> map

> > for 0x2033ced8 - 0x2033cf30

> > devtmpfs: initialized

> > dummy:

> > NET: Registered protocol family 16

> > AT91: Power Management (with slow clock mode)

> > AT91: Starting after power-restored wakeup

> > bio: create slab <bio-0> at 0

> > at_hdmac ffffec00.dma-controller: Atmel AHB DMA Controller ( cpy

> slave

> > ), 8 chan nels at_hdmac ffffee00.dma-controller: Atmel AHB DMA

> > Controller ( cpy slave ), 8 chan nels SCSI subsystem initialized

> > usbcore: registered new interface driver usbfs

> > usbcore: registered new interface driver hub

> > usbcore: registered new device driver usb

> > cfg80211: Calling CRDA to update world regulatory domain Switching to

> > clocksource tcb_clksrc

> > NET: Registered protocol family 2

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

> > established hash table entries: 4096 (order: 3, 32768 bytes) TCP bind

> > hash table entries: 4096 (order: 5, 147456 bytes)

> > TCP: Hash tables configured (established 4096 bind 4096)

> > TCP: reno registered

> > UDP hash table entries: 64 (order: 0, 5120 bytes) UDP-Lite hash table

> > entries: 64 (order: 0, 5120 bytes)

> > NET: Registered protocol family 1

> > RPC: Registered named UNIX socket transport module.

> > RPC: Registered udp transport module.

> > RPC: Registered tcp transport module.

> > RPC: Registered tcp NFSv4.1 backchannel transport module.

> > NFS: Registering the id_resolver key type

> > jffs2: version 2.2. (NAND) (SUMMARY)   © 2001-2006 Red Hat, Inc.

> > msgmni has been set to 234

> > Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)

> > io scheduler noop registered (default)

> > fffff200.serial: ttyS0 at MMIO 0xfffff200 (irq = 1) is a ATMEL_SERIAL

> > console [ttyS0] enabled

> > f801c000.serial: ttyS1 at MMIO 0xf801c000 (irq = 5) is a ATMEL_SERIAL

> > f8020000.serial: ttyS2 at MMIO 0xf8020000 (irq = 6) is a ATMEL_SERIAL

> > f8028000.serial: ttyS4 at MMIO 0xf8028000 (irq = 8) is a ATMEL_SERIAL

> > brd: module loaded

> > loop: module loaded

> > mtdoops: mtd device (mtddev=name/number) must be supplied

> > atmel_nand: Use On Flash BBT

> > atmel_nand 40000000.nand: No DMA support for NAND access.

> > ONFI param page 0 valid

> > ONFI flash detected

> > NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda (Micron

> > MT29F2G08AAD)

>

> Here, when PMECC is really enabled, the driver should show following

> message:

>     atmel_nand 40000000.nand: Initialize PMECC params, cap: 2, sector:

> 512

>

> But your 3.4's log doesn't have it. If the dtb is right then maybe the

> issue is caused in the driver?

>

> Can you check your 3.4 kernel code, make sure the function

> atmel_pmecc_nand_init_params() is called or not?

>


I did a grep of my 3.4 kernel code and the function
'atmel_pmecc_nand_init_params' does not exist in my 3.4 kernel code.
I also did a grep of 'atmel.*pmecc' and only found
matches in the device tree files and not in the nand driver.

The archive that I was pulling for my 3.4 kernel was:
https://github.com/linux4sam/linux-at91/archive/master.tar.gz
Did the master branch not have all the updated drivers in place from
the other branches under linux-at91?

> Best Regards,

> Josh Wu

>

> > Bad block table found at page 131008, version 0x01 Bad block table

> > found at page 130944, version 0x01

> > nand_read_bbt: bad block at 0x000009380000

> > 2 cmdlinepart partitions found on MTD device atmel_nand Creating 2

> MTD

> > partitions on "atmel_nand":

> > 0x000000000000-0x000000800000 : "bootstrap/uboot/kernel"

> > 0x000000800000-0x000010000000 : "rootfs"

> > UBI: attaching mtd1 to ubi0

> > UBI: physical eraseblock size:   131072 bytes (128 KiB)

> > UBI: logical eraseblock size:    126976 bytes

> > UBI: smallest flash I/O unit:    2048

> > UBI: VID header offset:          2048 (aligned 2048)

> > UBI: data offset:                4096

> > UBI: max. sequence number:       4249

> > UBI warning: print_rsvd_warning: cannot reserve enough PEBs for bad

> > PEB handling , reserved 15, need 19

> > UBI: attached mtd1 to ubi0

> > UBI: MTD device name:            "rootfs"

> > UBI: MTD device size:            248 MiB

> > UBI: number of good PEBs:        1979

> > UBI: number of bad PEBs:         5

> > UBI: number of corrupted PEBs:   0

> > UBI: max. allowed volumes:       128

> > UBI: wear-leveling threshold:    4096

> > UBI: number of internal volumes: 1

> > UBI: number of user volumes:     1

> > UBI: available PEBs:             0

> > UBI: total number of reserved PEBs: 1979

> > UBI: number of PEBs reserved for bad PEB handling: 15

> > UBI: max/mean erase counter: 5/2

> > UBI: image sequence number:  191777507

> > UBI: background thread "ubi_bgt0d" started, PID 31 UBI error:

> > ubi_init: cannot attach mtd1

> > tun: Universal TUN/TAP device driver, 1.6

> > tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com> macb

> > f802c000.ethernet: (unregistered net_device): invalid hw address,

> > using ran dom

> > MACB_mii_bus: probed

> > macb f802c000.ethernet: eth0: Cadence MACB at 0xf802c000 irq 24

> (4a:15:f4:49:94:

> > a4)

> > macb f802c000.ethernet: eth0: attached PHY driver [Davicom DM9161A]

> > (mii_bus:phy _addr=f802c000.etherne:00, irq=-1) PPP generic driver

> > version 2.4.2

> > NET: Registered protocol family 24

> > usbcore: registered new interface driver asix

> > usbcore: registered new interface driver cdc_ether

> > usbcore: registered new interface driver cdc_eem

> > usbcore: registered new interface driver net1080

> > usbcore: registered new interface driver cdc_subset

> > usbcore: registered new interface driver zaurus

> > usbcore: registered new interface driver ipheth

> > usbcore: registered new interface driver cdc_ncm

> > ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver atmel-ehci

> > 700000.ehci: Atmel EHCI UHP HS atmel-ehci 700000.ehci: new USB bus

> > registered, assigned bus number 1 atmel-ehci 700000.ehci: irq 22, io

> > mem 0x00700000 atmel-ehci 700000.ehci: USB 2.0 started, EHCI 1.00 usb

> > usb1: New USB device found, idVendor=1d6b, idProduct=0002 usb usb1:

> > New USB device strings: Mfr=3, Product=2, SerialNumber=1 usb usb1:

> > Product: Atmel EHCI UHP HS usb usb1: Manufacturer: Linux 3.4.0

> > ehci_hcd usb usb1: SerialNumber: 700000.ehci hub 1-0:1.0: USB hub

> > found hub 1-0:1.0: 3 ports detected

> > ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver at91_ohci

> > 600000.ohci: AT91 OHCI at91_ohci 600000.ohci: new USB bus registered,

> > assigned bus number 2 at91_ohci 600000.ohci: irq 22, io mem

> 0x00600000

> > usb usb2: New USB device found, idVendor=1d6b, idProduct=0001 usb

> > usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1 usb

> > usb2: Product: AT91 OHCI usb usb2: Manufacturer: Linux 3.4.0 ohci_hcd

> > usb usb2: SerialNumber: at91 hub 2-0:1.0: USB hub found hub 2-0:1.0:

> 2

> > ports detected

> > usbcore: registered new interface driver cdc_acm

> > cdc_acm: USB Abstract Control Model driver for USB modems and ISDN

> > adapters Initializing USB Mass Storage driver...

> > usbcore: registered new interface driver usb-storage USB Mass Storage

> > support registered.

> > usbcore: registered new interface driver libusual

> > usbcore: registered new interface driver usbserial

> > usbcore: registered new interface driver usbserial_generic USB Serial

> > support registered for generic

> > usbserial: USB Serial Driver core

> > usbcore: registered new interface driver moto-modem USB Serial

> support

> > registered for moto-modem

> > usbcore: registered new interface driver opticon USB Serial support

> > registered for opticon

> > usbcore: registered new interface driver pl2303 USB Serial support

> > registered for pl2303

> > usbcore: registered new interface driver qcserial USB Serial support

> > registered for Qualcomm USB modem

> > usbcore: registered new interface driver symbol USB Serial support

> > registered for symbol i2c /dev entries driver

> > usbcore: registered new interface driver usbhid

> > usbhid: USB HID core driver

> > nf_conntrack version 0.5.0 (1872 buckets, 7488 max)

> > IPv4 over IPv4 tunneling driver

> > ip_tables: (C) 2000-2006 Netfilter Core Team

> > TCP: cubic registered

> > NET: Registered protocol family 17

> > lib80211: common routines for IEEE802.11 drivers Registering the

> > dns_resolver key type

> > drivers/rtc/hctosys.c: unable to open rtc device (rtc0)

> > UBIFS: recovery needed

> > UBIFS: recovery completed

> > UBIFS: mounted UBI device 0, volume 0, name "rootfs"

> > UBIFS: file system size:   247476224 bytes (241676 KiB, 236 MiB, 1949

> LEBs)

> > UBIFS: journal size:       9023488 bytes (8812 KiB, 8 MiB, 72 LEBs)

> > UBIFS: media format:       w4/r0 (latest is w4/r0)

> > UBIFS: default compressor: lzo

> > UBIFS: reserved for root:  0 bytes (0 KiB)

> > VFS: Mounted root (ubifs filesystem) on device 0:11.

> > devtmpfs: mounted

> > Freeing init memory: 144K

> > INIT: version 2.86 booting

> > Please wait: booting...

> > Starting udev

> > udev[62]: starting version 165

> > Root filesystem already rw, not remounting Caching udev devnodes

> > Populating dev cache

> > logger: mount: mount point /proc/bus/usb does not exist

> > ALSA: Restoring mixer settings...

> > /usr/sbin/alsactl: load_state:1625: No soundcards found...

> > Configuring network interfaces... eth0      no wireless extensions.

> >

> > udhcpc (v1.18.3) started

> > run-parts: /etc/udhcpc.d/00avahi-autoipd exited with code 1 Sending

> > discover...

> > Sending discover...

> > Sending discover...

> > netlink: 12 bytes leftover after parsing attributes.

> > netlink: 12 bytes leftover after parsing attributes.

> > netlink: 12 bytes leftover after parsing attributes.

> > No lease, failing

> > done.

> > Starting portmap daemon: portmap.

> > net.ipv4.conf.default.rp_filter = 1

> > net.ipv4.conf.all.rp_filter = 1

> > kernel.panic = 10

> > hwclock: can't open '/dev/misc/rtc': No such file or directory Mon

> Nov

> > 5 09:47:00 EST 2012

> > hwclock: can't open '/dev/misc/rtc': No such file or directory

> > INIT: Entering runlevel: 5

> > Starting system message bus: dbus.

> > Starting Dropbear SSH server: dropbear.

> > starting Busybox HTTP Daemon: httpd... done.

> > Starting Vixie-cron.

> > Starting ntpd: done

> > Starting syslogd/klogd: done

> >   * Starting Avahi mDNS/DNS-SD Daemon: avahi-daemon

> >     ...done.

> >

> >>> I noticed over at the linux-at91 fork that you had applied the

> PMECC

> >>> support on the 3.4.x_pmecc_dt_9x5 branch a few months ago.  From

> >>> browsing the mainline I didn't see some of your changes from that

> >>> branch in the mainline.  Are there some changes from the linux-at91

> >> fork that are still scheduled for mainlining?

> >> yes, this patch is not push to mainline yet. Currently the only

> >> concern is we are think about the PMECC error correct bits need to

> >> adjust by ONFI parameters that read from nand flash.

> >> But it is not decide yet. if no exception, this patch will push to

> >> mainline soon.

> >>

> >> Best Regards,

> >> Josh Wu

> >>

> >>> If it helps, here is the boot log when I tried to boot using a 3.7-

> >> rc8

> >>> kernel and DT.

> >>>

> >>> Thanks,

> >>> Bryan

> >>>

> >>> Uncompressing Linux... done, booting the kernel.

> >>> [    0.000000] Booting Linux on physical CPU 0

> >>> [    0.000000] Linux version 3.7.0-rc8-armv5-x0.16 (xxxx@xxxx) (gcc

> >> versio

> >>> n 4.6.2 20121016 (release) [ARM/embedded-4_6-branch revision

> 192487]

> >>> (GNU Tools for ARM Embedded Processors) ) #1 Wed Dec 5 16:11:30 EST

> >> 2012

> >>> [    0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ),

> >> cr=00053177

> >>> [    0.000000] CPU: VIVT data cache, VIVT instruction cache

> >>> [    0.000000] Machine: Atmel AT91SAM (Device Tree), model: Atmel

> >> AT91SAM9G25-EK

> >>> [    0.000000] Memory policy: ECC disabled, Data cache writeback

> >>> [    0.000000] AT91: Detected soc type: at91sam9x5

> >>> [    0.000000] AT91: Detected soc subtype: at91sam9g25

> >>> [    0.000000] AT91: sram at 0x300000 of 0x8000 mapped at

> 0xfef70000

> >>> [    0.000000] Clocks: CPU 400 MHz, master 133 MHz, main 12.000 MHz

> >>> [    0.000000] Built 1 zonelists in Zone order, mobility grouping

> on.

> >> Total pag

> >>> es: 32512

> >>> [    0.000000] Kernel command line: mem=128M console=ttyS0,115200

> >> mtdparts=atmel

> >>> _nand:8M(bootstrap/uboot/kernel)ro,-(rootfs) root=/dev/mtdblock1 rw

> >>> rootfstype=u bifs ubi.mtd=1 root=ubi0:rootfs

> >>> [    0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)

> >>> [    0.000000] Dentry cache hash table entries: 16384 (order: 4,

> >> 65536 bytes)

> >>> [    0.000000] Inode-cache hash table entries: 8192 (order: 3,

> 32768

> >> bytes)

> >>> [    0.000000] Memory: 128MB = 128MB total

> >>> [    0.000000] Memory: 124276k/124276k available, 6796k reserved,

> 0K

> >> highmem

> >>> [    0.000000] Virtual kernel memory layout:

> >>> [    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)

> >>> [    0.000000]     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)

> >>> [    0.000000]     vmalloc : 0xc8800000 - 0xff000000   ( 872 MB)

> >>> [    0.000000]     lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)

> >>> [    0.000000]     modules : 0xbf000000 - 0xc0000000   (  16 MB)

> >>> [    0.000000]       .text : 0xc0008000 - 0xc04b8630   (4802 kB)

> >>> [    0.000000]       .init : 0xc04b9000 - 0xc04e45c4   ( 174 kB)

> >>> [    0.000000]       .data : 0xc04e6000 - 0xc0516ce0   ( 196 kB)

> >>> [    0.000000]        .bss : 0xc0516d04 - 0xc05760bc   ( 381 kB)

> >>> [    0.000000] NR_IRQS:16 nr_irqs:16 16

> >>> [    0.000000] sched_clock: 32 bits at 256 Hz, resolution

> 3906250ns,

> >> wraps every

> >>>    3892314108ms

> >>> [    0.000000] Console: colour dummy device 80x30

> >>> [    0.035156] Calibrating delay loop... 199.80 BogoMIPS

> (lpj=389120)

> >>> [    0.035156] pid_max: default: 32768 minimum: 301

> >>> [    0.035156] Mount-cache hash table entries: 512

> >>> [    0.039062] CPU: Testing write buffer coherency: ok

> >>> [    0.039062] Setting up static identity map for 0x20371d48 -

> >> 0x20371da0

> >>> [    0.039062] devtmpfs: initialized

> >>> [    0.042968] NET: Registered protocol family 16

> >>> [    0.042968] DMA: preallocated 256 KiB pool for atomic coherent

> >> allocations

> >>> [    0.070312] No ATAGs?

> >>> [    0.070312] AT91: Power Management

> >>> [    0.070312] AT91: Starting after power-restored wakeup

> >>> [    0.121093] bio: create slab <bio-0> at 0

> >>> [    0.125000] SCSI subsystem initialized

> >>> [    0.128906] usbcore: registered new interface driver usbfs

> >>> [    0.128906] usbcore: registered new interface driver hub

> >>> [    0.128906] usbcore: registered new device driver usb

> >>> [    0.132812] at91_i2c f8010000.i2c: AT91 i2c bus driver.

> >>> [    0.132812] at91_i2c f8014000.i2c: AT91 i2c bus driver.

> >>> [    0.136718] at91_i2c f8018000.i2c: AT91 i2c bus driver.

> >>> [    0.140625] Switching to clocksource tcb_clksrc

> >>> [    0.195312] NET: Registered protocol family 2

> >>> [    0.199218] TCP established hash table entries: 4096 (order: 3,

> >> 32768 bytes)

> >>> [    0.199218] TCP bind hash table entries: 4096 (order: 2, 16384

> >> bytes)

> >>> [    0.199218] TCP: Hash tables configured (established 4096 bind

> >> 4096)

> >>> [    0.199218] TCP: reno registered

> >>> [    0.199218] UDP hash table entries: 256 (order: 0, 4096 bytes)

> >>> [    0.199218] UDP-Lite hash table entries: 256 (order: 0, 4096

> >> bytes)

> >>> [    0.199218] NET: Registered protocol family 1

> >>> [    0.199218] RPC: Registered named UNIX socket transport module.

> >>> [    0.199218] RPC: Registered udp transport module.

> >>> [    0.199218] RPC: Registered tcp transport module.

> >>> [    0.199218] RPC: Registered tcp NFSv4.1 backchannel transport

> >> module.

> >>> [    0.207031] NFS: Registering the id_resolver key type

> >>> [    0.207031] Key type id_resolver registered

> >>> [    0.207031] Key type id_legacy registered

> >>> [    0.207031] jffs2: version 2.2. (NAND) �© 2001-2006 Red Hat,

> >> Inc.

> >>> [    0.207031] msgmni has been set to 242

> >>> [    0.210937] io scheduler noop registered (default)

> >>> [    0.218750] fffff200.serial: ttyS0 at MMIO 0xfffff200 (irq = 18)

> >> is a ATMEL_S

> >>> ERIAL

> >>> [    0.609375] console [ttyS0] enabled

> >>> [    0.613281] f801c000.serial: ttyS1 at MMIO 0xf801c000 (irq = 22)

> >> is a ATMEL_S

> >>> ERIAL

> >>> [    0.632812] brd: module loaded

> >>> [    0.652343] loop: module loaded

> >>> [    0.667968] atmel_nand: Use On Flash BBT

> >>> [    0.671875] atmel_nand 40000000.nand: No DMA support for NAND

> >> access.

> >>> [    0.675781] ONFI param page 0 valid

> >>> [    0.679687] ONFI flash detected

> >>> [    0.683593] NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda

> >> (Micron MT29F2G

> >>> 08AAD), page size: 2048, OOB size: 64

> >>> [    0.695312] atmel_nand 40000000.nand: Initialize PMECC params,

> >> cap: 2, sector

> >>> : 512

> >>> [    0.703125] Bad block table found at page 131008, version 0x01

> >>> [    0.707031] Bad block table found at page 130944, version 0x01

> >>> [    0.714843] nand_read_bbt: bad block at 0x000009380000

> >>> [    0.718750] 2 cmdlinepart partitions found on MTD device

> >> atmel_nand

> >>> [    0.726562] Creating 2 MTD partitions on "atmel_nand":

> >>> [    0.730468] 0x000000000000-0x000000800000 :

> >> "bootstrap/uboot/kernel"

> >>> [    0.742187] 0x000000800000-0x000010000000 : "rootfs"

> >>> [    0.757812] macb f802c000.ethernet (unregistered net_device):

> >> invalid hw addr

> >>> ess, using random

> >>> [    0.773437] libphy: MACB_mii_bus: probed

> >>> [    0.777343] macb f802c000.ethernet eth0: Cadence MACB at

> >> 0xf802c000 irq 23 (c

> >>> a:2c:e6:c3:59:8f)

> >>> [    0.785156] macb f802c000.ethernet eth0: attached PHY driver

> >> [Davicom DM9161A

> >>> ] (mii_bus:phy_addr=f802c000.etherne:00, irq=-1)

> >>> [    0.796875] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI)

> >> Driver

> >>> [    0.804687] atmel-ehci 700000.ehci: Atmel EHCI UHP HS

> >>> [    0.808593] atmel-ehci 700000.ehci: new USB bus registered,

> >> assigned bus numb

> >>> er 1

> >>> [    0.816406] atmel-ehci 700000.ehci: irq 28, io mem 0x00700000

> >>> [    0.835937] atmel-ehci 700000.ehci: USB 2.0 started, EHCI 1.00

> >>> [    0.839843] usb usb1: New USB device found, idVendor=1d6b,

> >> idProduct=0002

> >>> [    0.847656] usb usb1: New USB device strings: Mfr=3, Product=2,

> >> SerialNumber=

> >>> 1

> >>> [    0.855468] usb usb1: Product: Atmel EHCI UHP HS

> >>> [    0.859375] usb usb1: Manufacturer: Linux 3.7.0-rc8-armv5-x0.16

> >> ehci_hcd

> >>> [    0.867187] usb usb1: SerialNumber: 700000.ehci

> >>> [    0.871093] hub 1-0:1.0: USB hub found

> >>> [    0.875000] hub 1-0:1.0: 3 ports detected

> >>> [    0.878906] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI)

> Driver

> >>> [    0.886718] at91_ohci 600000.ohci: AT91 OHCI

> >>> [    0.890625] at91_ohci 600000.ohci: new USB bus registered,

> >> assigned bus numbe

> >>> r 2

> >>> [    0.898437] at91_ohci 600000.ohci: irq 28, io mem 0x00600000

> >>> [    0.964843] usb usb2: New USB device found, idVendor=1d6b,

> >> idProduct=0001

> >>> [    0.968750] usb usb2: New USB device strings: Mfr=3, Product=2,

> >> SerialNumber=

> >>> 1

> >>> [    0.976562] usb usb2: Product: AT91 OHCI

> >>> [    0.980468] usb usb2: Manufacturer: Linux 3.7.0-rc8-armv5-x0.16

> >> ohci_hcd

> >>> [    0.988281] usb usb2: SerialNumber: at91

> >>> [    0.992187] hub 2-0:1.0: USB hub found

> >>> [    0.996093] hub 2-0:1.0: 2 ports detected

> >>> [    1.003906] usbcore: registered new interface driver cdc_acm

> >>> [    1.007812] cdc_acm: USB Abstract Control Model driver for USB

> >> modems and ISD

> >>> N adapters

> >>> [    1.019531] usbcore: registered new interface driver uas

> >>> [    1.023437] Initializing USB Mass Storage driver...

> >>> [    1.027343] usbcore: registered new interface driver usb-storage

> >>> [    1.035156] USB Mass Storage support registered.

> >>> [    1.039062] usbcore: registered new interface driver ums-alauda

> >>> [    1.046875] usbcore: registered new interface driver ums-cypress

> >>> [    1.054687] usbcore: registered new interface driver ums-datafab

> >>> [    1.058593] usbcore: registered new interface driver

> ums_eneub6250

> >>> [    1.066406] usbcore: registered new interface driver ums-freecom

> >>> [    1.074218] usbcore: registered new interface driver ums-isd200

> >>> [    1.078125] usbcore: registered new interface driver ums-

> jumpshot

> >>> [    1.085937] usbcore: registered new interface driver ums-karma

> >>> [    1.093750] usbcore: registered new interface driver ums-

> onetouch

> >>> [    1.097656] usbcore: registered new interface driver ums-realtek

> >>> [    1.105468] usbcore: registered new interface driver ums-sddr09

> >>> [    1.113281] usbcore: registered new interface driver ums-sddr55

> >>> [    1.117187] usbcore: registered new interface driver ums-usbat

> >>> [    1.125000] usbcore: registered new interface driver usbserial

> >>> [    1.132812] usbcore: registered new interface driver

> >> usbserial_generic

> >>> [    1.140625] usbserial: USB Serial support registered for generic

> >>> [    1.144531] usbcore: registered new interface driver ftdi_sio

> >>> [    1.152343] usbserial: USB Serial support registered for FTDI

> USB

> >> Serial Devi

> >>> ce

> >>> [    1.160156] usbcore: registered new interface driver pl2303

> >>> [    1.167968] usbserial: USB Serial support registered for pl2303

> >>> [    1.171875] mousedev: PS/2 mouse device common for all mice

> >>> [    1.179687] i2c /dev entries driver

> >>> [    1.191406] usbcore: registered new interface driver usbhid

> >>> [    1.199218] usbhid: USB HID core driver

> >>> [    1.207031] usb 1-2: new high-speed USB device number 2 using

> >> atmel-ehci

> >>> [    1.214843] TCP: cubic registered

> >>> [    1.218750] NET: Registered protocol family 10

> >>> [    1.222656] sit: IPv6 over IPv4 tunneling driver

> >>> [    1.230468] NET: Registered protocol family 17

> >>> [    1.234375] Key type dns_resolver registered

> >>> [    1.246093] UBI: attaching mtd1 to ubi0

> >>> [    1.253906] atmel_nand 40000000.nand: PMECC: Too many errors

> >>> [    1.261718] UBI warning: ubi_io_read: error -5 while reading 64

> >> bytes from PE

> >>> B 10:0, read only 0 bytes, retry

> >>> [    1.269531] atmel_nand 40000000.nand: PMECC: Too many errors

> >>> [    1.277343] UBI warning: ubi_io_read: error -5 while reading 64

> >> bytes from PE

> >>> B 10:0, read only 0 bytes, retry

> >>> [    1.285156] atmel_nand 40000000.nand: PMECC: Too many errors

> >>> [    1.292968] UBI warning: ubi_io_read: error -5 while reading 64

> >> bytes from PE

> >>> B 10:0, read only 0 bytes, retry

> >>> [    1.304687] atmel_nand 40000000.nand: PMECC: Too many errors

> >>> [    1.308593] UBI error: ubi_io_read: error -5 while reading 64

> >> bytes from PEB

> >>> 10:0, read 0 bytes

> >>> [    1.316406] [<c000d2bc>] (unwind_backtrace+0x0/0xe0) from

> >> [<c0243a10>] (ubi_i

> >>> o_read+0x1d4/0x2a4)

> >>> [    1.328125] [<c0243a10>] (ubi_io_read+0x1d4/0x2a4) from

> >> [<c0243d20>] (ubi_io_

> >>> read_ec_hdr+0x68/0x214)

> >>> [    1.335937] [<c0243d20>] (ubi_io_read_ec_hdr+0x68/0x214) from

> >> [<c024804c>] (u

> >>> bi_attach+0x104/0x13e4)

> >>> [    1.343750] [<c024804c>] (ubi_attach+0x104/0x13e4) from

> >> [<c023e514>] (ubi_att

> >>> ach_mtd_dev+0x5a4/0xb94)

> >>> [    1.355468] [<c023e514>] (ubi_attach_mtd_dev+0x5a4/0xb94) from

> >> [<c04d09dc>] (

> >>> ubi_init+0x1d8/0x2d8)

> >>> [    1.363281] [<c04d09dc>] (ubi_init+0x1d8/0x2d8) from

> [<c0008860>]

> >> (do_one_ini

> >>> tcall+0x90/0x168)

> >>> [    1.371093] [<c0008860>] (do_one_initcall+0x90/0x168) from

> >> [<c03686a4>] (kern

> >>> el_init+0xe8/0x2a0)

> >>> [    1.378906] [<c03686a4>] (kernel_init+0xe8/0x2a0) from

> >> [<c00093f0>] (ret_from

> >>> _fork+0x14/0x24)

> >>> [    1.386718] UBI error: ubi_attach_mtd_dev: failed to attach

> mtd1,

> >> error -5

> >>> [    1.394531] UBI error: ubi_init: cannot attach mtd1

> >>> [    1.402343] drivers/rtc/hctosys.c: unable to open rtc device

> >> (rtc0)

> >>> [    1.410156] UBIFS error (pid 1): ubifs_mount: cannot open

> >> "ubi0:rootfs", erro

> >>> r -19

> >>> [    1.417968] VFS: Cannot open root device "ubi0:rootfs" or

> unknown-

> >> block(0,0):

> >>>    error -19

> >>> [    1.425781] Please append a correct "root=" boot option; here

> are

> >> the availab

> >>> le partitions:

> >>> [    1.433593] 1f00            8192 mtdblock0  (driver?)

> >>> [    1.437500] 1f01          253952 mtdblock1  (driver?)

> >>> [    1.441406] Kernel panic - not syncing: VFS: Unable to mount

> root

> >> fs on unkno

> >>> wn-block(0,0)

> >>>

> >>>
Bryan Evenson - Dec. 11, 2012, 12:56 p.m.
Josh,

Moving forward, I plan on using the mainline kernel when working
towards activating all my peripherals on my hardware.  To avoid any
similar problems in the future, if I have issues with a peripheral
with the mainline kernel where should I be checking to see if support
is staged but just not mainlined yet?  And if I do find a problem,
what is Atmel's patch submission process?

Regards,
Bryan


> -----Original Message-----

> From: Josh Wu [mailto:josh.wu@atmel.com]

> Sent: Tuesday, December 11, 2012 3:46 AM

> To: Bryan Evenson

> Cc: linux-arm-kernel@lists.infradead.org

> Subject: Re: at91: Status of NAND flash access

>

> Hi, Bryan

>

> I tested your kernel & dtb (both 3.4 and 3.7-rc8) that you shared in

> dropbox. I can produce your situation. in my case the pmecc error

> offset is 0x86a000.

> the test steps is:

>     1. use a sd card boot at91bootstrap and u-boot to boot a

> at91sam9g25ek board.

>     2. use u-boot command to flush a ubi rootfs in 0x800000.

>     3. load your 3.4 kernel and dtb. it will boot ok.

>     4. load your 3.7-rc8 kernel and dtb. it will fail to boot. "too

> many errors" happens.

>

> But use the test step (not load 3.4 kernel & dtb):

>     1. use a sd card boot at91bootstrap and u-boot to boot a

> at91sam9g25ek board.

>     2. use u-boot command to flush a ubi rootfs in 0x800000.

>     3. load your 3.7-rc8 kernel and dtb. it will boot ok. (use my own

> 3.4 kernel & my dtb is also boot ok.)

>

> Since I don't write DTB in nand flash at all. so it is not caused by

> write dtb in nand flash.

>

> So I suspect your 3.4 kernel cause those problem.

> Check your kernel 3.4 boot log, I suspect that PMECC is not enabled in

> your 3.4 kernel. Since in the log, I don't find the line :  atmel_nand

> 40000000.nand: Initialize PMECC params, cap: 2, sector: 512

>

> After checking your 3.4 dtb. it shows below, and the PMECC parameters

> is set correctly.

>

> U-Boot> tftp 21000000 josh/kernel/dt/zImage-3.4-r7-at91sam9x5ek.dtb

> macb0: PHY present at 0

> macb0: Starting autonegotiation...

> macb0: Autonegotiation complete

> macb0: link up, 100Mbps full-duplex (lpa: 0x45e1) Using macb0 device

> TFTP from server 10.217.6.34; our IP address is 10.217.3.136 Filename

> 'josh/kernel/dt/zImage-3.4-r7-at91sam9x5ek.dtb'.

> Load address: 0x21000000

> Loading: *###

> done

> Bytes transferred = 12288 (3000 hex)

> U-Boot> fdt addr 21000000

> U-Boot> fdt print

> .......

>          nand@40000000 {

>              compatible = "atmel,at91rm9200-nand";

>              #address-cells = <0x1>;

>              #size-cells = <0x1>;

>              reg = <0x40000000 0x10000000 0xffffe000 0x600 0xffffe600

> 0x200 0x100000 0x100000>;

>              atmel,pmecc-lookup-table-offset = <0x8000 0x10000>;

>              atmel,nand-addr-offset = <0x15>;

>              atmel,nand-cmd-offset = <0x16>;

>              gpios = <0x2 0x5 0x0 0x2 0x4 0x0 0x0>;

>              status = "okay";

>              nand-bus-width = <0x8>;

>              nand-ecc-mode = "hw";

>              atmel,has-pmecc;

>              atmel,pmecc-cap = <0x2>;

>              atmel,pmecc-sector-size = <0x200>;

>              nand-on-flash-bbt;

> .......

>

> but in the log (my comment is in below):

>

> On 12/6/2012 9:20 PM, Bryan Evenson wrote:

> >> -----Original Message-----

> >> From: Josh Wu [mailto:josh.wu@atmel.com]

> >> Sent: Thursday, December 06, 2012 5:30 AM

> >> To: Bryan Evenson

> >> Cc: linux-arm-kernel@lists.infradead.org

> >> Subject: Re: at91: Status of NAND flash access

> >>

> >> On 12/6/2012 11:13 AM, Bryan Evenson wrote:

> >>> Josh,

> >>>

> >>> I spoke too soon.  I was able to read and use the filesystem from

> >> NAND

> >>> flash with the patch you provided when I applied it to the Atmel

> 3.4

> >>> kernel fork over at https://github.com/linux4sam/linux-at91/

> (master

> >> branch).

> >>> When I applied the same patch to the recent mainline kernel (3.7-

> >> rc8),

> >>> it's still having problems accessing flash.  The boot log shows

> that

> >>> it is setting up for PMECC correctly, but it has errors when it

> >>> tries to read from the filesystem.

> >> It is strange.  The 3.4 kernel from at91 github just have a few

> >> changes.

> >> so rationally it behavior the same at PMECC function. From your log,

> >> the

> >> 3.7-rc8 kernel says the PMECC found uncorrectable errors.

> >>

> >> Can you try to dump or read from the u-boot? to see whether u-boot

> >> can recognize the same nand page that "too many errors" happened in

> kernel?

> >> I will do some test to see whether the 3.7-rc8 can work in my side

> or

> >> not.

> > U-Boot> nand read 0x22000000 0x800000 0x1D00000

> >

> > NAND read: device 0 offset 0x800000, size 0x1d00000

> > PMECC: Too many errors

> > NAND read from offset 800000 failed -5

> >   0 bytes read: ERROR

> >

> > So u-boot has the same issue.  However, changing the kernel to the

> > linux-at91 forked kernel produced different results.  That kernel

> > noted the PMECC errors but was still able to load the filesystem.  My

> > boot output from the successful filesystem load is below.  Is the 3.4

> > kernel performing corrections that the mainline is not, or is it just

> ignoring errors that it should not be ignoring?

> >

> > I'm hesitant to make any filesystem changes on this board because I

> > know test cases like this where it works one way but not the other

> are

> > kind of rare.  Let me know if you have similar results on your end.

> >

> > -Bryan

> >

> > Uncompressing Linux... done, booting the kernel.

> > Booting Linux on physical CPU 0

> > Linux version 3.4.0 (xxxx@xxxx) (gcc version 4.5.3 20110311

> > (prerelease) (

> > GCC) ) #2 Wed Dec 5 15:36:29 EST 2012

> > CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177

> > CPU: VIVT data cache, VIVT instruction cache

> > Machine: Atmel AT91SAM (Device Tree), model: Atmel AT91SAM9G25-EK

> > Memory policy: ECC disabled, Data cache writeback

> > AT91: Detected soc type: at91sam9x5

> > AT91: Detected soc subtype: at91sam9g25

> > AT91: sram at 0x300000 of 0x8000 mapped at 0xfef70000

> > Clocks: CPU 400 MHz, master 133 MHz, main 12.000 MHz

> > gpiochip_add: registered GPIOs 0 to 31 on device: pioA

> > gpiochip_add: registered GPIOs 32 to 63 on device: pioB

> > gpiochip_add: registered GPIOs 64 to 95 on device: pioC

> > gpiochip_add: registered GPIOs 96 to 127 on device: pioD Built 1

> > zonelists in Zone order, mobility grouping on.  Total pages: 32512

> > Kernel command line: mem=128M console=ttyS0,115200

> > mtdparts=atmel_nand:8M(bootst

> > rap/uboot/kernel)ro,-(rootfs) root=/dev/mtdblock1 rw rootfstype=ubifs

> > ubi.mtd=1 root=ubi0:rootfs PID hash table entries: 512 (order: -1,

> > 2048 bytes) Dentry cache hash table entries: 16384 (order: 4, 65536

> > bytes) Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)

> > Memory: 128MB = 128MB total

> > Memory: 119856k/119856k available, 11216k reserved, 0K highmem

> Virtual

> > kernel memory layout:

> >      vector  : 0xffff0000 - 0xffff1000   (   4 kB)

> >      fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)

> >      vmalloc : 0xc8800000 - 0xff000000   ( 872 MB)

> >      lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)

> >      modules : 0xbf000000 - 0xc0000000   (  16 MB)

> >        .text : 0xc0008000 - 0xc04650d4   (4469 kB)

> >        .init : 0xc0466000 - 0xc048a000   ( 144 kB)

> >        .data : 0xc048a000 - 0xc04c4420   ( 234 kB)

> >         .bss : 0xc04c4444 - 0xc09c66e4   (5129 kB)

> > NR_IRQS:192

> > sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every

> > 4294967286ms

> > Console: colour dummy device 80x30

> > Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo

> > Molnar ... MAX_LOCKDEP_SUBCLASSES:  8

> > ... MAX_LOCK_DEPTH:          48

> > ... MAX_LOCKDEP_KEYS:        8191

> > ... CLASSHASH_SIZE:          4096

> > ... MAX_LOCKDEP_ENTRIES:     16384

> > ... MAX_LOCKDEP_CHAINS:      32768

> > ... CHAINHASH_SIZE:          16384

> >   memory used by lock dependency info: 3695 kB

> >   per task-struct memory footprint: 1152 bytes

> > ------------------------

> > | Locking API testsuite:

> > ---------------------------------------------------------------------

> -------

> >                                   | spin |wlock |rlock |mutex | wsem

> | rsem |

> >    ------------------------------------------------------------------

> --------

> >                       A-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >                   A-B-B-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >               A-B-B-C-C-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >               A-B-C-A-B-C deadlock:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >           A-B-B-C-C-D-D-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >           A-B-C-D-B-D-D-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >           A-B-C-D-B-C-D-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >                      double unlock:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >                    initialize held:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >                   bad unlock order:  ok  |  ok  |  ok  |  ok  |  ok

> |  ok  |

> >    ------------------------------------------------------------------

> --------

> >                recursive read-lock:             |  ok  |

> |  ok  |

> >             recursive read-lock #2:             |  ok  |

> |  ok  |

> >              mixed read-write-lock:             |  ok  |

> |  ok  |

> >              mixed write-read-lock:             |  ok  |

> |  ok  |

> >    ------------------------------------------------------------------

> --------

> >       hard-irqs-on + irq-safe-A/12:  ok  |  ok  |  ok  |

> >       soft-irqs-on + irq-safe-A/12:  ok  |  ok  |  ok  |

> >       hard-irqs-on + irq-safe-A/21:  ok  |  ok  |  ok  |

> >       soft-irqs-on + irq-safe-A/21:  ok  |  ok  |  ok  |

> >         sirq-safe-A => hirqs-on/12:  ok  |  ok  |  ok  |

> >         sirq-safe-A => hirqs-on/21:  ok  |  ok  |  ok  |

> >           hard-safe-A + irqs-on/12:  ok  |  ok  |  ok  |

> >           soft-safe-A + irqs-on/12:  ok  |  ok  |  ok  |

> >           hard-safe-A + irqs-on/21:  ok  |  ok  |  ok  |

> >           soft-safe-A + irqs-on/21:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #1/123:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #1/123:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #1/132:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #1/132:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #1/213:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #1/213:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #1/231:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #1/231:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #1/312:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #1/312:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #1/321:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #1/321:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #2/123:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #2/123:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #2/132:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #2/132:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #2/213:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #2/213:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #2/231:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #2/231:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #2/312:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #2/312:  ok  |  ok  |  ok  |

> >      hard-safe-A + unsafe-B #2/321:  ok  |  ok  |  ok  |

> >      soft-safe-A + unsafe-B #2/321:  ok  |  ok  |  ok  |

> >        hard-irq lock-inversion/123:  ok  |  ok  |  ok  |

> >        soft-irq lock-inversion/123:  ok  |  ok  |  ok  |

> >        hard-irq lock-inversion/132:  ok  |  ok  |  ok  |

> >        soft-irq lock-inversion/132:  ok  |  ok  |  ok  |

> >        hard-irq lock-inversion/213:  ok  |  ok  |  ok  |

> >        soft-irq lock-inversion/213:  ok  |  ok  |  ok  |

> >        hard-irq lock-inversion/231:  ok  |  ok  |  ok  |

> >        soft-irq lock-inversion/231:  ok  |  ok  |  ok  |

> >        hard-irq lock-inversion/312:  ok  |  ok  |  ok  |

> >        soft-irq lock-inversion/312:  ok  |  ok  |  ok  |

> >        hard-irq lock-inversion/321:  ok  |  ok  |  ok  |

> >        soft-irq lock-inversion/321:  ok  |  ok  |  ok  |

> >        hard-irq read-recursion/123:  ok  |

> >        soft-irq read-recursion/123:  ok  |

> >        hard-irq read-recursion/132:  ok  |

> >        soft-irq read-recursion/132:  ok  |

> >        hard-irq read-recursion/213:  ok  |

> >        soft-irq read-recursion/213:  ok  |

> >        hard-irq read-recursion/231:  ok  |

> >        soft-irq read-recursion/231:  ok  |

> >        hard-irq read-recursion/312:  ok  |

> >        soft-irq read-recursion/312:  ok  |

> >        hard-irq read-recursion/321:  ok  |

> >        soft-irq read-recursion/321:  ok  |

> > -------------------------------------------------------

> > Good, all 218 testcases passed! |

> > ---------------------------------

> > Calibrating delay loop... 198.04 BogoMIPS (lpj=990208)

> > pid_max: default: 32768 minimum: 301

> > Mount-cache hash table entries: 512

> > CPU: Testing write buffer coherency: ok Setting up static identity

> map

> > for 0x2033ced8 - 0x2033cf30

> > devtmpfs: initialized

> > dummy:

> > NET: Registered protocol family 16

> > AT91: Power Management (with slow clock mode)

> > AT91: Starting after power-restored wakeup

> > bio: create slab <bio-0> at 0

> > at_hdmac ffffec00.dma-controller: Atmel AHB DMA Controller ( cpy

> slave

> > ), 8 chan nels at_hdmac ffffee00.dma-controller: Atmel AHB DMA

> > Controller ( cpy slave ), 8 chan nels SCSI subsystem initialized

> > usbcore: registered new interface driver usbfs

> > usbcore: registered new interface driver hub

> > usbcore: registered new device driver usb

> > cfg80211: Calling CRDA to update world regulatory domain Switching to

> > clocksource tcb_clksrc

> > NET: Registered protocol family 2

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

> > established hash table entries: 4096 (order: 3, 32768 bytes) TCP bind

> > hash table entries: 4096 (order: 5, 147456 bytes)

> > TCP: Hash tables configured (established 4096 bind 4096)

> > TCP: reno registered

> > UDP hash table entries: 64 (order: 0, 5120 bytes) UDP-Lite hash table

> > entries: 64 (order: 0, 5120 bytes)

> > NET: Registered protocol family 1

> > RPC: Registered named UNIX socket transport module.

> > RPC: Registered udp transport module.

> > RPC: Registered tcp transport module.

> > RPC: Registered tcp NFSv4.1 backchannel transport module.

> > NFS: Registering the id_resolver key type

> > jffs2: version 2.2. (NAND) (SUMMARY)   © 2001-2006 Red Hat, Inc.

> > msgmni has been set to 234

> > Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)

> > io scheduler noop registered (default)

> > fffff200.serial: ttyS0 at MMIO 0xfffff200 (irq = 1) is a ATMEL_SERIAL

> > console [ttyS0] enabled

> > f801c000.serial: ttyS1 at MMIO 0xf801c000 (irq = 5) is a ATMEL_SERIAL

> > f8020000.serial: ttyS2 at MMIO 0xf8020000 (irq = 6) is a ATMEL_SERIAL

> > f8028000.serial: ttyS4 at MMIO 0xf8028000 (irq = 8) is a ATMEL_SERIAL

> > brd: module loaded

> > loop: module loaded

> > mtdoops: mtd device (mtddev=name/number) must be supplied

> > atmel_nand: Use On Flash BBT

> > atmel_nand 40000000.nand: No DMA support for NAND access.

> > ONFI param page 0 valid

> > ONFI flash detected

> > NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda (Micron

> > MT29F2G08AAD)

>

> Here, when PMECC is really enabled, the driver should show following

> message:

>     atmel_nand 40000000.nand: Initialize PMECC params, cap: 2, sector:

> 512

>

> But your 3.4's log doesn't have it. If the dtb is right then maybe the

> issue is caused in the driver?

>

> Can you check your 3.4 kernel code, make sure the function

> atmel_pmecc_nand_init_params() is called or not?

>

> Best Regards,

> Josh Wu

>

> > Bad block table found at page 131008, version 0x01 Bad block table

> > found at page 130944, version 0x01

> > nand_read_bbt: bad block at 0x000009380000

> > 2 cmdlinepart partitions found on MTD device atmel_nand Creating 2

> MTD

> > partitions on "atmel_nand":

> > 0x000000000000-0x000000800000 : "bootstrap/uboot/kernel"

> > 0x000000800000-0x000010000000 : "rootfs"

> > UBI: attaching mtd1 to ubi0

> > UBI: physical eraseblock size:   131072 bytes (128 KiB)

> > UBI: logical eraseblock size:    126976 bytes

> > UBI: smallest flash I/O unit:    2048

> > UBI: VID header offset:          2048 (aligned 2048)

> > UBI: data offset:                4096

> > UBI: max. sequence number:       4249

> > UBI warning: print_rsvd_warning: cannot reserve enough PEBs for bad

> > PEB handling , reserved 15, need 19

> > UBI: attached mtd1 to ubi0

> > UBI: MTD device name:            "rootfs"

> > UBI: MTD device size:            248 MiB

> > UBI: number of good PEBs:        1979

> > UBI: number of bad PEBs:         5

> > UBI: number of corrupted PEBs:   0

> > UBI: max. allowed volumes:       128

> > UBI: wear-leveling threshold:    4096

> > UBI: number of internal volumes: 1

> > UBI: number of user volumes:     1

> > UBI: available PEBs:             0

> > UBI: total number of reserved PEBs: 1979

> > UBI: number of PEBs reserved for bad PEB handling: 15

> > UBI: max/mean erase counter: 5/2

> > UBI: image sequence number:  191777507

> > UBI: background thread "ubi_bgt0d" started, PID 31 UBI error:

> > ubi_init: cannot attach mtd1

> > tun: Universal TUN/TAP device driver, 1.6

> > tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com> macb

> > f802c000.ethernet: (unregistered net_device): invalid hw address,

> > using ran dom

> > MACB_mii_bus: probed

> > macb f802c000.ethernet: eth0: Cadence MACB at 0xf802c000 irq 24

> (4a:15:f4:49:94:

> > a4)

> > macb f802c000.ethernet: eth0: attached PHY driver [Davicom DM9161A]

> > (mii_bus:phy _addr=f802c000.etherne:00, irq=-1) PPP generic driver

> > version 2.4.2

> > NET: Registered protocol family 24

> > usbcore: registered new interface driver asix

> > usbcore: registered new interface driver cdc_ether

> > usbcore: registered new interface driver cdc_eem

> > usbcore: registered new interface driver net1080

> > usbcore: registered new interface driver cdc_subset

> > usbcore: registered new interface driver zaurus

> > usbcore: registered new interface driver ipheth

> > usbcore: registered new interface driver cdc_ncm

> > ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver atmel-ehci

> > 700000.ehci: Atmel EHCI UHP HS atmel-ehci 700000.ehci: new USB bus

> > registered, assigned bus number 1 atmel-ehci 700000.ehci: irq 22, io

> > mem 0x00700000 atmel-ehci 700000.ehci: USB 2.0 started, EHCI 1.00 usb

> > usb1: New USB device found, idVendor=1d6b, idProduct=0002 usb usb1:

> > New USB device strings: Mfr=3, Product=2, SerialNumber=1 usb usb1:

> > Product: Atmel EHCI UHP HS usb usb1: Manufacturer: Linux 3.4.0

> > ehci_hcd usb usb1: SerialNumber: 700000.ehci hub 1-0:1.0: USB hub

> > found hub 1-0:1.0: 3 ports detected

> > ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver at91_ohci

> > 600000.ohci: AT91 OHCI at91_ohci 600000.ohci: new USB bus registered,

> > assigned bus number 2 at91_ohci 600000.ohci: irq 22, io mem

> 0x00600000

> > usb usb2: New USB device found, idVendor=1d6b, idProduct=0001 usb

> > usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1 usb

> > usb2: Product: AT91 OHCI usb usb2: Manufacturer: Linux 3.4.0 ohci_hcd

> > usb usb2: SerialNumber: at91 hub 2-0:1.0: USB hub found hub 2-0:1.0:

> 2

> > ports detected

> > usbcore: registered new interface driver cdc_acm

> > cdc_acm: USB Abstract Control Model driver for USB modems and ISDN

> > adapters Initializing USB Mass Storage driver...

> > usbcore: registered new interface driver usb-storage USB Mass Storage

> > support registered.

> > usbcore: registered new interface driver libusual

> > usbcore: registered new interface driver usbserial

> > usbcore: registered new interface driver usbserial_generic USB Serial

> > support registered for generic

> > usbserial: USB Serial Driver core

> > usbcore: registered new interface driver moto-modem USB Serial

> support

> > registered for moto-modem

> > usbcore: registered new interface driver opticon USB Serial support

> > registered for opticon

> > usbcore: registered new interface driver pl2303 USB Serial support

> > registered for pl2303

> > usbcore: registered new interface driver qcserial USB Serial support

> > registered for Qualcomm USB modem

> > usbcore: registered new interface driver symbol USB Serial support

> > registered for symbol i2c /dev entries driver

> > usbcore: registered new interface driver usbhid

> > usbhid: USB HID core driver

> > nf_conntrack version 0.5.0 (1872 buckets, 7488 max)

> > IPv4 over IPv4 tunneling driver

> > ip_tables: (C) 2000-2006 Netfilter Core Team

> > TCP: cubic registered

> > NET: Registered protocol family 17

> > lib80211: common routines for IEEE802.11 drivers Registering the

> > dns_resolver key type

> > drivers/rtc/hctosys.c: unable to open rtc device (rtc0)

> > UBIFS: recovery needed

> > UBIFS: recovery completed

> > UBIFS: mounted UBI device 0, volume 0, name "rootfs"

> > UBIFS: file system size:   247476224 bytes (241676 KiB, 236 MiB, 1949

> LEBs)

> > UBIFS: journal size:       9023488 bytes (8812 KiB, 8 MiB, 72 LEBs)

> > UBIFS: media format:       w4/r0 (latest is w4/r0)

> > UBIFS: default compressor: lzo

> > UBIFS: reserved for root:  0 bytes (0 KiB)

> > VFS: Mounted root (ubifs filesystem) on device 0:11.

> > devtmpfs: mounted

> > Freeing init memory: 144K

> > INIT: version 2.86 booting

> > Please wait: booting...

> > Starting udev

> > udev[62]: starting version 165

> > Root filesystem already rw, not remounting Caching udev devnodes

> > Populating dev cache

> > logger: mount: mount point /proc/bus/usb does not exist

> > ALSA: Restoring mixer settings...

> > /usr/sbin/alsactl: load_state:1625: No soundcards found...

> > Configuring network interfaces... eth0      no wireless extensions.

> >

> > udhcpc (v1.18.3) started

> > run-parts: /etc/udhcpc.d/00avahi-autoipd exited with code 1 Sending

> > discover...

> > Sending discover...

> > Sending discover...

> > netlink: 12 bytes leftover after parsing attributes.

> > netlink: 12 bytes leftover after parsing attributes.

> > netlink: 12 bytes leftover after parsing attributes.

> > No lease, failing

> > done.

> > Starting portmap daemon: portmap.

> > net.ipv4.conf.default.rp_filter = 1

> > net.ipv4.conf.all.rp_filter = 1

> > kernel.panic = 10

> > hwclock: can't open '/dev/misc/rtc': No such file or directory Mon

> Nov

> > 5 09:47:00 EST 2012

> > hwclock: can't open '/dev/misc/rtc': No such file or directory

> > INIT: Entering runlevel: 5

> > Starting system message bus: dbus.

> > Starting Dropbear SSH server: dropbear.

> > starting Busybox HTTP Daemon: httpd... done.

> > Starting Vixie-cron.

> > Starting ntpd: done

> > Starting syslogd/klogd: done

> >   * Starting Avahi mDNS/DNS-SD Daemon: avahi-daemon

> >     ...done.

> >

> >>> I noticed over at the linux-at91 fork that you had applied the

> PMECC

> >>> support on the 3.4.x_pmecc_dt_9x5 branch a few months ago.  From

> >>> browsing the mainline I didn't see some of your changes from that

> >>> branch in the mainline.  Are there some changes from the linux-at91

> >> fork that are still scheduled for mainlining?

> >> yes, this patch is not push to mainline yet. Currently the only

> >> concern is we are think about the PMECC error correct bits need to

> >> adjust by ONFI parameters that read from nand flash.

> >> But it is not decide yet. if no exception, this patch will push to

> >> mainline soon.

> >>

> >> Best Regards,

> >> Josh Wu

> >>

> >>> If it helps, here is the boot log when I tried to boot using a 3.7-

> >> rc8

> >>> kernel and DT.

> >>>

> >>> Thanks,

> >>> Bryan

> >>>

> >>> Uncompressing Linux... done, booting the kernel.

> >>> [    0.000000] Booting Linux on physical CPU 0

> >>> [    0.000000] Linux version 3.7.0-rc8-armv5-x0.16 (xxxx@xxxx) (gcc

> >> versio

> >>> n 4.6.2 20121016 (release) [ARM/embedded-4_6-branch revision

> 192487]

> >>> (GNU Tools for ARM Embedded Processors) ) #1 Wed Dec 5 16:11:30 EST

> >> 2012

> >>> [    0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ),

> >> cr=00053177

> >>> [    0.000000] CPU: VIVT data cache, VIVT instruction cache

> >>> [    0.000000] Machine: Atmel AT91SAM (Device Tree), model: Atmel

> >> AT91SAM9G25-EK

> >>> [    0.000000] Memory policy: ECC disabled, Data cache writeback

> >>> [    0.000000] AT91: Detected soc type: at91sam9x5

> >>> [    0.000000] AT91: Detected soc subtype: at91sam9g25

> >>> [    0.000000] AT91: sram at 0x300000 of 0x8000 mapped at

> 0xfef70000

> >>> [    0.000000] Clocks: CPU 400 MHz, master 133 MHz, main 12.000 MHz

> >>> [    0.000000] Built 1 zonelists in Zone order, mobility grouping

> on.

> >> Total pag

> >>> es: 32512

> >>> [    0.000000] Kernel command line: mem=128M console=ttyS0,115200

> >> mtdparts=atmel

> >>> _nand:8M(bootstrap/uboot/kernel)ro,-(rootfs) root=/dev/mtdblock1 rw

> >>> rootfstype=u bifs ubi.mtd=1 root=ubi0:rootfs

> >>> [    0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)

> >>> [    0.000000] Dentry cache hash table entries: 16384 (order: 4,

> >> 65536 bytes)

> >>> [    0.000000] Inode-cache hash table entries: 8192 (order: 3,

> 32768

> >> bytes)

> >>> [    0.000000] Memory: 128MB = 128MB total

> >>> [    0.000000] Memory: 124276k/124276k available, 6796k reserved,

> 0K

> >> highmem

> >>> [    0.000000] Virtual kernel memory layout:

> >>> [    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)

> >>> [    0.000000]     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)

> >>> [    0.000000]     vmalloc : 0xc8800000 - 0xff000000   ( 872 MB)

> >>> [    0.000000]     lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)

> >>> [    0.000000]     modules : 0xbf000000 - 0xc0000000   (  16 MB)

> >>> [    0.000000]       .text : 0xc0008000 - 0xc04b8630   (4802 kB)

> >>> [    0.000000]       .init : 0xc04b9000 - 0xc04e45c4   ( 174 kB)

> >>> [    0.000000]       .data : 0xc04e6000 - 0xc0516ce0   ( 196 kB)

> >>> [    0.000000]        .bss : 0xc0516d04 - 0xc05760bc   ( 381 kB)

> >>> [    0.000000] NR_IRQS:16 nr_irqs:16 16

> >>> [    0.000000] sched_clock: 32 bits at 256 Hz, resolution

> 3906250ns,

> >> wraps every

> >>>    3892314108ms

> >>> [    0.000000] Console: colour dummy device 80x30

> >>> [    0.035156] Calibrating delay loop... 199.80 BogoMIPS

> (lpj=389120)

> >>> [    0.035156] pid_max: default: 32768 minimum: 301

> >>> [    0.035156] Mount-cache hash table entries: 512

> >>> [    0.039062] CPU: Testing write buffer coherency: ok

> >>> [    0.039062] Setting up static identity map for 0x20371d48 -

> >> 0x20371da0

> >>> [    0.039062] devtmpfs: initialized

> >>> [    0.042968] NET: Registered protocol family 16

> >>> [    0.042968] DMA: preallocated 256 KiB pool for atomic coherent

> >> allocations

> >>> [    0.070312] No ATAGs?

> >>> [    0.070312] AT91: Power Management

> >>> [    0.070312] AT91: Starting after power-restored wakeup

> >>> [    0.121093] bio: create slab <bio-0> at 0

> >>> [    0.125000] SCSI subsystem initialized

> >>> [    0.128906] usbcore: registered new interface driver usbfs

> >>> [    0.128906] usbcore: registered new interface driver hub

> >>> [    0.128906] usbcore: registered new device driver usb

> >>> [    0.132812] at91_i2c f8010000.i2c: AT91 i2c bus driver.

> >>> [    0.132812] at91_i2c f8014000.i2c: AT91 i2c bus driver.

> >>> [    0.136718] at91_i2c f8018000.i2c: AT91 i2c bus driver.

> >>> [    0.140625] Switching to clocksource tcb_clksrc

> >>> [    0.195312] NET: Registered protocol family 2

> >>> [    0.199218] TCP established hash table entries: 4096 (order: 3,

> >> 32768 bytes)

> >>> [    0.199218] TCP bind hash table entries: 4096 (order: 2, 16384

> >> bytes)

> >>> [    0.199218] TCP: Hash tables configured (established 4096 bind

> >> 4096)

> >>> [    0.199218] TCP: reno registered

> >>> [    0.199218] UDP hash table entries: 256 (order: 0, 4096 bytes)

> >>> [    0.199218] UDP-Lite hash table entries: 256 (order: 0, 4096

> >> bytes)

> >>> [    0.199218] NET: Registered protocol family 1

> >>> [    0.199218] RPC: Registered named UNIX socket transport module.

> >>> [    0.199218] RPC: Registered udp transport module.

> >>> [    0.199218] RPC: Registered tcp transport module.

> >>> [    0.199218] RPC: Registered tcp NFSv4.1 backchannel transport

> >> module.

> >>> [    0.207031] NFS: Registering the id_resolver key type

> >>> [    0.207031] Key type id_resolver registered

> >>> [    0.207031] Key type id_legacy registered

> >>> [    0.207031] jffs2: version 2.2. (NAND) �© 2001-2006 Red Hat,

> >> Inc.

> >>> [    0.207031] msgmni has been set to 242

> >>> [    0.210937] io scheduler noop registered (default)

> >>> [    0.218750] fffff200.serial: ttyS0 at MMIO 0xfffff200 (irq = 18)

> >> is a ATMEL_S

> >>> ERIAL

> >>> [    0.609375] console [ttyS0] enabled

> >>> [    0.613281] f801c000.serial: ttyS1 at MMIO 0xf801c000 (irq = 22)

> >> is a ATMEL_S

> >>> ERIAL

> >>> [    0.632812] brd: module loaded

> >>> [    0.652343] loop: module loaded

> >>> [    0.667968] atmel_nand: Use On Flash BBT

> >>> [    0.671875] atmel_nand 40000000.nand: No DMA support for NAND

> >> access.

> >>> [    0.675781] ONFI param page 0 valid

> >>> [    0.679687] ONFI flash detected

> >>> [    0.683593] NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda

> >> (Micron MT29F2G

> >>> 08AAD), page size: 2048, OOB size: 64

> >>> [    0.695312] atmel_nand 40000000.nand: Initialize PMECC params,

> >> cap: 2, sector

> >>> : 512

> >>> [    0.703125] Bad block table found at page 131008, version 0x01

> >>> [    0.707031] Bad block table found at page 130944, version 0x01

> >>> [    0.714843] nand_read_bbt: bad block at 0x000009380000

> >>> [    0.718750] 2 cmdlinepart partitions found on MTD device

> >> atmel_nand

> >>> [    0.726562] Creating 2 MTD partitions on "atmel_nand":

> >>> [    0.730468] 0x000000000000-0x000000800000 :

> >> "bootstrap/uboot/kernel"

> >>> [    0.742187] 0x000000800000-0x000010000000 : "rootfs"

> >>> [    0.757812] macb f802c000.ethernet (unregistered net_device):

> >> invalid hw addr

> >>> ess, using random

> >>> [    0.773437] libphy: MACB_mii_bus: probed

> >>> [    0.777343] macb f802c000.ethernet eth0: Cadence MACB at

> >> 0xf802c000 irq 23 (c

> >>> a:2c:e6:c3:59:8f)

> >>> [    0.785156] macb f802c000.ethernet eth0: attached PHY driver

> >> [Davicom DM9161A

> >>> ] (mii_bus:phy_addr=f802c000.etherne:00, irq=-1)

> >>> [    0.796875] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI)

> >> Driver

> >>> [    0.804687] atmel-ehci 700000.ehci: Atmel EHCI UHP HS

> >>> [    0.808593] atmel-ehci 700000.ehci: new USB bus registered,

> >> assigned bus numb

> >>> er 1

> >>> [    0.816406] atmel-ehci 700000.ehci: irq 28, io mem 0x00700000

> >>> [    0.835937] atmel-ehci 700000.ehci: USB 2.0 started, EHCI 1.00

> >>> [    0.839843] usb usb1: New USB device found, idVendor=1d6b,

> >> idProduct=0002

> >>> [    0.847656] usb usb1: New USB device strings: Mfr=3, Product=2,

> >> SerialNumber=

> >>> 1

> >>> [    0.855468] usb usb1: Product: Atmel EHCI UHP HS

> >>> [    0.859375] usb usb1: Manufacturer: Linux 3.7.0-rc8-armv5-x0.16

> >> ehci_hcd

> >>> [    0.867187] usb usb1: SerialNumber: 700000.ehci

> >>> [    0.871093] hub 1-0:1.0: USB hub found

> >>> [    0.875000] hub 1-0:1.0: 3 ports detected

> >>> [    0.878906] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI)

> Driver

> >>> [    0.886718] at91_ohci 600000.ohci: AT91 OHCI

> >>> [    0.890625] at91_ohci 600000.ohci: new USB bus registered,

> >> assigned bus numbe

> >>> r 2

> >>> [    0.898437] at91_ohci 600000.ohci: irq 28, io mem 0x00600000

> >>> [    0.964843] usb usb2: New USB device found, idVendor=1d6b,

> >> idProduct=0001

> >>> [    0.968750] usb usb2: New USB device strings: Mfr=3, Product=2,

> >> SerialNumber=

> >>> 1

> >>> [    0.976562] usb usb2: Product: AT91 OHCI

> >>> [    0.980468] usb usb2: Manufacturer: Linux 3.7.0-rc8-armv5-x0.16

> >> ohci_hcd

> >>> [    0.988281] usb usb2: SerialNumber: at91

> >>> [    0.992187] hub 2-0:1.0: USB hub found

> >>> [    0.996093] hub 2-0:1.0: 2 ports detected

> >>> [    1.003906] usbcore: registered new interface driver cdc_acm

> >>> [    1.007812] cdc_acm: USB Abstract Control Model driver for USB

> >> modems and ISD

> >>> N adapters

> >>> [    1.019531] usbcore: registered new interface driver uas

> >>> [    1.023437] Initializing USB Mass Storage driver...

> >>> [    1.027343] usbcore: registered new interface driver usb-storage

> >>> [    1.035156] USB Mass Storage support registered.

> >>> [    1.039062] usbcore: registered new interface driver ums-alauda

> >>> [    1.046875] usbcore: registered new interface driver ums-cypress

> >>> [    1.054687] usbcore: registered new interface driver ums-datafab

> >>> [    1.058593] usbcore: registered new interface driver

> ums_eneub6250

> >>> [    1.066406] usbcore: registered new interface driver ums-freecom

> >>> [    1.074218] usbcore: registered new interface driver ums-isd200

> >>> [    1.078125] usbcore: registered new interface driver ums-

> jumpshot

> >>> [    1.085937] usbcore: registered new interface driver ums-karma

> >>> [    1.093750] usbcore: registered new interface driver ums-

> onetouch

> >>> [    1.097656] usbcore: registered new interface driver ums-realtek

> >>> [    1.105468] usbcore: registered new interface driver ums-sddr09

> >>> [    1.113281] usbcore: registered new interface driver ums-sddr55

> >>> [    1.117187] usbcore: registered new interface driver ums-usbat

> >>> [    1.125000] usbcore: registered new interface driver usbserial

> >>> [    1.132812] usbcore: registered new interface driver

> >> usbserial_generic

> >>> [    1.140625] usbserial: USB Serial support registered for generic

> >>> [    1.144531] usbcore: registered new interface driver ftdi_sio

> >>> [    1.152343] usbserial: USB Serial support registered for FTDI

> USB

> >> Serial Devi

> >>> ce

> >>> [    1.160156] usbcore: registered new interface driver pl2303

> >>> [    1.167968] usbserial: USB Serial support registered for pl2303

> >>> [    1.171875] mousedev: PS/2 mouse device common for all mice

> >>> [    1.179687] i2c /dev entries driver

> >>> [    1.191406] usbcore: registered new interface driver usbhid

> >>> [    1.199218] usbhid: USB HID core driver

> >>> [    1.207031] usb 1-2: new high-speed USB device number 2 using

> >> atmel-ehci

> >>> [    1.214843] TCP: cubic registered

> >>> [    1.218750] NET: Registered protocol family 10

> >>> [    1.222656] sit: IPv6 over IPv4 tunneling driver

> >>> [    1.230468] NET: Registered protocol family 17

> >>> [    1.234375] Key type dns_resolver registered

> >>> [    1.246093] UBI: attaching mtd1 to ubi0

> >>> [    1.253906] atmel_nand 40000000.nand: PMECC: Too many errors

> >>> [    1.261718] UBI warning: ubi_io_read: error -5 while reading 64

> >> bytes from PE

> >>> B 10:0, read only 0 bytes, retry

> >>> [    1.269531] atmel_nand 40000000.nand: PMECC: Too many errors

> >>> [    1.277343] UBI warning: ubi_io_read: error -5 while reading 64

> >> bytes from PE

> >>> B 10:0, read only 0 bytes, retry

> >>> [    1.285156] atmel_nand 40000000.nand: PMECC: Too many errors

> >>> [    1.292968] UBI warning: ubi_io_read: error -5 while reading 64

> >> bytes from PE

> >>> B 10:0, read only 0 bytes, retry

> >>> [    1.304687] atmel_nand 40000000.nand: PMECC: Too many errors

> >>> [    1.308593] UBI error: ubi_io_read: error -5 while reading 64

> >> bytes from PEB

> >>> 10:0, read 0 bytes

> >>> [    1.316406] [<c000d2bc>] (unwind_backtrace+0x0/0xe0) from

> >> [<c0243a10>] (ubi_i

> >>> o_read+0x1d4/0x2a4)

> >>> [    1.328125] [<c0243a10>] (ubi_io_read+0x1d4/0x2a4) from

> >> [<c0243d20>] (ubi_io_

> >>> read_ec_hdr+0x68/0x214)

> >>> [    1.335937] [<c0243d20>] (ubi_io_read_ec_hdr+0x68/0x214) from

> >> [<c024804c>] (u

> >>> bi_attach+0x104/0x13e4)

> >>> [    1.343750] [<c024804c>] (ubi_attach+0x104/0x13e4) from

> >> [<c023e514>] (ubi_att

> >>> ach_mtd_dev+0x5a4/0xb94)

> >>> [    1.355468] [<c023e514>] (ubi_attach_mtd_dev+0x5a4/0xb94) from

> >> [<c04d09dc>] (

> >>> ubi_init+0x1d8/0x2d8)

> >>> [    1.363281] [<c04d09dc>] (ubi_init+0x1d8/0x2d8) from

> [<c0008860>]

> >> (do_one_ini

> >>> tcall+0x90/0x168)

> >>> [    1.371093] [<c0008860>] (do_one_initcall+0x90/0x168) from

> >> [<c03686a4>] (kern

> >>> el_init+0xe8/0x2a0)

> >>> [    1.378906] [<c03686a4>] (kernel_init+0xe8/0x2a0) from

> >> [<c00093f0>] (ret_from

> >>> _fork+0x14/0x24)

> >>> [    1.386718] UBI error: ubi_attach_mtd_dev: failed to attach

> mtd1,

> >> error -5

> >>> [    1.394531] UBI error: ubi_init: cannot attach mtd1

> >>> [    1.402343] drivers/rtc/hctosys.c: unable to open rtc device

> >> (rtc0)

> >>> [    1.410156] UBIFS error (pid 1): ubifs_mount: cannot open

> >> "ubi0:rootfs", erro

> >>> r -19

> >>> [    1.417968] VFS: Cannot open root device "ubi0:rootfs" or

> unknown-

> >> block(0,0):

> >>>    error -19

> >>> [    1.425781] Please append a correct "root=" boot option; here

> are

> >> the availab

> >>> le partitions:

> >>> [    1.433593] 1f00            8192 mtdblock0  (driver?)

> >>> [    1.437500] 1f01          253952 mtdblock1  (driver?)

> >>> [    1.441406] Kernel panic - not syncing: VFS: Unable to mount

> root

> >> fs on unkno

> >>> wn-block(0,0)

> >>>

> >>>
Wu, Josh - Dec. 12, 2012, 2:51 a.m.
Hi, Bryan

It is good to hear that. :)
yes, if some feature are not merge in mainline, that will cause lots of 
confusion. we will continue to push our patches to mainline.

On 12/11/2012 8:56 PM, Bryan Evenson wrote:
> Josh,
>
> Moving forward, I plan on using the mainline kernel when working
> towards activating all my peripherals on my hardware.  To avoid any
> similar problems in the future, if I have issues with a peripheral
> with the mainline kernel where should I be checking to see if support
> is staged but just not mainlined yet?

I think in that situation,  the public branch you can check is : 
at91-3.4-trunk_merge.  Which merged most peripheral features base on 3.4.x
But maybe this branch will updated sometimes.

>   And if I do find a problem,
> what is Atmel's patch submission process?

In my optional, I think send patch to mainline is good choice.

And I add  Nicolas in the mail loop, who maintains the at91 source code 
and branches. He is the right person (also very kind person) to ask.

Thanks.
Best Regards,
Josh Wu

>
> Regards,
> Bryan
>
>
>> -----Original Message-----
>> From: Josh Wu [mailto:josh.wu@atmel.com]
>> Sent: Tuesday, December 11, 2012 3:46 AM
>> To: Bryan Evenson
>> Cc: linux-arm-kernel@lists.infradead.org
>> Subject: Re: at91: Status of NAND flash access
>>
>> Hi, Bryan
>>
>> I tested your kernel & dtb (both 3.4 and 3.7-rc8) that you shared in
>> dropbox. I can produce your situation. in my case the pmecc error
>> offset is 0x86a000.
>> the test steps is:
>>      1. use a sd card boot at91bootstrap and u-boot to boot a
>> at91sam9g25ek board.
>>      2. use u-boot command to flush a ubi rootfs in 0x800000.
>>      3. load your 3.4 kernel and dtb. it will boot ok.
>>      4. load your 3.7-rc8 kernel and dtb. it will fail to boot. "too
>> many errors" happens.
>>
>> But use the test step (not load 3.4 kernel & dtb):
>>      1. use a sd card boot at91bootstrap and u-boot to boot a
>> at91sam9g25ek board.
>>      2. use u-boot command to flush a ubi rootfs in 0x800000.
>>      3. load your 3.7-rc8 kernel and dtb. it will boot ok. (use my own
>> 3.4 kernel & my dtb is also boot ok.)
>>
>> Since I don't write DTB in nand flash at all. so it is not caused by
>> write dtb in nand flash.
>>
>> So I suspect your 3.4 kernel cause those problem.
>> Check your kernel 3.4 boot log, I suspect that PMECC is not enabled in
>> your 3.4 kernel. Since in the log, I don't find the line :  atmel_nand
>> 40000000.nand: Initialize PMECC params, cap: 2, sector: 512
>>
>> After checking your 3.4 dtb. it shows below, and the PMECC parameters
>> is set correctly.
>>
>> U-Boot> tftp 21000000 josh/kernel/dt/zImage-3.4-r7-at91sam9x5ek.dtb
>> macb0: PHY present at 0
>> macb0: Starting autonegotiation...
>> macb0: Autonegotiation complete
>> macb0: link up, 100Mbps full-duplex (lpa: 0x45e1) Using macb0 device
>> TFTP from server 10.217.6.34; our IP address is 10.217.3.136 Filename
>> 'josh/kernel/dt/zImage-3.4-r7-at91sam9x5ek.dtb'.
>> Load address: 0x21000000
>> Loading: *###
>> done
>> Bytes transferred = 12288 (3000 hex)
>> U-Boot> fdt addr 21000000
>> U-Boot> fdt print
>> .......
>>           nand@40000000 {
>>               compatible = "atmel,at91rm9200-nand";
>>               #address-cells = <0x1>;
>>               #size-cells = <0x1>;
>>               reg = <0x40000000 0x10000000 0xffffe000 0x600 0xffffe600
>> 0x200 0x100000 0x100000>;
>>               atmel,pmecc-lookup-table-offset = <0x8000 0x10000>;
>>               atmel,nand-addr-offset = <0x15>;
>>               atmel,nand-cmd-offset = <0x16>;
>>               gpios = <0x2 0x5 0x0 0x2 0x4 0x0 0x0>;
>>               status = "okay";
>>               nand-bus-width = <0x8>;
>>               nand-ecc-mode = "hw";
>>               atmel,has-pmecc;
>>               atmel,pmecc-cap = <0x2>;
>>               atmel,pmecc-sector-size = <0x200>;
>>               nand-on-flash-bbt;
>> .......
>>
>> but in the log (my comment is in below):
>>
>> On 12/6/2012 9:20 PM, Bryan Evenson wrote:
>>>> -----Original Message-----
>>>> From: Josh Wu [mailto:josh.wu@atmel.com]
>>>> Sent: Thursday, December 06, 2012 5:30 AM
>>>> To: Bryan Evenson
>>>> Cc: linux-arm-kernel@lists.infradead.org
>>>> Subject: Re: at91: Status of NAND flash access
>>>>
>>>> On 12/6/2012 11:13 AM, Bryan Evenson wrote:
>>>>> Josh,
>>>>>
>>>>> I spoke too soon.  I was able to read and use the filesystem from
>>>> NAND
>>>>> flash with the patch you provided when I applied it to the Atmel
>> 3.4
>>>>> kernel fork over at https://github.com/linux4sam/linux-at91/
>> (master
>>>> branch).
>>>>> When I applied the same patch to the recent mainline kernel (3.7-
>>>> rc8),
>>>>> it's still having problems accessing flash.  The boot log shows
>> that
>>>>> it is setting up for PMECC correctly, but it has errors when it
>>>>> tries to read from the filesystem.
>>>> It is strange.  The 3.4 kernel from at91 github just have a few
>>>> changes.
>>>> so rationally it behavior the same at PMECC function. From your log,
>>>> the
>>>> 3.7-rc8 kernel says the PMECC found uncorrectable errors.
>>>>
>>>> Can you try to dump or read from the u-boot? to see whether u-boot
>>>> can recognize the same nand page that "too many errors" happened in
>> kernel?
>>>> I will do some test to see whether the 3.7-rc8 can work in my side
>> or
>>>> not.
>>> U-Boot> nand read 0x22000000 0x800000 0x1D00000
>>>
>>> NAND read: device 0 offset 0x800000, size 0x1d00000
>>> PMECC: Too many errors
>>> NAND read from offset 800000 failed -5
>>>    0 bytes read: ERROR
>>>
>>> So u-boot has the same issue.  However, changing the kernel to the
>>> linux-at91 forked kernel produced different results.  That kernel
>>> noted the PMECC errors but was still able to load the filesystem.  My
>>> boot output from the successful filesystem load is below.  Is the 3.4
>>> kernel performing corrections that the mainline is not, or is it just
>> ignoring errors that it should not be ignoring?
>>> I'm hesitant to make any filesystem changes on this board because I
>>> know test cases like this where it works one way but not the other
>> are
>>> kind of rare.  Let me know if you have similar results on your end.
>>>
>>> -Bryan
>>>
>>> Uncompressing Linux... done, booting the kernel.
>>> Booting Linux on physical CPU 0
>>> Linux version 3.4.0 (xxxx@xxxx) (gcc version 4.5.3 20110311
>>> (prerelease) (
>>> GCC) ) #2 Wed Dec 5 15:36:29 EST 2012
>>> CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
>>> CPU: VIVT data cache, VIVT instruction cache
>>> Machine: Atmel AT91SAM (Device Tree), model: Atmel AT91SAM9G25-EK
>>> Memory policy: ECC disabled, Data cache writeback
>>> AT91: Detected soc type: at91sam9x5
>>> AT91: Detected soc subtype: at91sam9g25
>>> AT91: sram at 0x300000 of 0x8000 mapped at 0xfef70000
>>> Clocks: CPU 400 MHz, master 133 MHz, main 12.000 MHz
>>> gpiochip_add: registered GPIOs 0 to 31 on device: pioA
>>> gpiochip_add: registered GPIOs 32 to 63 on device: pioB
>>> gpiochip_add: registered GPIOs 64 to 95 on device: pioC
>>> gpiochip_add: registered GPIOs 96 to 127 on device: pioD Built 1
>>> zonelists in Zone order, mobility grouping on.  Total pages: 32512
>>> Kernel command line: mem=128M console=ttyS0,115200
>>> mtdparts=atmel_nand:8M(bootst
>>> rap/uboot/kernel)ro,-(rootfs) root=/dev/mtdblock1 rw rootfstype=ubifs
>>> ubi.mtd=1 root=ubi0:rootfs PID hash table entries: 512 (order: -1,
>>> 2048 bytes) Dentry cache hash table entries: 16384 (order: 4, 65536
>>> bytes) Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
>>> Memory: 128MB = 128MB total
>>> Memory: 119856k/119856k available, 11216k reserved, 0K highmem
>> Virtual
>>> kernel memory layout:
>>>       vector  : 0xffff0000 - 0xffff1000   (   4 kB)
>>>       fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
>>>       vmalloc : 0xc8800000 - 0xff000000   ( 872 MB)
>>>       lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)
>>>       modules : 0xbf000000 - 0xc0000000   (  16 MB)
>>>         .text : 0xc0008000 - 0xc04650d4   (4469 kB)
>>>         .init : 0xc0466000 - 0xc048a000   ( 144 kB)
>>>         .data : 0xc048a000 - 0xc04c4420   ( 234 kB)
>>>          .bss : 0xc04c4444 - 0xc09c66e4   (5129 kB)
>>> NR_IRQS:192
>>> sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every
>>> 4294967286ms
>>> Console: colour dummy device 80x30
>>> Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo
>>> Molnar ... MAX_LOCKDEP_SUBCLASSES:  8
>>> ... MAX_LOCK_DEPTH:          48
>>> ... MAX_LOCKDEP_KEYS:        8191
>>> ... CLASSHASH_SIZE:          4096
>>> ... MAX_LOCKDEP_ENTRIES:     16384
>>> ... MAX_LOCKDEP_CHAINS:      32768
>>> ... CHAINHASH_SIZE:          16384
>>>    memory used by lock dependency info: 3695 kB
>>>    per task-struct memory footprint: 1152 bytes
>>> ------------------------
>>> | Locking API testsuite:
>>> ---------------------------------------------------------------------
>> -------
>>>                                    | spin |wlock |rlock |mutex | wsem
>> | rsem |
>>>     ------------------------------------------------------------------
>> --------
>>>                        A-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok
>> |  ok  |
>>>                    A-B-B-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok
>> |  ok  |
>>>                A-B-B-C-C-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok
>> |  ok  |
>>>                A-B-C-A-B-C deadlock:  ok  |  ok  |  ok  |  ok  |  ok
>> |  ok  |
>>>            A-B-B-C-C-D-D-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok
>> |  ok  |
>>>            A-B-C-D-B-D-D-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok
>> |  ok  |
>>>            A-B-C-D-B-C-D-A deadlock:  ok  |  ok  |  ok  |  ok  |  ok
>> |  ok  |
>>>                       double unlock:  ok  |  ok  |  ok  |  ok  |  ok
>> |  ok  |
>>>                     initialize held:  ok  |  ok  |  ok  |  ok  |  ok
>> |  ok  |
>>>                    bad unlock order:  ok  |  ok  |  ok  |  ok  |  ok
>> |  ok  |
>>>     ------------------------------------------------------------------
>> --------
>>>                 recursive read-lock:             |  ok  |
>> |  ok  |
>>>              recursive read-lock #2:             |  ok  |
>> |  ok  |
>>>               mixed read-write-lock:             |  ok  |
>> |  ok  |
>>>               mixed write-read-lock:             |  ok  |
>> |  ok  |
>>>     ------------------------------------------------------------------
>> --------
>>>        hard-irqs-on + irq-safe-A/12:  ok  |  ok  |  ok  |
>>>        soft-irqs-on + irq-safe-A/12:  ok  |  ok  |  ok  |
>>>        hard-irqs-on + irq-safe-A/21:  ok  |  ok  |  ok  |
>>>        soft-irqs-on + irq-safe-A/21:  ok  |  ok  |  ok  |
>>>          sirq-safe-A => hirqs-on/12:  ok  |  ok  |  ok  |
>>>          sirq-safe-A => hirqs-on/21:  ok  |  ok  |  ok  |
>>>            hard-safe-A + irqs-on/12:  ok  |  ok  |  ok  |
>>>            soft-safe-A + irqs-on/12:  ok  |  ok  |  ok  |
>>>            hard-safe-A + irqs-on/21:  ok  |  ok  |  ok  |
>>>            soft-safe-A + irqs-on/21:  ok  |  ok  |  ok  |
>>>       hard-safe-A + unsafe-B #1/123:  ok  |  ok  |  ok  |
>>>       soft-safe-A + unsafe-B #1/123:  ok  |  ok  |  ok  |
>>>       hard-safe-A + unsafe-B #1/132:  ok  |  ok  |  ok  |
>>>       soft-safe-A + unsafe-B #1/132:  ok  |  ok  |  ok  |
>>>       hard-safe-A + unsafe-B #1/213:  ok  |  ok  |  ok  |
>>>       soft-safe-A + unsafe-B #1/213:  ok  |  ok  |  ok  |
>>>       hard-safe-A + unsafe-B #1/231:  ok  |  ok  |  ok  |
>>>       soft-safe-A + unsafe-B #1/231:  ok  |  ok  |  ok  |
>>>       hard-safe-A + unsafe-B #1/312:  ok  |  ok  |  ok  |
>>>       soft-safe-A + unsafe-B #1/312:  ok  |  ok  |  ok  |
>>>       hard-safe-A + unsafe-B #1/321:  ok  |  ok  |  ok  |
>>>       soft-safe-A + unsafe-B #1/321:  ok  |  ok  |  ok  |
>>>       hard-safe-A + unsafe-B #2/123:  ok  |  ok  |  ok  |
>>>       soft-safe-A + unsafe-B #2/123:  ok  |  ok  |  ok  |
>>>       hard-safe-A + unsafe-B #2/132:  ok  |  ok  |  ok  |
>>>       soft-safe-A + unsafe-B #2/132:  ok  |  ok  |  ok  |
>>>       hard-safe-A + unsafe-B #2/213:  ok  |  ok  |  ok  |
>>>       soft-safe-A + unsafe-B #2/213:  ok  |  ok  |  ok  |
>>>       hard-safe-A + unsafe-B #2/231:  ok  |  ok  |  ok  |
>>>       soft-safe-A + unsafe-B #2/231:  ok  |  ok  |  ok  |
>>>       hard-safe-A + unsafe-B #2/312:  ok  |  ok  |  ok  |
>>>       soft-safe-A + unsafe-B #2/312:  ok  |  ok  |  ok  |
>>>       hard-safe-A + unsafe-B #2/321:  ok  |  ok  |  ok  |
>>>       soft-safe-A + unsafe-B #2/321:  ok  |  ok  |  ok  |
>>>         hard-irq lock-inversion/123:  ok  |  ok  |  ok  |
>>>         soft-irq lock-inversion/123:  ok  |  ok  |  ok  |
>>>         hard-irq lock-inversion/132:  ok  |  ok  |  ok  |
>>>         soft-irq lock-inversion/132:  ok  |  ok  |  ok  |
>>>         hard-irq lock-inversion/213:  ok  |  ok  |  ok  |
>>>         soft-irq lock-inversion/213:  ok  |  ok  |  ok  |
>>>         hard-irq lock-inversion/231:  ok  |  ok  |  ok  |
>>>         soft-irq lock-inversion/231:  ok  |  ok  |  ok  |
>>>         hard-irq lock-inversion/312:  ok  |  ok  |  ok  |
>>>         soft-irq lock-inversion/312:  ok  |  ok  |  ok  |
>>>         hard-irq lock-inversion/321:  ok  |  ok  |  ok  |
>>>         soft-irq lock-inversion/321:  ok  |  ok  |  ok  |
>>>         hard-irq read-recursion/123:  ok  |
>>>         soft-irq read-recursion/123:  ok  |
>>>         hard-irq read-recursion/132:  ok  |
>>>         soft-irq read-recursion/132:  ok  |
>>>         hard-irq read-recursion/213:  ok  |
>>>         soft-irq read-recursion/213:  ok  |
>>>         hard-irq read-recursion/231:  ok  |
>>>         soft-irq read-recursion/231:  ok  |
>>>         hard-irq read-recursion/312:  ok  |
>>>         soft-irq read-recursion/312:  ok  |
>>>         hard-irq read-recursion/321:  ok  |
>>>         soft-irq read-recursion/321:  ok  |
>>> -------------------------------------------------------
>>> Good, all 218 testcases passed! |
>>> ---------------------------------
>>> Calibrating delay loop... 198.04 BogoMIPS (lpj=990208)
>>> pid_max: default: 32768 minimum: 301
>>> Mount-cache hash table entries: 512
>>> CPU: Testing write buffer coherency: ok Setting up static identity
>> map
>>> for 0x2033ced8 - 0x2033cf30
>>> devtmpfs: initialized
>>> dummy:
>>> NET: Registered protocol family 16
>>> AT91: Power Management (with slow clock mode)
>>> AT91: Starting after power-restored wakeup
>>> bio: create slab <bio-0> at 0
>>> at_hdmac ffffec00.dma-controller: Atmel AHB DMA Controller ( cpy
>> slave
>>> ), 8 chan nels at_hdmac ffffee00.dma-controller: Atmel AHB DMA
>>> Controller ( cpy slave ), 8 chan nels SCSI subsystem initialized
>>> usbcore: registered new interface driver usbfs
>>> usbcore: registered new interface driver hub
>>> usbcore: registered new device driver usb
>>> cfg80211: Calling CRDA to update world regulatory domain Switching to
>>> clocksource tcb_clksrc
>>> NET: Registered protocol family 2
>>> IP route cache hash table entries: 1024 (order: 0, 4096 bytes) TCP
>>> established hash table entries: 4096 (order: 3, 32768 bytes) TCP bind
>>> hash table entries: 4096 (order: 5, 147456 bytes)
>>> TCP: Hash tables configured (established 4096 bind 4096)
>>> TCP: reno registered
>>> UDP hash table entries: 64 (order: 0, 5120 bytes) UDP-Lite hash table
>>> entries: 64 (order: 0, 5120 bytes)
>>> NET: Registered protocol family 1
>>> RPC: Registered named UNIX socket transport module.
>>> RPC: Registered udp transport module.
>>> RPC: Registered tcp transport module.
>>> RPC: Registered tcp NFSv4.1 backchannel transport module.
>>> NFS: Registering the id_resolver key type
>>> jffs2: version 2.2. (NAND) (SUMMARY)   © 2001-2006 Red Hat, Inc.
>>> msgmni has been set to 234
>>> Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
>>> io scheduler noop registered (default)
>>> fffff200.serial: ttyS0 at MMIO 0xfffff200 (irq = 1) is a ATMEL_SERIAL
>>> console [ttyS0] enabled
>>> f801c000.serial: ttyS1 at MMIO 0xf801c000 (irq = 5) is a ATMEL_SERIAL
>>> f8020000.serial: ttyS2 at MMIO 0xf8020000 (irq = 6) is a ATMEL_SERIAL
>>> f8028000.serial: ttyS4 at MMIO 0xf8028000 (irq = 8) is a ATMEL_SERIAL
>>> brd: module loaded
>>> loop: module loaded
>>> mtdoops: mtd device (mtddev=name/number) must be supplied
>>> atmel_nand: Use On Flash BBT
>>> atmel_nand 40000000.nand: No DMA support for NAND access.
>>> ONFI param page 0 valid
>>> ONFI flash detected
>>> NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda (Micron
>>> MT29F2G08AAD)
>> Here, when PMECC is really enabled, the driver should show following
>> message:
>>      atmel_nand 40000000.nand: Initialize PMECC params, cap: 2, sector:
>> 512
>>
>> But your 3.4's log doesn't have it. If the dtb is right then maybe the
>> issue is caused in the driver?
>>
>> Can you check your 3.4 kernel code, make sure the function
>> atmel_pmecc_nand_init_params() is called or not?
>>
>> Best Regards,
>> Josh Wu
>>
>>> Bad block table found at page 131008, version 0x01 Bad block table
>>> found at page 130944, version 0x01
>>> nand_read_bbt: bad block at 0x000009380000
>>> 2 cmdlinepart partitions found on MTD device atmel_nand Creating 2
>> MTD
>>> partitions on "atmel_nand":
>>> 0x000000000000-0x000000800000 : "bootstrap/uboot/kernel"
>>> 0x000000800000-0x000010000000 : "rootfs"
>>> UBI: attaching mtd1 to ubi0
>>> UBI: physical eraseblock size:   131072 bytes (128 KiB)
>>> UBI: logical eraseblock size:    126976 bytes
>>> UBI: smallest flash I/O unit:    2048
>>> UBI: VID header offset:          2048 (aligned 2048)
>>> UBI: data offset:                4096
>>> UBI: max. sequence number:       4249
>>> UBI warning: print_rsvd_warning: cannot reserve enough PEBs for bad
>>> PEB handling , reserved 15, need 19
>>> UBI: attached mtd1 to ubi0
>>> UBI: MTD device name:            "rootfs"
>>> UBI: MTD device size:            248 MiB
>>> UBI: number of good PEBs:        1979
>>> UBI: number of bad PEBs:         5
>>> UBI: number of corrupted PEBs:   0
>>> UBI: max. allowed volumes:       128
>>> UBI: wear-leveling threshold:    4096
>>> UBI: number of internal volumes: 1
>>> UBI: number of user volumes:     1
>>> UBI: available PEBs:             0
>>> UBI: total number of reserved PEBs: 1979
>>> UBI: number of PEBs reserved for bad PEB handling: 15
>>> UBI: max/mean erase counter: 5/2
>>> UBI: image sequence number:  191777507
>>> UBI: background thread "ubi_bgt0d" started, PID 31 UBI error:
>>> ubi_init: cannot attach mtd1
>>> tun: Universal TUN/TAP device driver, 1.6
>>> tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com> macb
>>> f802c000.ethernet: (unregistered net_device): invalid hw address,
>>> using ran dom
>>> MACB_mii_bus: probed
>>> macb f802c000.ethernet: eth0: Cadence MACB at 0xf802c000 irq 24
>> (4a:15:f4:49:94:
>>> a4)
>>> macb f802c000.ethernet: eth0: attached PHY driver [Davicom DM9161A]
>>> (mii_bus:phy _addr=f802c000.etherne:00, irq=-1) PPP generic driver
>>> version 2.4.2
>>> NET: Registered protocol family 24
>>> usbcore: registered new interface driver asix
>>> usbcore: registered new interface driver cdc_ether
>>> usbcore: registered new interface driver cdc_eem
>>> usbcore: registered new interface driver net1080
>>> usbcore: registered new interface driver cdc_subset
>>> usbcore: registered new interface driver zaurus
>>> usbcore: registered new interface driver ipheth
>>> usbcore: registered new interface driver cdc_ncm
>>> ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver atmel-ehci
>>> 700000.ehci: Atmel EHCI UHP HS atmel-ehci 700000.ehci: new USB bus
>>> registered, assigned bus number 1 atmel-ehci 700000.ehci: irq 22, io
>>> mem 0x00700000 atmel-ehci 700000.ehci: USB 2.0 started, EHCI 1.00 usb
>>> usb1: New USB device found, idVendor=1d6b, idProduct=0002 usb usb1:
>>> New USB device strings: Mfr=3, Product=2, SerialNumber=1 usb usb1:
>>> Product: Atmel EHCI UHP HS usb usb1: Manufacturer: Linux 3.4.0
>>> ehci_hcd usb usb1: SerialNumber: 700000.ehci hub 1-0:1.0: USB hub
>>> found hub 1-0:1.0: 3 ports detected
>>> ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver at91_ohci
>>> 600000.ohci: AT91 OHCI at91_ohci 600000.ohci: new USB bus registered,
>>> assigned bus number 2 at91_ohci 600000.ohci: irq 22, io mem
>> 0x00600000
>>> usb usb2: New USB device found, idVendor=1d6b, idProduct=0001 usb
>>> usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1 usb
>>> usb2: Product: AT91 OHCI usb usb2: Manufacturer: Linux 3.4.0 ohci_hcd
>>> usb usb2: SerialNumber: at91 hub 2-0:1.0: USB hub found hub 2-0:1.0:
>> 2
>>> ports detected
>>> usbcore: registered new interface driver cdc_acm
>>> cdc_acm: USB Abstract Control Model driver for USB modems and ISDN
>>> adapters Initializing USB Mass Storage driver...
>>> usbcore: registered new interface driver usb-storage USB Mass Storage
>>> support registered.
>>> usbcore: registered new interface driver libusual
>>> usbcore: registered new interface driver usbserial
>>> usbcore: registered new interface driver usbserial_generic USB Serial
>>> support registered for generic
>>> usbserial: USB Serial Driver core
>>> usbcore: registered new interface driver moto-modem USB Serial
>> support
>>> registered for moto-modem
>>> usbcore: registered new interface driver opticon USB Serial support
>>> registered for opticon
>>> usbcore: registered new interface driver pl2303 USB Serial support
>>> registered for pl2303
>>> usbcore: registered new interface driver qcserial USB Serial support
>>> registered for Qualcomm USB modem
>>> usbcore: registered new interface driver symbol USB Serial support
>>> registered for symbol i2c /dev entries driver
>>> usbcore: registered new interface driver usbhid
>>> usbhid: USB HID core driver
>>> nf_conntrack version 0.5.0 (1872 buckets, 7488 max)
>>> IPv4 over IPv4 tunneling driver
>>> ip_tables: (C) 2000-2006 Netfilter Core Team
>>> TCP: cubic registered
>>> NET: Registered protocol family 17
>>> lib80211: common routines for IEEE802.11 drivers Registering the
>>> dns_resolver key type
>>> drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
>>> UBIFS: recovery needed
>>> UBIFS: recovery completed
>>> UBIFS: mounted UBI device 0, volume 0, name "rootfs"
>>> UBIFS: file system size:   247476224 bytes (241676 KiB, 236 MiB, 1949
>> LEBs)
>>> UBIFS: journal size:       9023488 bytes (8812 KiB, 8 MiB, 72 LEBs)
>>> UBIFS: media format:       w4/r0 (latest is w4/r0)
>>> UBIFS: default compressor: lzo
>>> UBIFS: reserved for root:  0 bytes (0 KiB)
>>> VFS: Mounted root (ubifs filesystem) on device 0:11.
>>> devtmpfs: mounted
>>> Freeing init memory: 144K
>>> INIT: version 2.86 booting
>>> Please wait: booting...
>>> Starting udev
>>> udev[62]: starting version 165
>>> Root filesystem already rw, not remounting Caching udev devnodes
>>> Populating dev cache
>>> logger: mount: mount point /proc/bus/usb does not exist
>>> ALSA: Restoring mixer settings...
>>> /usr/sbin/alsactl: load_state:1625: No soundcards found...
>>> Configuring network interfaces... eth0      no wireless extensions.
>>>
>>> udhcpc (v1.18.3) started
>>> run-parts: /etc/udhcpc.d/00avahi-autoipd exited with code 1 Sending
>>> discover...
>>> Sending discover...
>>> Sending discover...
>>> netlink: 12 bytes leftover after parsing attributes.
>>> netlink: 12 bytes leftover after parsing attributes.
>>> netlink: 12 bytes leftover after parsing attributes.
>>> No lease, failing
>>> done.
>>> Starting portmap daemon: portmap.
>>> net.ipv4.conf.default.rp_filter = 1
>>> net.ipv4.conf.all.rp_filter = 1
>>> kernel.panic = 10
>>> hwclock: can't open '/dev/misc/rtc': No such file or directory Mon
>> Nov
>>> 5 09:47:00 EST 2012
>>> hwclock: can't open '/dev/misc/rtc': No such file or directory
>>> INIT: Entering runlevel: 5
>>> Starting system message bus: dbus.
>>> Starting Dropbear SSH server: dropbear.
>>> starting Busybox HTTP Daemon: httpd... done.
>>> Starting Vixie-cron.
>>> Starting ntpd: done
>>> Starting syslogd/klogd: done
>>>    * Starting Avahi mDNS/DNS-SD Daemon: avahi-daemon
>>>      ...done.
>>>
>>>>> I noticed over at the linux-at91 fork that you had applied the
>> PMECC
>>>>> support on the 3.4.x_pmecc_dt_9x5 branch a few months ago.  From
>>>>> browsing the mainline I didn't see some of your changes from that
>>>>> branch in the mainline.  Are there some changes from the linux-at91
>>>> fork that are still scheduled for mainlining?
>>>> yes, this patch is not push to mainline yet. Currently the only
>>>> concern is we are think about the PMECC error correct bits need to
>>>> adjust by ONFI parameters that read from nand flash.
>>>> But it is not decide yet. if no exception, this patch will push to
>>>> mainline soon.
>>>>
>>>> Best Regards,
>>>> Josh Wu
>>>>
>>>>> If it helps, here is the boot log when I tried to boot using a 3.7-
>>>> rc8
>>>>> kernel and DT.
>>>>>
>>>>> Thanks,
>>>>> Bryan
>>>>>
>>>>> Uncompressing Linux... done, booting the kernel.
>>>>> [    0.000000] Booting Linux on physical CPU 0
>>>>> [    0.000000] Linux version 3.7.0-rc8-armv5-x0.16 (xxxx@xxxx) (gcc
>>>> versio
>>>>> n 4.6.2 20121016 (release) [ARM/embedded-4_6-branch revision
>> 192487]
>>>>> (GNU Tools for ARM Embedded Processors) ) #1 Wed Dec 5 16:11:30 EST
>>>> 2012
>>>>> [    0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ),
>>>> cr=00053177
>>>>> [    0.000000] CPU: VIVT data cache, VIVT instruction cache
>>>>> [    0.000000] Machine: Atmel AT91SAM (Device Tree), model: Atmel
>>>> AT91SAM9G25-EK
>>>>> [    0.000000] Memory policy: ECC disabled, Data cache writeback
>>>>> [    0.000000] AT91: Detected soc type: at91sam9x5
>>>>> [    0.000000] AT91: Detected soc subtype: at91sam9g25
>>>>> [    0.000000] AT91: sram at 0x300000 of 0x8000 mapped at
>> 0xfef70000
>>>>> [    0.000000] Clocks: CPU 400 MHz, master 133 MHz, main 12.000 MHz
>>>>> [    0.000000] Built 1 zonelists in Zone order, mobility grouping
>> on.
>>>> Total pag
>>>>> es: 32512
>>>>> [    0.000000] Kernel command line: mem=128M console=ttyS0,115200
>>>> mtdparts=atmel
>>>>> _nand:8M(bootstrap/uboot/kernel)ro,-(rootfs) root=/dev/mtdblock1 rw
>>>>> rootfstype=u bifs ubi.mtd=1 root=ubi0:rootfs
>>>>> [    0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)
>>>>> [    0.000000] Dentry cache hash table entries: 16384 (order: 4,
>>>> 65536 bytes)
>>>>> [    0.000000] Inode-cache hash table entries: 8192 (order: 3,
>> 32768
>>>> bytes)
>>>>> [    0.000000] Memory: 128MB = 128MB total
>>>>> [    0.000000] Memory: 124276k/124276k available, 6796k reserved,
>> 0K
>>>> highmem
>>>>> [    0.000000] Virtual kernel memory layout:
>>>>> [    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
>>>>> [    0.000000]     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
>>>>> [    0.000000]     vmalloc : 0xc8800000 - 0xff000000   ( 872 MB)
>>>>> [    0.000000]     lowmem  : 0xc0000000 - 0xc8000000   ( 128 MB)
>>>>> [    0.000000]     modules : 0xbf000000 - 0xc0000000   (  16 MB)
>>>>> [    0.000000]       .text : 0xc0008000 - 0xc04b8630   (4802 kB)
>>>>> [    0.000000]       .init : 0xc04b9000 - 0xc04e45c4   ( 174 kB)
>>>>> [    0.000000]       .data : 0xc04e6000 - 0xc0516ce0   ( 196 kB)
>>>>> [    0.000000]        .bss : 0xc0516d04 - 0xc05760bc   ( 381 kB)
>>>>> [    0.000000] NR_IRQS:16 nr_irqs:16 16
>>>>> [    0.000000] sched_clock: 32 bits at 256 Hz, resolution
>> 3906250ns,
>>>> wraps every
>>>>>     3892314108ms
>>>>> [    0.000000] Console: colour dummy device 80x30
>>>>> [    0.035156] Calibrating delay loop... 199.80 BogoMIPS
>> (lpj=389120)
>>>>> [    0.035156] pid_max: default: 32768 minimum: 301
>>>>> [    0.035156] Mount-cache hash table entries: 512
>>>>> [    0.039062] CPU: Testing write buffer coherency: ok
>>>>> [    0.039062] Setting up static identity map for 0x20371d48 -
>>>> 0x20371da0
>>>>> [    0.039062] devtmpfs: initialized
>>>>> [    0.042968] NET: Registered protocol family 16
>>>>> [    0.042968] DMA: preallocated 256 KiB pool for atomic coherent
>>>> allocations
>>>>> [    0.070312] No ATAGs?
>>>>> [    0.070312] AT91: Power Management
>>>>> [    0.070312] AT91: Starting after power-restored wakeup
>>>>> [    0.121093] bio: create slab <bio-0> at 0
>>>>> [    0.125000] SCSI subsystem initialized
>>>>> [    0.128906] usbcore: registered new interface driver usbfs
>>>>> [    0.128906] usbcore: registered new interface driver hub
>>>>> [    0.128906] usbcore: registered new device driver usb
>>>>> [    0.132812] at91_i2c f8010000.i2c: AT91 i2c bus driver.
>>>>> [    0.132812] at91_i2c f8014000.i2c: AT91 i2c bus driver.
>>>>> [    0.136718] at91_i2c f8018000.i2c: AT91 i2c bus driver.
>>>>> [    0.140625] Switching to clocksource tcb_clksrc
>>>>> [    0.195312] NET: Registered protocol family 2
>>>>> [    0.199218] TCP established hash table entries: 4096 (order: 3,
>>>> 32768 bytes)
>>>>> [    0.199218] TCP bind hash table entries: 4096 (order: 2, 16384
>>>> bytes)
>>>>> [    0.199218] TCP: Hash tables configured (established 4096 bind
>>>> 4096)
>>>>> [    0.199218] TCP: reno registered
>>>>> [    0.199218] UDP hash table entries: 256 (order: 0, 4096 bytes)
>>>>> [    0.199218] UDP-Lite hash table entries: 256 (order: 0, 4096
>>>> bytes)
>>>>> [    0.199218] NET: Registered protocol family 1
>>>>> [    0.199218] RPC: Registered named UNIX socket transport module.
>>>>> [    0.199218] RPC: Registered udp transport module.
>>>>> [    0.199218] RPC: Registered tcp transport module.
>>>>> [    0.199218] RPC: Registered tcp NFSv4.1 backchannel transport
>>>> module.
>>>>> [    0.207031] NFS: Registering the id_resolver key type
>>>>> [    0.207031] Key type id_resolver registered
>>>>> [    0.207031] Key type id_legacy registered
>>>>> [    0.207031] jffs2: version 2.2. (NAND) �© 2001-2006 Red Hat,
>>>> Inc.
>>>>> [    0.207031] msgmni has been set to 242
>>>>> [    0.210937] io scheduler noop registered (default)
>>>>> [    0.218750] fffff200.serial: ttyS0 at MMIO 0xfffff200 (irq = 18)
>>>> is a ATMEL_S
>>>>> ERIAL
>>>>> [    0.609375] console [ttyS0] enabled
>>>>> [    0.613281] f801c000.serial: ttyS1 at MMIO 0xf801c000 (irq = 22)
>>>> is a ATMEL_S
>>>>> ERIAL
>>>>> [    0.632812] brd: module loaded
>>>>> [    0.652343] loop: module loaded
>>>>> [    0.667968] atmel_nand: Use On Flash BBT
>>>>> [    0.671875] atmel_nand 40000000.nand: No DMA support for NAND
>>>> access.
>>>>> [    0.675781] ONFI param page 0 valid
>>>>> [    0.679687] ONFI flash detected
>>>>> [    0.683593] NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda
>>>> (Micron MT29F2G
>>>>> 08AAD), page size: 2048, OOB size: 64
>>>>> [    0.695312] atmel_nand 40000000.nand: Initialize PMECC params,
>>>> cap: 2, sector
>>>>> : 512
>>>>> [    0.703125] Bad block table found at page 131008, version 0x01
>>>>> [    0.707031] Bad block table found at page 130944, version 0x01
>>>>> [    0.714843] nand_read_bbt: bad block at 0x000009380000
>>>>> [    0.718750] 2 cmdlinepart partitions found on MTD device
>>>> atmel_nand
>>>>> [    0.726562] Creating 2 MTD partitions on "atmel_nand":
>>>>> [    0.730468] 0x000000000000-0x000000800000 :
>>>> "bootstrap/uboot/kernel"
>>>>> [    0.742187] 0x000000800000-0x000010000000 : "rootfs"
>>>>> [    0.757812] macb f802c000.ethernet (unregistered net_device):
>>>> invalid hw addr
>>>>> ess, using random
>>>>> [    0.773437] libphy: MACB_mii_bus: probed
>>>>> [    0.777343] macb f802c000.ethernet eth0: Cadence MACB at
>>>> 0xf802c000 irq 23 (c
>>>>> a:2c:e6:c3:59:8f)
>>>>> [    0.785156] macb f802c000.ethernet eth0: attached PHY driver
>>>> [Davicom DM9161A
>>>>> ] (mii_bus:phy_addr=f802c000.etherne:00, irq=-1)
>>>>> [    0.796875] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI)
>>>> Driver
>>>>> [    0.804687] atmel-ehci 700000.ehci: Atmel EHCI UHP HS
>>>>> [    0.808593] atmel-ehci 700000.ehci: new USB bus registered,
>>>> assigned bus numb
>>>>> er 1
>>>>> [    0.816406] atmel-ehci 700000.ehci: irq 28, io mem 0x00700000
>>>>> [    0.835937] atmel-ehci 700000.ehci: USB 2.0 started, EHCI 1.00
>>>>> [    0.839843] usb usb1: New USB device found, idVendor=1d6b,
>>>> idProduct=0002
>>>>> [    0.847656] usb usb1: New USB device strings: Mfr=3, Product=2,
>>>> SerialNumber=
>>>>> 1
>>>>> [    0.855468] usb usb1: Product: Atmel EHCI UHP HS
>>>>> [    0.859375] usb usb1: Manufacturer: Linux 3.7.0-rc8-armv5-x0.16
>>>> ehci_hcd
>>>>> [    0.867187] usb usb1: SerialNumber: 700000.ehci
>>>>> [    0.871093] hub 1-0:1.0: USB hub found
>>>>> [    0.875000] hub 1-0:1.0: 3 ports detected
>>>>> [    0.878906] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI)
>> Driver
>>>>> [    0.886718] at91_ohci 600000.ohci: AT91 OHCI
>>>>> [    0.890625] at91_ohci 600000.ohci: new USB bus registered,
>>>> assigned bus numbe
>>>>> r 2
>>>>> [    0.898437] at91_ohci 600000.ohci: irq 28, io mem 0x00600000
>>>>> [    0.964843] usb usb2: New USB device found, idVendor=1d6b,
>>>> idProduct=0001
>>>>> [    0.968750] usb usb2: New USB device strings: Mfr=3, Product=2,
>>>> SerialNumber=
>>>>> 1
>>>>> [    0.976562] usb usb2: Product: AT91 OHCI
>>>>> [    0.980468] usb usb2: Manufacturer: Linux 3.7.0-rc8-armv5-x0.16
>>>> ohci_hcd
>>>>> [    0.988281] usb usb2: SerialNumber: at91
>>>>> [    0.992187] hub 2-0:1.0: USB hub found
>>>>> [    0.996093] hub 2-0:1.0: 2 ports detected
>>>>> [    1.003906] usbcore: registered new interface driver cdc_acm
>>>>> [    1.007812] cdc_acm: USB Abstract Control Model driver for USB
>>>> modems and ISD
>>>>> N adapters
>>>>> [    1.019531] usbcore: registered new interface driver uas
>>>>> [    1.023437] Initializing USB Mass Storage driver...
>>>>> [    1.027343] usbcore: registered new interface driver usb-storage
>>>>> [    1.035156] USB Mass Storage support registered.
>>>>> [    1.039062] usbcore: registered new interface driver ums-alauda
>>>>> [    1.046875] usbcore: registered new interface driver ums-cypress
>>>>> [    1.054687] usbcore: registered new interface driver ums-datafab
>>>>> [    1.058593] usbcore: registered new interface driver
>> ums_eneub6250
>>>>> [    1.066406] usbcore: registered new interface driver ums-freecom
>>>>> [    1.074218] usbcore: registered new interface driver ums-isd200
>>>>> [    1.078125] usbcore: registered new interface driver ums-
>> jumpshot
>>>>> [    1.085937] usbcore: registered new interface driver ums-karma
>>>>> [    1.093750] usbcore: registered new interface driver ums-
>> onetouch
>>>>> [    1.097656] usbcore: registered new interface driver ums-realtek
>>>>> [    1.105468] usbcore: registered new interface driver ums-sddr09
>>>>> [    1.113281] usbcore: registered new interface driver ums-sddr55
>>>>> [    1.117187] usbcore: registered new interface driver ums-usbat
>>>>> [    1.125000] usbcore: registered new interface driver usbserial
>>>>> [    1.132812] usbcore: registered new interface driver
>>>> usbserial_generic
>>>>> [    1.140625] usbserial: USB Serial support registered for generic
>>>>> [    1.144531] usbcore: registered new interface driver ftdi_sio
>>>>> [    1.152343] usbserial: USB Serial support registered for FTDI
>> USB
>>>> Serial Devi
>>>>> ce
>>>>> [    1.160156] usbcore: registered new interface driver pl2303
>>>>> [    1.167968] usbserial: USB Serial support registered for pl2303
>>>>> [    1.171875] mousedev: PS/2 mouse device common for all mice
>>>>> [    1.179687] i2c /dev entries driver
>>>>> [    1.191406] usbcore: registered new interface driver usbhid
>>>>> [    1.199218] usbhid: USB HID core driver
>>>>> [    1.207031] usb 1-2: new high-speed USB device number 2 using
>>>> atmel-ehci
>>>>> [    1.214843] TCP: cubic registered
>>>>> [    1.218750] NET: Registered protocol family 10
>>>>> [    1.222656] sit: IPv6 over IPv4 tunneling driver
>>>>> [    1.230468] NET: Registered protocol family 17
>>>>> [    1.234375] Key type dns_resolver registered
>>>>> [    1.246093] UBI: attaching mtd1 to ubi0
>>>>> [    1.253906] atmel_nand 40000000.nand: PMECC: Too many errors
>>>>> [    1.261718] UBI warning: ubi_io_read: error -5 while reading 64
>>>> bytes from PE
>>>>> B 10:0, read only 0 bytes, retry
>>>>> [    1.269531] atmel_nand 40000000.nand: PMECC: Too many errors
>>>>> [    1.277343] UBI warning: ubi_io_read: error -5 while reading 64
>>>> bytes from PE
>>>>> B 10:0, read only 0 bytes, retry
>>>>> [    1.285156] atmel_nand 40000000.nand: PMECC: Too many errors
>>>>> [    1.292968] UBI warning: ubi_io_read: error -5 while reading 64
>>>> bytes from PE
>>>>> B 10:0, read only 0 bytes, retry
>>>>> [    1.304687] atmel_nand 40000000.nand: PMECC: Too many errors
>>>>> [    1.308593] UBI error: ubi_io_read: error -5 while reading 64
>>>> bytes from PEB
>>>>> 10:0, read 0 bytes
>>>>> [    1.316406] [<c000d2bc>] (unwind_backtrace+0x0/0xe0) from
>>>> [<c0243a10>] (ubi_i
>>>>> o_read+0x1d4/0x2a4)
>>>>> [    1.328125] [<c0243a10>] (ubi_io_read+0x1d4/0x2a4) from
>>>> [<c0243d20>] (ubi_io_
>>>>> read_ec_hdr+0x68/0x214)
>>>>> [    1.335937] [<c0243d20>] (ubi_io_read_ec_hdr+0x68/0x214) from
>>>> [<c024804c>] (u
>>>>> bi_attach+0x104/0x13e4)
>>>>> [    1.343750] [<c024804c>] (ubi_attach+0x104/0x13e4) from
>>>> [<c023e514>] (ubi_att
>>>>> ach_mtd_dev+0x5a4/0xb94)
>>>>> [    1.355468] [<c023e514>] (ubi_attach_mtd_dev+0x5a4/0xb94) from
>>>> [<c04d09dc>] (
>>>>> ubi_init+0x1d8/0x2d8)
>>>>> [    1.363281] [<c04d09dc>] (ubi_init+0x1d8/0x2d8) from
>> [<c0008860>]
>>>> (do_one_ini
>>>>> tcall+0x90/0x168)
>>>>> [    1.371093] [<c0008860>] (do_one_initcall+0x90/0x168) from
>>>> [<c03686a4>] (kern
>>>>> el_init+0xe8/0x2a0)
>>>>> [    1.378906] [<c03686a4>] (kernel_init+0xe8/0x2a0) from
>>>> [<c00093f0>] (ret_from
>>>>> _fork+0x14/0x24)
>>>>> [    1.386718] UBI error: ubi_attach_mtd_dev: failed to attach
>> mtd1,
>>>> error -5
>>>>> [    1.394531] UBI error: ubi_init: cannot attach mtd1
>>>>> [    1.402343] drivers/rtc/hctosys.c: unable to open rtc device
>>>> (rtc0)
>>>>> [    1.410156] UBIFS error (pid 1): ubifs_mount: cannot open
>>>> "ubi0:rootfs", erro
>>>>> r -19
>>>>> [    1.417968] VFS: Cannot open root device "ubi0:rootfs" or
>> unknown-
>>>> block(0,0):
>>>>>     error -19
>>>>> [    1.425781] Please append a correct "root=" boot option; here
>> are
>>>> the availab
>>>>> le partitions:
>>>>> [    1.433593] 1f00            8192 mtdblock0  (driver?)
>>>>> [    1.437500] 1f01          253952 mtdblock1  (driver?)
>>>>> [    1.441406] Kernel panic - not syncing: VFS: Unable to mount
>> root
>>>> fs on unkno
>>>>> wn-block(0,0)
>>>>>
>>>>>

Patch

diff --git a/arch/arm/boot/dts/at91sam9x5.dtsi 
b/arch/arm/boot/dts/at91sam9x5.dtsi
index 0cc062b..32ca418 100644
--- a/arch/arm/boot/dts/at91sam9x5.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5.dtsi
@@ -281,7 +281,11 @@ 
              #address-cells = <1>;
              #size-cells = <1>;
              reg = <0x40000000 0x10000000
+                0xffffe000 0x600    /* PMECC Registers */
+                0xffffe600 0x200    /* PMECC Error Location Registers */
+                0x00100000 0x100000    /* ROM code */
                    >;
+            atmel,pmecc-lookup-table-offset = <0x8000 0x10000>;
              atmel,nand-addr-offset = <21>;
              atmel,nand-cmd-offset = <22>;
              gpios = <&pioD 5 0
diff --git a/arch/arm/boot/dts/at91sam9x5cm.dtsi 
b/arch/arm/boot/dts/at91sam9x5cm.dtsi
index 31e7be2..4027ac7 100644
--- a/arch/arm/boot/dts/at91sam9x5cm.dtsi
+++ b/arch/arm/boot/dts/at91sam9x5cm.dtsi
@@ -26,7 +26,10 @@ 
      ahb {
          nand0: nand@40000000 {
              nand-bus-width = <8>;
-            nand-ecc-mode = "soft";
+            nand-ecc-mode = "hw";
+            atmel,has-pmecc;    /* Enable PMECC */
+            atmel,pmecc-cap = <2>;
+            atmel,pmecc-sector-size = <512>;
              nand-on-flash-bbt;
              status = "okay";