summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWim Vervoorn <wvervoorn@eltan.com>2020-05-01 13:50:08 +0200
committerPatrick Georgi <pgeorgi@google.com>2020-05-18 07:11:24 +0000
commit30e9149c4fd716a8213cf0b5383774eecdb81829 (patch)
tree095961f82ace5572b07cf34a463683a62e9c0bb1 /src
parent544cc834700590c6c804150f1db81ee31a3bbd30 (diff)
downloadcoreboot-30e9149c4fd716a8213cf0b5383774eecdb81829.tar.xz
soc/intel/common/block/smbus: Use i2c read eeprom to speedup SPD read
Reading the SPD using the SMBUS routines takes a long time because each byte or word is access seperately. Allow using the i2c read eeprom routines to read the SPD. By doing this the start address is only sent once per page. The time required to read a DDR4 SPD is reduced from 200 msec to 50 msec. BUG=N/A TEST=tested on facebook monolith Change-Id: I44e18b8ba72e1b2321f83402a6a055e2be6f940c Signed-off-by: Wim Vervoorn <wvervoorn@eltan.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/40942 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Frans Hendriks <fhendriks@eltan.com>
Diffstat (limited to 'src')
-rw-r--r--src/soc/intel/common/block/smbus/smbuslib.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/soc/intel/common/block/smbus/smbuslib.c b/src/soc/intel/common/block/smbus/smbuslib.c
index 5441b06219..a1a88180f2 100644
--- a/src/soc/intel/common/block/smbus/smbuslib.c
+++ b/src/soc/intel/common/block/smbus/smbuslib.c
@@ -2,6 +2,7 @@
#include <console/console.h>
#include <spd_bin.h>
+#include <device/smbus_def.h>
#include <device/smbus_host.h>
#include <string.h>
#include "smbuslib.h"
@@ -46,14 +47,23 @@ static int get_spd(u8 *spd, u8 addr)
addr << 1);
return -1;
}
- smbus_read_spd(spd, addr);
+
+ if (do_i2c_eeprom_read(SMBUS_IO_BASE, addr, 0, SPD_PAGE_LEN, spd) == SMBUS_ERROR) {
+ printk(BIOS_INFO, "do_i2c_eeprom_read failed, using fallback\n");
+ smbus_read_spd(spd, addr);
+ }
/* Check if module is DDR4, DDR4 spd is 512 byte. */
if (spd[SPD_DRAM_TYPE] == SPD_DRAM_DDR4 &&
CONFIG_DIMM_SPD_SIZE > SPD_PAGE_LEN) {
/* Switch to page 1 */
do_smbus_write_byte(SMBUS_IO_BASE, SPD_PAGE_1, 0, 0);
- smbus_read_spd(spd + SPD_PAGE_LEN, addr);
+
+ if (do_i2c_eeprom_read(SMBUS_IO_BASE, addr, 0, SPD_PAGE_LEN,
+ spd + SPD_PAGE_LEN) == SMBUS_ERROR) {
+ printk(BIOS_INFO, "do_i2c_eeprom_read failed, using fallback\n");
+ smbus_read_spd(spd + SPD_PAGE_LEN, addr);
+ }
/* Restore to page 0 */
do_smbus_write_byte(SMBUS_IO_BASE, SPD_PAGE_0, 0, 0);
}