This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM335x EVM NAND performance in U-Boot (MT29F2G08AB)

Hi,

I'm designing a product which will use the AM335x and boot from NAND (MT29F2G08AB).  I've used the AM335x EVM to test the time to load the kernel in uboot, and used the "grabserial" to get accurate time values.  For testing, I am booting uboot off SD card (i.e. the default AM335x EVM setup), and then reading NAND data from the uboot prompt.  

The default NAND partition has a 5 MByte partition, and the command "U-Boot# nandecc hw 2; nand read.i ${kloadaddr} ${nand_src_addr} ${nand_img_siz}" takes 5.6 sec to execute, i.e. 0.89 MByte/sec.  (see logs below).

Then I tested reading the same 5 MB partition from Linux, using the command "time dd if=/dev/mtdblock6 bs=131072 of=/dev/null", which took 1.35 sec to execute, i.e. 3.88 MByte/sec.  This is close to the value mentioned in the wiki, which is 3.4 MByte/sec (for UBIFS read instead of raw read).

        http://processors.wiki.ti.com/index.php/AM335x-PSP_04.06.00.08_Features_and_Performance_Guide#NAND_Driver 

The SD card provided with the AM335x EVM is faster still.  In U-Boot, the file "uImage" (3 MByte) loads in 0.34 sec, i.e. 8.4 MByte/sec.

Any suggestions (besides making the kernel partition smaller) of how to speed up U-Boot loading the kernel from NAND?  Why is it 4 times slower than the Linux NAND driver for reading data?  According to Micron, it should be possible to read data at 23 MByte/sec on this device.

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

U-Boot SPL 2011.09 (Apr 08 2012 - 18:29:14)
Texas Instruments Revision detection unimplemented
OMAP SD/MMC: 0
reading u-boot.img
reading u-boot.img


U-Boot 2011.09 (Apr 08 2012 - 18:25:03)

I2C: ready
DRAM: 256 MiB
WARNING: Caches not enabled
Found a daughter card connected
NAND: HW ECC Hamming Code selected
256 MiB
MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1
*** Warning - bad CRC, using default environment

Net: cpsw
Hit any key to stop autoboot: 0
U-Boot# nandecc hw 2; nand read.i ${kloadaddr} ${nand_src_addr} ${nand_img_siz}
HW ECC BCH8 Selected

NAND read: device 0 offset 0x280000, size 0x500000
5242880 bytes read: OK
U-Boot#

  • John,

    You can get much better speeds than this. At least 8MB/sec should be possible. But for that you've to optimize the NAND driver in u-boot.

  • Thanks Renjith.

    I presume you are referring to implementing DMA and pre-fetch in nand_read_buf()?  I would be interested in getting someone with experience to implement this feature into uboot for the am335x.  Can you give me a rough idea of the time/cost involved (e.g. to get > 3 MB/sec from a 8-bit NAND device).

    Regards,

        John.

    e.g. like nand_prefetch.tar.gz for the am35xx from http://e2e.ti.com/support/dsp/sitara_arm174_microprocessors/f/416/t/181498.aspx

  • John,

    I'm not referring to DMA based implementation. I'm referring to optimizing the current polling based read implementation. We can optimize by writing custom assembly code for the nand read function. Using prefetching will also improve the performance. 

  • OK.  By the way, enabling the data cache in "U-Boot 2011.09 (Apr 08 2012 - 18:25:03)" helps.  (It defaults to off).

    E.g.:

    Try dcache on:
    [0.000074 0.000074] dcache on; nandecc hw 2; nand read.i ${kloadaddr} ${nand_src_addr} ${nand_img_siz}
    [0.017764 0.017690] Data (writethrough) Cache is ON
    [0.020815 0.003051] HW ECC BCH8 Selected
    [0.022745 0.001930]
    [0.022800 0.000055] NAND read: device 0 offset 0x280000, size 0x500000
    [3.896361 3.873561] 5242880 bytes read: OK
    [3.898294 0.001933] U-Boot#

    Try dcache off:
    [34.116141 30.217847] Data (writethrough) Cache is OFF
    [34.118215 0.002074] HW ECC BCH8 Selected
    [34.121203 0.002988]
    [34.121259 0.000056] NAND read: device 0 offset 0x280000, size 0x500000
    [40.800031 6.678772] 5242880 bytes read: OK
    [40.802119 0.002088] U-Boot#

    So the speed up from dcache is (6.68-3.87)/(6.68) = 42% faster.

    Also with dcache on, 1-bit software ECC is faster than 8-bit BCH8 hardware ECC!  But I would rather stick with BCH8.

  • John,

    You are roughly getting the throughput of 1.3 MB/sec which is too low according to me. I think its possible to achieve 6-7 MB/sec at least.

  • Hello John,

                   I want to ebable data cache in u-boot.Can you please guide me how to enable cache in uboot?? 

    Thanking you.

    Regards,

    Kishor

  • I think it should be sufficient to add the line "#define CONFIG_CMD_CACHE" to the file "u-boot/include/configs/am335x_evm.h", and rebuild.  

    Then you will have access to a new command "dcache" that you can use at the u-boot command prompt, or add to your u-boot boot command (see CONFIG_BOOTCOMMAND).