Re: [RFC V3 2/3] ddr_spd: add routune for printing SPD contents in human readable format

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 29 Jun 2015 17:26:56 +0300
Alexander Smirnov <alllecs@xxxxxxxxx> wrote:

> Signed-off-by: Alexander Smirnov <alllecs@xxxxxxxxx>
> ---
>  common/ddr_spd.c  | 239 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  include/ddr_spd.h |   1 +
>  2 files changed, 240 insertions(+)
> 
> diff --git a/common/ddr_spd.c b/common/ddr_spd.c
> index ea0b529..380ea18 100644
> --- a/common/ddr_spd.c
> +++ b/common/ddr_spd.c
> @@ -61,3 +61,242 @@ uint32_t ddr3_spd_checksum_pass(const struct ddr3_spd_eeprom_s *spd)
>  
>  	return 0;
>  }
> +
> +static char *heights[] = {
> +	"<25.4",
> +	"25.4",
> +	"25.4 - 30.0",
> +	"30.0",
> +	"30.5",
> +	"> 30.5"
> +};
> +
> +static char *sdram_voltage_interface_level[] = {
> +	"TTL (5V tolerant)",
> +	"LVTTL (not 5V tolerant)",
> +	"HSTL 1.5V",
> +	"SSTL 3.3V",
> +	"SSTL 2.5V",
> +	"SSTL 1.8V"
> +};
> +
> +static char *ddr2_module_types[] = {
> +	"RDIMM (133.35 mm)",
> +	"UDIMM (133.25 mm)",
> +	"SO-DIMM (67.6 mm)",
> +	"Micro-DIMM (45.5 mm)",
> +	"Mini-RDIMM (82.0 mm)",
> +	"Mini-UDIMM (82.0 mm)"
> +};
> +
> +static char *refresh[] = {
> +	"15.625",
> +	"3.9",
> +	"7.8",
> +	"31.3",
> +	"62.5",
> +	"125"
> +};
> +
> +static char *type_list[] = {
> +	"Reserved",
> +	"FPM DRAM",
> +	"EDO",
> +	"Pipelined Nibble",
> +	"SDR SDRAM",
> +	"Multiplexed ROM",
> +	"DDR SGRAM",
> +	"DDR SDRAM",
> +	"DDR2 SDRAM",
> +	"FB-DIMM",
> +	"FB-DIMM Probe",
> +	"DDR3 SDRAM"
> +};
> +
> +static int funct(uint8_t addr)
> +{
> +	int t;
> +
> +	t = ((addr >> 4) * 10 + (addr & 0xf));
> +
> +	return t;
> +}
> +
> +static int des(uint8_t byte)
> +{
> +	int k;
> +
> +	k = (byte & 0x3) * 10 / 4;
> +
> +	return k;
> +}
> +
> +static int integ(uint8_t byte)
> +{
> +	int k;
> +
> +	k = (byte >> 2);
> +
> +	return k;
> +}
> +
> +static int ddr2_sdram_ctime(uint8_t byte)
> +{
> +	int ctime;
> +
> +	ctime = (byte >> 4) * 100;
> +	if ((byte & 0xf) <= 9)
> +		ctime += (byte & 0xf) * 10;
> +	else if ((byte & 0xf) == 10)
> +		ctime += 25;
> +	else if ((byte & 0xf) == 11)
> +		ctime += 33;
> +	else if ((byte & 0xf) == 12)
> +		ctime += 66;
> +	else if ((byte & 0xf) == 13)
> +		ctime += 75;
> +
> +	return ctime;
> +}
> +
> +void ddr_spd_print(uint8_t *record)
> +{
> +	int highestCAS = 0;
> +	int cas[256];
> +	int i, i_i, k, x, y;
> +	int ddrclk, tbits, pcclk;
> +	int trcd, trp, tras;
> +	int ctime;
> +	uint8_t parity;
> +	char *ref;
> +	struct ddr2_spd_eeprom_s *s = (struct ddr2_spd_eeprom_s *)record;
> +
> +	ctime = ddr2_sdram_ctime(s->clk_cycle);
> +	ddrclk = 2 * (1000 / ctime) * 100;
> +	tbits = ((s->res_7) << 8) + (s->dataw);
> +	if (((s->config) & 0x03) == 1)
> +		tbits = tbits - 8;
> +
> +	pcclk = ddrclk * tbits / 8;
> +	pcclk = pcclk - (pcclk % 100);
> +	i_i = ((s->nrow_addr) & 0x0f) + ((s->ncol_addr) & 0x0f) - 17;
> +	k = (((s->mod_ranks) & 0x7) + 1) * (s->nbanks);
> +	trcd = (((s->trcd) >> 2) + (((s->trcd) & 3) * 0.25)) / ctime * 100;
> +	trp = (((s->trp) >> 2) + (((s->trp) & 3) * 0.25)) / ctime * 100;
> +	tras = (s->tras) * 100 / ctime ;
> +	x = (int)(ctime / 100);
> +	y = (ctime - (int)((ctime / 100) * 100)) / 10;
> +
> +	for (i_i = 2; i_i < 7; i_i++) {
> +		if ((s->cas_lat) & (1 << i_i)) {
> +			highestCAS = i_i;
> +			cas[highestCAS]++;
> +		}
> +	}
> +	printf("---=== SPD EEPROM Information ===---\n");
> +	printf("%-50s OK (0x%0X)\n", "EEPROM Checksum of bytes 0-62", s->cksum);


Hmmmm.
Your checksum is always OK :)

Please use ddr2_spd_checksum_pass().

-- 
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux