From f5577aae4aa9f245c4c67308fe0f7b3cecf61c93 Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Tue, 29 Aug 2006 08:04:32 +0200 Subject: Improve DIMM detection for AMCC Yucca 440SPe board Improved the memory DIMM detection for the Yucca 440SPe board for the case where a memory DIMM is falsely detected as present. This issue is seen on some AMCC Yucca 440SPe validation boards if only one 512MB memory DIMM is installed, i.e. DIMM slot 0 is populated and DIMM slot 1 is empty. In this case, U-Boot does not correctly detect that there is only one DIMM memory module installed and will falsely detect two DIMM memory modules are present and therefore U-Boot will not calculate the correct amount of total memory and u-boot will not booting up. Patch by Adam Graham, 24 Aug 2006 --- board/amcc/yucca/yucca.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'board/amcc/yucca/yucca.c') diff --git a/board/amcc/yucca/yucca.c b/board/amcc/yucca/yucca.c index af12839c2c..65f75756c4 100644 --- a/board/amcc/yucca/yucca.c +++ b/board/amcc/yucca/yucca.c @@ -562,10 +562,11 @@ int checkboard (void) static long int yucca_probe_for_dimms(void) { - long int dimm_installed[MAXDIMMS]; - long int dimm_num, probe_result; - long int dimms_found = 0; - uchar dimm_addr = IIC0_DIMM0_ADDR; + int dimm_installed[MAXDIMMS]; + int dimm_num, result; + int dimms_found = 0; + uchar dimm_addr = IIC0_DIMM0_ADDR; + uchar dimm_spd_data[MAX_SPD_BYTES]; for (dimm_num = 0; dimm_num < MAXDIMMS; dimm_num++) { /* check if there is a chip at the dimm address */ @@ -577,12 +578,28 @@ static long int yucca_probe_for_dimms(void) dimm_addr = IIC0_DIMM1_ADDR; break; } - probe_result = i2c_probe(dimm_addr); - if (probe_result == 0) { + result = i2c_probe(dimm_addr); + + memset(dimm_spd_data, 0, MAX_SPD_BYTES * sizeof(char)); + if (result == 0) { + /* read first byte of SPD data, if there is any data */ + result = i2c_read(dimm_addr, 0, 1, dimm_spd_data, 1); + + if (result == 0) { + result = dimm_spd_data[0]; + result = result > MAX_SPD_BYTES ? + MAX_SPD_BYTES : result; + result = i2c_read(dimm_addr, 0, 1, + dimm_spd_data, result); + } + } + + if ((result == 0) && + (dimm_spd_data[64] == MICRON_SPD_JEDEC_ID)) { dimm_installed[dimm_num] = TRUE; dimms_found++; - debug("DIMM slot %d: DDR2 SDRAM detected\n",dimm_num); + debug("DIMM slot %d: DDR2 SDRAM detected\n", dimm_num); } else { dimm_installed[dimm_num] = FALSE; debug("DIMM slot %d: Not populated or cannot sucessfully probe the DIMM\n", dimm_num); -- cgit v1.2.3