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 reduce NAND frequency in u-boot

Other Parts Discussed in Thread: DM3730

Hi All,

We are using custom board with Gingerbread Android OS with kernel version 2.6.37 with variscite SOM of VAR-SOM-OM37 (DM3730). I want to reduce NAND frequency in u-boot. Can anyone guide me, how to do that?

Thanks,

Naresh

  • Hi Naresh,
    Could you share the u-boot and x-loader versions which you are using?

    BR
    Tsvetolin Shulev
  • Hi Tsvetolin Shulev,

    Texas Instruments X-Loader 1.46 (Feb  2 2015 - 10:42:04)

    Loading U-boot from SD card...

    Starting X-loader on MMC

    MMC init failed

    SD Does not have images...Hence Booting from NAND...

    U-Boot 2009.11 (Feb 02 2015 - 10:43:14)

    OMAP3630-GP ES2.1, CPU-OPP2 L3-165MHz

    FIO-SOM-OM3xxx Board + LPDDR/NAND

    I2C:   ready

    RAM Configuration:

    Bank #0: 80000000 256 MB

    Bank #1: 90000000  0 kB

    NAND:  512 MiB

    Using default environment

    In:    serial

    Out:   serial

    Err:   serial

    Thanks & Regards,

    Naresh

  • Naresh,

    The NAND is interfaced by the general-purpose memory controller (GPMC). Therefore there are two ways to change the NAND operating frequency:

    • By changing the GPMC_FCLK clock which comes internally from the power, reset, and clockmanagement (PRCM) module and runs at the L3 interconnect frequency.
    • By changing the GPMC.GPMC_CONFIG1_i[1:0] GPMCFCLKDIVIDER bit field whose value divide GPMC_FCLK clock frequency by 1, 2, 3 or 4. This is the simpler way.

    You can change it in the ../x-loader/include/asm/arch-omap3/mem.h file or in the x-loader board init file function int nand_init(void) by changing the M_NAND_GPMC_CONFIG1 macro with the new value.

    You can read about the GPMC_CONFIG1_i register in the DM37xx TRM table 10-49 to configure it with a suitable value.

    BR

    Tsvetolin Shulev

  • Hi Tsvetolin Shulev,

    Thanks a lot for your reply.

    Can you please tell me, where to do the same in u-boot also? Thanks in advance.

    Regards,

    Naresh

  • Hi Tsvetolin Shulev,

    I am using fastboot utility to flash my images into NAND in u-boot. It is taking 2 Minutes 6 Seconds to flash all images. But some times system.img(ubifs type and 75MB) is not writing into NAND properly and I am getting some errors. That is why, I wanted to reduce my NAND frequency.

    I changed NAND frequency by changing the M_NAND_GPMC_CONFIG1 macro with the value of 0x00001803 in u-boot at include/asm-arm/arch-omap3/mem.h which Means GPMC_FCLK will be divided by 4.

    But after reducing NAND frequency with above changes also, It is taking same time 2 Minutes 6 Seconds only to flash all images. It should take some more time, Right? How can i confirm that whether the NAND frequency reduced or not?

    Please give reply. Thanks in advance.

    Regards,

    Naresh

  • Naresh,

    The initialization of the NAND and GPMC should by in the x-loader not in the u-boot. As I read the result of your changes seems that there is no effect on the NAND speed but to verify whether the value is set to the MC_CONFIG1_i register or not I suggest you to read by

    res = __raw_readl(GPMC_CONFIG1 + GPMC_CONFIG_CS0);

    and print its value in the end of the misc_init_r functions of both board files in the x-loader and in the u-boot. (In x-loader's board file the misc_init_r function should be very short). If the printed value of the MC_CONFIG1_i register is not equal to that you set try to set it in the nand_init function in x-loader's board file. For example by changing the:

    __raw_writel( M_NAND_GPMC_CONFIG1, GPMC_CONFIG1 + GPMC_CONFIG_CS0);

    with

    __raw_writel(0x00001803 , GPMC_CONFIG1 + GPMC_CONFIG_CS0);

    BR

    Tsvetolin Shulev

  • Hi Tsvetolin Shulev,

    I wrote 0x1803 in x-loader board file. But when i read back it in u-boot, it is 0x1800. After that i wrote 0x1803 in u-boot board file also. But still the NAND speed is same.

    Can you please guess, what could be the reason? Are we accessing incorrect GPMC_CONFIG[X] registers?

    Please give reply. Thanks in advance.

    Best Regards,

    Naresh

  • Hi Naresh,

    After some investigation I find that the GPMC is configured at two stages - in the x-loader as we discuss yet and in the u-boot /include/asm/arch-omap3/mem.h file:

    #define M_NAND_GPMC_CONFIG1    0x00001801

    I tested with value 0x1 for GPMC_CLK frequency = GPMC_FCLK frequency / 2 and the value is properly applied when read it in the end of misc_init_r function and farther when the Android boots the value is 0x1801.

    The only difference is that I'm using dm3730evm board but it is based on the same processor which you are using.

    BR

    Tsvetolin Shulev

  • Hi Tsvetolin Shulev,

    If you see my fourth reply, I already mentioned that I changed NAND frequency by changing the M_NAND_GPMC_CONFIG1 macro with the value of 0x00001803 in u-boot at include/asm-arm/arch-omap3/mem.h which Means GPMC_FCLK will be divided by 4.

    But after reducing NAND frequency with above changes also, It is taking same time 2 Minutes 6 Seconds only to flash all images. It should take some more time, Right? How can i confirm that whether the NAND frequency reduced or not?

    Thanks,

    Naresh

  • Naresh,

    The most reliable way to check the operating NAND frequency is to connect an oscilloscope on the NAND local bus data pins. Look at the section 4.13 Local bus at the linked document:

     but I'm not familiar with the schematics of VAR-SOM-OM37 board and I'm not sure whether there are test points to connect the oscilloscope.

    BR

    Tsvetolin Shulev

  • Thanks Tsvtolin Shulev,

    Do you want me to measure at any local bus data pin (LB_IO_0 to LB_IO_15) or local bus clock(LB_CLK)?

    Regards,

    Naresh

  • Naresh,
    The local bus clock (LB_CLK) corresponds to the frequency therefore I would like to measure it first. But if the frequency is set correctly I would like to measure the local bus wait (LB_WAIT0) and to collate the wait intervals during various GPMC_CLK values (For example GPMCFCLKDIVIDER = 0 and GPMCFCLKDIVIDER = 3).

    BR
    Tsbetolin Shulev