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.

How to enable cache in U-boot

Hi, All

There are always a warning message on u-boot start:

U-Boot 2013.10 (Jan 06 2014 - 14:10:46)

I2C: ready
DRAM: 256 MiB
WARNING: Caches not enabled
NAND: 256 MiB

I just implement splash bmp display which is slow, so that I believe the cache is NOT enabled really. Thanks for any suggestion to fix the issue. 

Another issue of speed is nand read which take quite a few seconds to load zImage into DDR3. Are there any patch available to speed up nand reading in em335x_evm? Thanks.

BR

Cheng Shi

emtronix

  • I do not have access to my u-boot sources, but I think if you add

    #define CONFIG_CMD_CACHE

    to your am335x_evm.h file and re-build u-boot, you should have the commands to enable cache. I think the command will be dcache on.

    Steve K.

  • Thanks for quick reply Steve. I'll try it soon.

    BR

    Cheng Shi

  • Hi, Steve

    Thanks for your hit. It's required to implement function enable_caches() to enable dcache. With dcache on, speed of splash is quick indeed. 

    BR

    Cheng Shi

  • By default, in the am335x u-boot supplied in the SDK (ti-sdk-am335x-evm-06.00.00.00/board-support/u-boot-2013.01.01-psp06.00.00.00), the instruction cache is enabled and the data cache is disabled.  This is due to DMA coherency issues somewhere in the drivers (see the u-boot git history).  I'm not sure where the problem lies.

    I found that for my configuration (NAND), I could enable dcache in u-boot (but not in u-boot SPL!), and it did speed things up.

  • What I did is to add following code:

    #ifndef CONFIG_SYS_DCACHE_OFF
    void enable_caches(void)
    {
       /* Enable D-cache. I-cache is already enabled in start.S */
       dcache_enable();
    }
    #endif /* CONFIG_SYS_DCACHE_OFF */

    enable_caches() will be called at beginning of board_init_r in u-boot-2013.10, which speed splash indeed. 

  • For a Beaglebone Black do I add this code to arch/arm/lib/cache.c ?? (enable_caches is now a stub)

    Thank you very much for this!! I've been searching for 3 days on how to enable the cache!

  • I just put the following code:

    #ifndef CONFIG_SYS_DCACHE_OFF
    void enable_caches(void)
    {
    /* Enable D-cache. I-cache is already enabled in start.S */
    dcache_enable();
    }
    #endif

    in ../board/ti/am335x/board.c

    Hope it's helpful.

    BR

    Cheng Shi