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 <msieron@antmicro.com>
This commit is contained in:
parent
90f690ecce
commit
cdc1152162
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue