upstream u-boot with additional patches for our devices/boards: https://lists.denx.de/pipermail/u-boot/2017-March/282789.html (AXP crashes) ; Gbit ethernet patch for some LIME2 revisions ; with SPI flash support
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
u-boot/common/ddr_spd.c

61 lines
1.2 KiB

/*
* Copyright 2008 Freescale Semiconductor, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* Version 2 as published by the Free Software Foundation.
*/
#include <common.h>
#include <ddr_spd.h>
/* used for ddr1 and ddr2 spd */
static int
spd_check(const u8 *buf, u8 spd_rev, u8 spd_cksum)
{
unsigned int cksum = 0;
unsigned int i;
/*
* Check SPD revision supported
* Rev 1.2 or less supported by this code
*/
if (spd_rev > 0x12) {
printf("SPD revision %02X not supported by this code\n",
spd_rev);
return 1;
}
/*
* Calculate checksum
*/
for (i = 0; i < 63; i++) {
cksum += *buf++;
}
cksum &= 0xFF;
if (cksum != spd_cksum) {
printf("SPD checksum unexpected. "
"Checksum in SPD = %02X, computed SPD = %02X\n",
spd_cksum, cksum);
return 1;
}
return 0;
}
unsigned int
ddr1_spd_check(const ddr1_spd_eeprom_t *spd)
{
const u8 *p = (const u8 *)spd;
return spd_check(p, spd->spd_rev, spd->cksum);
}
unsigned int
ddr2_spd_check(const ddr2_spd_eeprom_t *spd)
{
const u8 *p = (const u8 *)spd;
return spd_check(p, spd->spd_rev, spd->cksum);
}