In the Initdram function of the/board/freescale/t104xrdb/ddr.c file
phys_size_t initdram (int board_type)
{
Phys_size_tdram_size;
#if defined (config_spl_build) | | !defined (CONFIG_RAMBOOT_PBL)
Puts ("initializing....usingspd\n");
Dram_size= Fsl_ddr_sdram ();
Dram_size = setup_ddr_tlbs (dram_size/0x100000);
Dram_size*= 0x100000;
#else
Dram_size= fsl_ddr_sdram_size ();
#endif
Returndram_size;
}
From the perspective of C language, the process of obtaining the SPD is essentially the process of assigning a value to the dram_size.
#############################################################
Drivers/ddr/fsl/main.c/fsl_ddr_sdram called the __fsl_ddr_compute function
Call the Le Fsl_ddr_compute function in the Drivers/ddr/fsl/main.c/__fsl_ddr_compute function
The function that obtains the SPD information is defined in the Fsl_ddr_compute function.
Case STEP_GET_SPD:
#if defined (CONFIG_DDR_SPD) | | Defined (Config_spd_eeprom)
/*step 1:gather All DIMM SPD data */
for (i = First_ctrl; I <= Last_ctrl; i++) {
FSL_DDR_GET_SPD (Pinfo->spd_installed_dimms[i],i,
Dimm_slots_per_ctrl);
}
#############################################################
The Drivers/ddr/fsl/main.c/fsl_ddr_compute function calls the
The Compute_lowest_common_dimm_parameters function.
Compute_lowest_common_dimm_parameters the function is defined in/DRIVERS/DDR/FSL/LS_COMMON_DIMM_PARAMS.C
In compute_lowest_common_dimm_parameters, the definition prints the detected Udimm 18ksf51272az-1g6k1 that is displayed at Uboot startup, with the following code:
#ifndef Config_spl_build
printf ("Detected Udimm%s\n",
Dimm_params[i].mpart);
#endif
############################################################
The Fsl_ddr_sdram_size function is defined under the/drivers/ddr/fsl/main.c file:
/*
* Fsl_ddr_sdram_size (FIRST_CTRL,LAST_INTLV)-This function is only returns the
* sizeof the total memory without setting DDR control registers.
*/
phys_size_t
Fsl_ddr_sdram_size (void)
{
fsl_ddr_info_t info;
Unsignedlong long total_memory = 0;
memset (&info,0, sizeof (fsl_ddr_info_t));
Info.mem_base = config_sys_fsl_ddr_sdram_base_phy;
Info.first_ctrl= 0;
Info.num_ctrls= Config_sys_fsl_ddr_main_num_ctrls;
Info.dimm_slots_per_ctrl= CONFIG_DIMM_SLOTS_PER_CTLR;
Info.board_need_mem_reset= NULL;
/* Compute it once normally. */
total_memory= Fsl_ddr_compute (&info, STEP_GET_SPD, 1);
Returntotal_memory;
}
The Fsl_ddr_compute function is defined under the same file, which calls the FSL_DDR_GET_SPD function on STEP1 to operate the I²C bus and obtain the SPD information on the DIMM memory strip, as follows:
/* STEP 1:gather all DIMM SPD data */
for (i = First_ctrl; I <= Last_ctrl; i++) {
FSL_DDR_GET_SPD (Pinfo->spd_installed_dimms[i],i,
Dimm_slots_per_ctrl);
}
So fsl_ddr_get_spd is the function that should be the focus of the transplant, or the FSL_DDR_GET_SPD function defined under the/drivers/ddr/fsl/main.c file.
void fsl_ddr_get_spd (generic_spd_eeprom_t *ctrl_dimms_spd,
unsigned int ctrl_num, unsigned int dimm_slots_per_ctrl)
{
}
This empty function is a function that needs attention.
SPD. Porting from DIMM memory stripe i²c device to buckle board Nor_flash