i.MX53 and u-boot version with USB support and NAND bi-swap function ...

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i.MX53 and u-boot version with USB support and NAND bi-swap function ...

2,577 Views
flaviosuligoi
Contributor IV

Hi all,

I'm using u-boot 2009.08-imx with a custom i.MX53 board.

My board uses the NAND flash and all works good.

Now I want to add the USB support to the u-boot functions, but the 2009.08 version doesn't support the USB.

So I would like to migrate to a new u-boot version, such as the 2013.04, but I think that all others the u-boot versions, except the 2009.08, doesn't have the correct NAND flash support.

In fact only the 2009.08 version has, in the mxc_nand.c device driver file, the following function:

mxc_nand_bi_swap

as suggested in the "NAND Flash Bad Block Management Changes" application note (see attachment).

If the mxc_nand_bi_swap is missed, the Bad Blocks are not correctly managed, and the NAND flash can not work correctly.

Nobody has a fast solution to solve this problem, that is to have USB support and NAND management in the same u-boot?

Thank you and best regards,

Flavio

10 Replies

2,025 Views
fabio_estevam
NXP Employee
NXP Employee

Flavio,

I would recommend you to try the lastest U-boot 2014.10 version.

mx53qsb does not have NAND support on the board, but it does support USB out of the box.

m53evk board from Denx supports both USB and NAND. Looking at include/configs/m53evk.h I see that they use NAND to store the environment variables.

If you have issues with the NAND in U-boot, just send an email with the details of your issue in the U-boot mailing list.

2,025 Views
flaviosuligoi
Contributor IV

Hi Fabio and Igor,

thank you for your help.

I'll use the u-boot 2014.10 version.

Best regards,

Flavio

0 Kudos
Reply

2,025 Views
flaviosuligoi
Contributor IV

Hi Fabio,

only a last question, about what u-boot repository I have to use:

  1. denx from git://git.denx.de/u-boot.git
  2. u-boot-imx from git://git.freescale.com/imx/uboot-imx.git
  3. u-boot-fslc from git://github.com/Freescale/u-boot-imx.git


Best regards,


Flavio

0 Kudos
Reply

2,025 Views
igorpadykov
NXP Employee
NXP Employee

Hi Flavio

you can look at

5.1.2 Building U-Boot | www.denx-cs.de/doku

seems it supports NAND and should USB, as suggested below

I am trying to configure USB Host1 in U-Boot, Please suggest

Best regards

igor

0 Kudos
Reply

2,025 Views
flaviosuligoi
Contributor IV

Hi Igor,

thank you for your info, but I've already seen the post.

The problem is that in the u-boot 2013.04 has not mxc_nand_bi_swap function in driver/mtd/nand/mxc_nand.c file, so the NAND flash bad block management is not correctly managed and it can be cause some malfunctions with the NAND.

Or perhaps the bad block indicator swap is now implemented in another way?

Flavio

0 Kudos
Reply

2,025 Views
igorpadykov
NXP Employee
NXP Employee

Hi Flavio

NAND BBT handing is supported (CONFIG_SYS_NAND_USE_FLASH_BBT)

using concept of "NAND SPL" as refered below

[U-Boot] [PATCH v7 15/19] nand: mxc: Switch NAND SPL to generic SPL

~igor

0 Kudos
Reply

2,025 Views
flaviosuligoi
Contributor IV

Hi Igor,

ok, the u-boot 2013.04 uses the NAND BBT (you must use a BBT management with NAND flash), but I'm speaking about the function to solve the BBI (Bad Block Indicator) problem in the i.MX53 NAND controller, as described in the "NAND Flash Bad Block Management Changes" application note (see the attachment above).

As you can read from the Application Note, a workaround is necessary to use correctly the bad block indicator.

I'm speaking about this function of the mxc_nand.c file (u-boot-2009.08-imx):

static void mxc_nand_bi_swap(struct mtd_info *mtd)

{

    struct nand_chip *this = mtd->priv;

    struct nand_info *info = this->priv;

    u16 ma, sa, nma, nsa;

    if (!IS_LARGE_PAGE_NAND)

        return;

    ma = __raw_readw(BAD_BLK_MARKER_MAIN);

    sa = __raw_readw(BAD_BLK_MARKER_SP);

    nma = (ma & 0xFF00) | (sa >> 8);

    nsa = (sa & 0x00FF) | (ma << 8);

    __raw_writew(nma, BAD_BLK_MARKER_MAIN);

    __raw_writew(nsa, BAD_BLK_MARKER_SP);

}

and this function is not more present in the new versions of u-boot.

My question is if this workaround is implemented with a different algorithm in the new u-boots or, instead, if it was forgotten!

Thank you for your help,

Flavio

0 Kudos
Reply

2,025 Views
igorpadykov
NXP Employee
NXP Employee

Hi Flavio

from my understanding it is not possible to use BBT without

processing BI. Possibly it may be mxc_nand_spl.c:

static int is_badblock(int pagenumber)

{

    int page = pagenumber;

    u32 badblock;

    u32 *src;

    /* Check the first two pages for bad block markers */

    for (page = pagenumber; page < pagenumber + 2; page++) {

        nfc_nand_read_page(page);

        src = (u32 *)&nfc->spare_area[0][0];

        /*

         * IMPORTANT NOTE: The nand flash controller uses a non-

         * standard layout for large page devices. This can

         * affect the position of the bad block marker.

         */

        /* Get the bad block marker */

        badblock = readl(&src[CONFIG_SYS_NAND_BAD_BLOCK_POS / 4]);

        badblock >>= 8 * (CONFIG_SYS_NAND_BAD_BLOCK_POS % 4);

        badblock &= 0xff;

        /* bad block marker verify */

        if (badblock != 0xff)

            return 1; /* potential bad block */

    }

    return 0;

}

static int nand_load(unsigned int from, unsigned int size, unsigned char *buf)

...

~igor

0 Kudos
Reply

2,025 Views
flaviosuligoi
Contributor IV

Hi Igor,

the code is rather different... I think that the considerations about BBI contained in the application note "NAND Flash Bad Block Management Changes" are not reported here ...

Best regards,

Flavio

0 Kudos
Reply

2,025 Views
igorpadykov
NXP Employee
NXP Employee

Hi Flavio

seems u-boot 2013.04 mxc_nand.c does not have full

implementation of commands NAND_CMD_PAGEPROG, NAND_CMD_ERASE

(function mxc_nand_command) compared with u-boot-2009.08.

For that reason BI handling is not needed. It just uses existing NAND BBT.

~igor