Shaojun Wang

Mx53 nand issue in 1109 BSP and the fix

Discussion created by Shaojun Wang Employee on Mar 4, 2013

1. When boot from nand, uboot may halt at “MMC:   FSL_ESDHC: 0,FSL_ESDHC: 1”, this is because the variable of mmc structure is not initialized, the patch in uboot is

diff --git a/drivers/mmc/imx_esdhc.c b/drivers/mmc/imx_esdhc.c

index a326f87..b6f2816

--- a/drivers/mmc/imx_esdhc.c

+++ b/drivers/mmc/imx_esdhc.c

@@ -554,6 +554,7 @@ int fsl_esdhc_initialize(bd_t *bis, struct fsl_esdhc_cfg *cfg)

 

        mmc = malloc(sizeof(struct mmc));

 

+       mmc->has_init = 0;

        sprintf(mmc->name, "FSL_ESDHC");

        regs = (struct fsl_esdhc *)cfg->esdhc_base;

        mmc->priv = cfg;

 

2. i.MX53 ROM can support redundant boot, the solution and patch is in https://community.freescale.com/message/284659#284659

 

3. When program uboot to nand, should erase boot partition to collect latest bad block information and update the bad block table to DBBT. If the boot partition is mtd0, the command is

$ flash_eraseall /dev/mtd0

 

4. Since bi swap is already supported after MX53 TO2.0, had better enable it in kobs-ng. The patch can be found in step 6.

 

5. Since bi swap is already enabled in kobs-ng, don’t need to set ignorebad to 1. The ucl example is

    <CMD type="push" body="send" file="files/u-boot-mx53.bin">Sending U-Boot</CMD>

    <CMD type="push" body="$ flash_eraseall /dev/mtd0">Erasing uboot partition</CMD>

    <CMD type="push" body="$ kobs-ng init --chip_0_device_path=/dev/mtd0 -v $FILE">Flashing Bootloader</CMD>

 

6. The DBBT FINGERPRINT2 in kobs is not same as the one in MX53 Rom code, so MX53 will not find the DBBT in nand.

    Only MX53 TO1 ROM doesn't support bi swap solution, the kobs-ng in 1109 BSP has bug when setting bi swap.

    Patch 0002-set-dbbt-fingerprint2-to-same-as-mx53-rom-and-enable.patch set the kobs DBBT FINGERPRINT2 to be same as Rom code, and fix the bi swap bug. The kobs-ng binary is also attached.

 

7. When run kobs-ng, add -v parameter, you can see the area of FCB, DBBT, U-BOOT,  below is one example of 2048 bytes/page, 128 pages/block, 4 bits ecc nand.

    …

-------------- Start to write the [ FCB ] -----

mtd: erasing @0:0x0-0x40000

mtd: Writing FCB0 [ @0:0x0 ] (800) *

mtd: Writing FCB1 [ @0:0x20000 ] (800) *

mtd: erasing @0:0x40000-0x80000

mtd: Writing FCB2 [ @0:0x40000 ] (800) *

mtd: Writing FCB3 [ @0:0x60000 ] (800) *

mtd_commit_bcb(FCB): status 0

 

-------------- Start to write the [ DBBT ] -----

mtd: erasing @0:0x80000-0xc0000

mtd: Writing DBBT0 [ @0:0x80000 ] (800) *

mtd: Writing DBBT1 [ @0:0xa0000 ] (800) *

mtd: erasing @0:0xc0000-0x100000

mtd: Writing DBBT2 [ @0:0xc0000 ] (800) *

mtd: Writing DBBT3 [ @0:0xe0000 ] (800) *

mtd_commit_bcb(DBBT): status 0

 

mtd: PUTTING down DBBT0 BBTN0 @0x102000 (0x800)

mtd: PUTTING down DBBT1 BBTN0 @0x142000 (0x800)

mtd: PUTTING down DBBT2 BBTN0 @0x182000 (0x800)

mtd: PUTTING down DBBT3 BBTN0 @0x1c2000 (0x800)

mtd: Writting firmware image #0 @0: 0x00200000 - 0x00238800

mtd: Skipping bad block at 0x200000

mtd: erasing @0:0x240000-0x280000

Since uboot save its environment variable in the micro define of CONFIG_ENV_OFFSET, the value of CONFIG_ENV_OFFSET should not overlay with FCB, DBBT and UBOOT area.


8. Android data partition UBIFS crash issue.

    When cpu loading is heavy, ubifs may crash. The error log look like

        wait_op_done(228): INT not set

        UBIFS error (pid 2489): ubifs_read_node: bad node type (0 but expected 1)

        UBIFS error (pid 2489): ubifs_read_node: bad node at LEB 789:20720

        UBIFS error (pid 2664): ubifs_read_node: bad node type (255 but expected 1)

        UBIFS error (pid 2664): ubifs_read_node: bad node at LEB 26:8288

        UBIFS error (pid 2489): do_readpage: cannot read page 375 of inode 1041, error -22

    When nfc read data from nand, after sent command out, it will call wait_event_timeout in wait_op_done, to wait for the operation to complete. But since cpu loading is heavy, in mxc_nfc_irq, the wake_up event cannot be received in time, so the timeout happen and the issue occur. Attached nfc_time_out_issue.patch can fix this issue.

 

9. Support MT29F8G08ABACA

    This NAND has 4K+224 page size, 64 pages per block, 8 bits ECC. U-boot patch is 0001-support-MT29F8G08ABACA-nand-device-in-uboot.patch, kernel patch is 0001-MT29F8G08ABACA-nand-device-in-kernel.patch.

Original Attachment has been moved to: 0001-support-redundant-boot-from-nand.patch.zip

Original Attachment has been moved to: kobs-ng.zip

Original Attachment has been moved to: 0001-support-MT29F8G08ABACA-nand-device-in-uboot.patch.txt.zip

Original Attachment has been moved to: 0001-MT29F8G08ABACA-nand-device-in-kernel.patch.txt.zip

Original Attachment has been moved to: 0002-set-dbbt-fingerprint2-to-same-as-mx53-rom-and-enable.patch.zip

Original Attachment has been moved to: nfc_time_out_issue.patch.zip

Outcomes