iMX 8M Mini Register Programming Aid DRAM PLL setting

Document created by asimzaidi Employee on Apr 2, 2020
Version 1Show Document
  • View in full screen mode

The Register Programming Aid (RPA) provides a default DRAM PLL setting (DRAM frequency) based on the default setting supported in u-boot.  It is highly recommended to use the default DRAM frequency settings in the RPA for ease of use and to align with u-boot.  Otherwise, in addition to updating the RPA for the new DRAM frequency, the u-boot SPL code itself will need to be manually updated with the new DRAM PLL setting.

 

Should the user wish to change the DRAM frequency, the following steps are required:

 

  1. First, the user needs to update the RPA Register Configuration worksheet tab

Device Information table “Clock Cycle Freq (MHz)“ setting to the desired DRAM frequency

 

 

 

2. Next, in the RPA DDR stress test file worksheet tab search for “memory set 0x30360054”.  The address “0x30360054” is for the DRAM PLL register address and its setting needs to be updated to the desired frequency. 

 

 

 

Note that there is another place where the DRAM frequency is also updated “freq0 set 0x30360054” but it is automatically updated based on the setting above. 

 

Below is a table of various frequencies to choose from.  For frequencies not listed in the table below, it is up to the user to calculate a new register setting based on the formula:  

 

(24MHz x m)/(p x 2^s)

 

Where “m” represents the PLL_MAIN_DIV, “p” represents the PLL_PRE_DIV, and “s” represents the PLL_POST_DIV. 

NOTE:  The DRAM frequency is double the DRAM PLL frequency

DRAM_freq = DRAM_PLL x 2

 

The DRAM PLL register and bit settings are shown below:

 

 

 

  

The following table provides examples of the various settings to create the desired frequency:

 

 

 

For example, in the i.MX 8M Mini LPDDR4 RPA where the default DRAM frequency is 1500MHz, let’s assume that the user instead wants 1200MHz. 

 

First, the user changes the RPA Register Configuration worksheet tab Device Information table “Clock Cycle Freq (MHz)“ setting to 1200.

 

Next, in the RPA DDR stress test file worksheet tab search for “memory set 0x30360054” and replace “0xFA080” (original setting from DRAM frequency 1500MHz) with “0x0012C032 (updated for DRAM frequency 1200MHz).  Note that for a DRAM frequency of 1200MHz, the DRAM PLL is configured for 600MHz, as the DRAM frequency is double the DRAM_PLL.

 

The steps outlined above are sufficient in order to create a DDR script for use with the DDR stress test tool to run the calibration and execute the DDR stress test.  However, to deploy the generated code in SPL, more steps are needed as the u-boot SPL DDR driver does not automatically change the DRAM PLL according to the generated code. Hence the user will need to manually modify related code in u-boot.  It is highly recommended to work with a software engineer familiar with u-boot when making the following modifications. 

 

3. Modify DRAM PLL configuration in uboot-imx/drivers/ddr/imx8m.c, specifically the code highlighted below (function call dram_pll_init).  Note that the files and file paths in u-boot change frequently, so if this particular file (or file path) does not exist in the current u-boot, simply search for dram_pll_init or ddr_init.

 

void ddr_init(struct dram_timing_info *dram_timing)

{

……

   debug("DDRINFO: cfg clk\n");

     if (is_imx8mq())

          dram_pll_init(DRAM_PLL_OUT_800M);

     else

         dram_pll_init(DRAM_PLL_OUT_750M);

……

 }

 

In the above code, the user should update the macro “DRAM_PLL_OUT_750M with the new DRAM PLL value.  Note that the default DRAM_PLL_OUT_750M results in the DRAM frequency of 1500MHz, where the DRAM frequency is double the DRAM PLL (as previously stated above).

 

For example, if the user desires to run the DRAM at 1200MHz, they would change the above to: dram_pll_init(DRAM_PLL_OUT_600M);

 

Note that DRAM_PLL_OUT_600M is a supported macro in the dram_pll_init() API.  If the desired DRAM PLL configuration does not exist in dram_pll_init(), you will need to add support in uboot-imx/arch/arm/mach-imx/imx8m.c  (as stated above, if this file path does not exist in the current u-boot simply search for dram_pll_init):

 

void dram_pll_init(enum dram_pll_out_val pll_val)

{

……

}

 

Related Links

Attachments

    Outcomes