From cdc1152162d5c2bdb773dd31915a7aef4de8f1f0 Mon Sep 17 00:00:00 2001 From: Michal Sieron Date: Thu, 16 Feb 2023 14:27:49 +0100 Subject: [PATCH] liblitedram/sdram_spd: use temp_len when reading SPD This change should change anything from the point of view of `sdram_read_spd` caller, but it makes it so less I2C reads are actually hapenning. With `len` we read too many bytes and write them to the `buf`. In subsequent iterations we overwrite those bytes as all counters are being updated by the `temp_len`. Nothing terrible, but too many bytes were being read. Signed-off-by: Michal Sieron --- litex/soc/software/liblitedram/sdram_spd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litex/soc/software/liblitedram/sdram_spd.c b/litex/soc/software/liblitedram/sdram_spd.c index 9101b7734..b92f6597a 100644 --- a/litex/soc/software/liblitedram/sdram_spd.c +++ b/litex/soc/software/liblitedram/sdram_spd.c @@ -48,7 +48,7 @@ bool sdram_read_spd(uint8_t spd, uint16_t addr, uint8_t *buf, uint16_t len, bool temp_len = len; } - ok &= i2c_read(SPD_RW_ADDR(spd), offset, &buf[read_bytes], len, temp_send_stop, 1); + ok &= i2c_read(SPD_RW_ADDR(spd), offset, &buf[read_bytes], temp_len, temp_send_stop, 1); len -= temp_len; read_bytes += temp_len; addr += temp_len;