Skip to contentSkip to conversation

Regarding NAND flash support in IMX31

U-Boot R Arun Kumar 2 participants 5 messages Oct 14, 2009 – Oct 16, 2009

lore
Share & tools
lore
#0 lore raw

Hai

I am trying to port U-boot 2.0.0 for my custom imx31 board and I am able to boot and load linux etc successfully.

I want to add NAND flash support and it is observed that the NAND flash is been detected but with lot of "Bad erase block messages"

Please help

Arun

=========================================

U-Boot 2.0.0-rc9 (Oct 14 2009 - 12:03:04)

Board: Phytec phyCORE-i.MX31
*NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V 8-bi
t)*
Scanning device for bad blocks
*Bad erase block at ....
Bad erase block at ....
Bad erase block at ....
Bad erase block at ....
Bad erase block at ....
Bad erase block at ....
Bad erase block at ....
*
got MAC address from EEPROM: 00:08:EE:01:86:71
mx31 cpu clock: 513MHz
ipg clock : 64133247Hz
Malloc space: 0x87b00000 -> 0x87f00000 (size 4 MB)
Stack space : 0x87af8000 -> 0x87b00000 (size 32 kB)
Open /dev/env0 No such file or directory
no valid environment found on /dev/env0. Using default environment running /env/bin/init...

Hit any key to stop autoboot: 5

type update_kernel nand|nor [<imagename>] to update kernel into flash type update_root nand|nor [<imagename>] to update rootfs into flash

uboot:/

=======================================================

#1 lore raw

Arun,

Quoted 2 lines · R Arun Kumar

I am trying to port U-boot 2.0.0 for my custom imx31 board and I am able to boot and load linux etc successfully.

Does Linux work with your the NAND flash?

Quoted 2 lines

I want to add NAND flash support and it is observed that the NAND flash is been detected but with lot of "Bad erase block messages"

The first time u-boot-v2 detects this NAND? Or after Linux had at least used it one time? Maybe a OOB layout confusion.

Regards,
jbe

Signature · 4 lines
Pengutronix e.K.                              | Juergen Beisert             |
Linux Solutions for Science and Industry      | Phone: +49-8766-939 228     |
Vertretung Sued/Muenchen, Germany             | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686              | http://www.pengutronix.de/  |
#2 lore raw

Hai,

Yes the NAND flash is working fine in linux and i am able to load the filesystem and boot etc.
Since our NOR flash is of small size 2MB and the linux kernel needs to be programmed in NAND, I am trying to use the NAND in uboot for saving the kernel and boot the linux kernel from NAND flash

Arun

Quoted 28 lines · Juergen Beisert

Arun,

Quoted 2 lines · R Arun Kumar

I am trying to port U-boot 2.0.0 for my custom imx31 board and I am able to boot and load linux etc successfully.

Does Linux work with your the NAND flash?

Quoted 1 line

I want to add NAND flash support and it is observed that the NAND flash

is

Quoted 1 line

been detected but with lot of "Bad erase block messages"

The first time u-boot-v2 detects this NAND? Or after Linux had at least used
it one time? Maybe a OOB layout confusion.

Regards,
jbe

--
Pengutronix e.K. | Juergen Beisert
|
Linux Solutions for Science and Industry | Phone: +49-8766-939 228
|
Vertretung Sued/Muenchen, Germany | Fax: +49-5121-206917-5555
|
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de/ |

Signature · 6 lines
R Arun Kumar
+=================================================================+
http://www.paiarunk.net
Happy GoAround Way !!!!!!!!!!!!!!!!!
"Talk is cheap, Show me the code - LINUS TORVALDS"
+=================================================================+
#3 lore raw

Arun,

Quoted 5 lines · R Arun Kumar

Yes the NAND flash is working fine in linux and i am able to load the filesystem and boot etc.
Since our NOR flash is of small size 2MB and the linux kernel needs to be programmed in NAND, I am trying to use the NAND in uboot for saving the kernel and boot the linux kernel from NAND flash

Seems Linux is using a different OOB layout than u-boot does. Compare the OOB layout definition in (u-boot)/drivers/nand/nand_imx.c and (kernel)/drivers/mtd/nand/mxc_nand.c

Regards,
jbe

Signature · 4 lines
Pengutronix e.K.                              | Juergen Beisert             |
Linux Solutions for Science and Industry      | Phone: +49-8766-939 228     |
Vertretung Sued/Muenchen, Germany             | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686              | http://www.pengutronix.de/  |
#4 lore raw

Hai,

The OOB layout of the (u-boot)/drivers/nand/nand_imx.c and (kernel)/drivers/mtd/nand/mxc_nand.c are same.
I think the problem should be in the nand_bbt driver, since we run the command *nand -a /dev/nand0.* *after the *addpart *command. The command *nand -a /dev/nand0.* *seems to be hanging .

u-boot/drivers/nand/nand-imx.c
------------------------------

/*
* OOB placement block for use with hardware ecc generation */

static struct nand_ecclayout nand_hw_eccoob_8 = {
        .eccbytes = 5,
        .eccpos = {6, 7, 8, 9, 10},
        .oobfree = {{0, 5}, {11, 5}}
};
static struct nand_ecclayout nand_hw_eccoob_16 = {
        .eccbytes = 5,
        .eccpos = {6, 7, 8, 9, 10},
        .oobfree = {{0, 6}, {12, 4}}
};

kernel/drivers/mtd/nand/mxc_nd.c
--------------------------------

/*
* OOB placement block for use with hardware ecc generation */

static struct nand_ecclayout nand_hw_eccoob_8 = {
        .eccbytes = 5,
        .eccpos = {6, 7, 8, 9, 10},
        .oobfree = {{0, 5}, {11, 5}}
};
static struct nand_ecclayout nand_hw_eccoob_16 = {
        .eccbytes = 5,
        .eccpos = {6, 7, 8, 9, 10},
        .oobfree = {{0, 6}, {12, 4}}
};

Arun

Quoted 26 lines · Juergen Beisert

Arun,

Quoted 5 lines · R Arun Kumar

Yes the NAND flash is working fine in linux and i am able to load the filesystem and boot etc.
Since our NOR flash is of small size 2MB and the linux kernel needs to be programmed in NAND, I am trying to use the NAND in uboot for saving the kernel and boot the linux kernel from NAND flash

Seems Linux is using a different OOB layout than u-boot does. Compare the OOB
layout definition in (u-boot)/drivers/nand/nand_imx.c and (kernel)/drivers/mtd/nand/mxc_nand.c

Regards,
jbe

--
Pengutronix e.K. | Juergen Beisert
|
Linux Solutions for Science and Industry | Phone: +49-8766-939 228
|
Vertretung Sued/Muenchen, Germany | Fax: +49-5121-206917-5555
|
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de/ |

Signature · 6 lines
R Arun Kumar
+=================================================================+
http://www.paiarunk.net
Happy GoAround Way !!!!!!!!!!!!!!!!!
"Talk is cheap, Show me the code - LINUS TORVALDS"
+=================================================================+