* [RFC V2 0/3] add decode command (SPD EEPROM data decoder)
@ 2015-06-24 12:57 Alexander Smirnov
2015-06-24 12:57 ` [RFC V2 1/3] common: move DDR_SPD to common/Kconfig Alexander Smirnov
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Alexander Smirnov @ 2015-06-24 12:57 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox, Alexander Smirnov
Alexander Smirnov (3):
common: move DDR_SPD to common/Kconfig
ddr_spd: add routune for printing SPD contents in human readable
format
add decode command (SPD EEPROM data decoder)
arch/ppc/mach-mpc85xx/Kconfig | 4 -
commands/Kconfig | 7 ++
commands/Makefile | 1 +
commands/decode.c | 65 +++++++++++
common/Kconfig | 4 +
common/ddr_spd.c | 245 ++++++++++++++++++++++++++++++++++++++++++
include/ddr_spd.h | 1 +
7 files changed, 323 insertions(+), 4 deletions(-)
create mode 100644 commands/decode.c
--
2.1.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 8+ messages in thread
* [RFC V2 1/3] common: move DDR_SPD to common/Kconfig
2015-06-24 12:57 [RFC V2 0/3] add decode command (SPD EEPROM data decoder) Alexander Smirnov
@ 2015-06-24 12:57 ` Alexander Smirnov
2015-06-25 9:32 ` Renaud Barbier
2015-06-24 12:57 ` [RFC V2 2/3] ddr_spd: add routune for printing SPD contents in human readable format Alexander Smirnov
2015-06-24 12:57 ` [RFC V2 3/3] add decode command (SPD EEPROM data decoder) Alexander Smirnov
2 siblings, 1 reply; 8+ messages in thread
From: Alexander Smirnov @ 2015-06-24 12:57 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox, Alexander Smirnov
This patch makes it possible to use ddr_spd-related
routines in any arch not only in ppc.
Signed-off-by: Alexander Smirnov <alllecs@yandex.ru>
---
arch/ppc/mach-mpc85xx/Kconfig | 4 ----
common/Kconfig | 4 ++++
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/ppc/mach-mpc85xx/Kconfig b/arch/ppc/mach-mpc85xx/Kconfig
index e29be9c..aa518b9 100644
--- a/arch/ppc/mach-mpc85xx/Kconfig
+++ b/arch/ppc/mach-mpc85xx/Kconfig
@@ -81,10 +81,6 @@ config P1022
config MPC8544
bool
-config DDR_SPD
- bool
- select CRC16
-
config FSL_DDR2
bool
diff --git a/common/Kconfig b/common/Kconfig
index 925fe4b..91e4ef3 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -941,3 +941,7 @@ endmenu
config HAS_DEBUG_LL
bool
+
+config DDR_SPD
+ bool
+ select CRC16
--
2.1.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 8+ messages in thread
* [RFC V2 2/3] ddr_spd: add routune for printing SPD contents in human readable format
2015-06-24 12:57 [RFC V2 0/3] add decode command (SPD EEPROM data decoder) Alexander Smirnov
2015-06-24 12:57 ` [RFC V2 1/3] common: move DDR_SPD to common/Kconfig Alexander Smirnov
@ 2015-06-24 12:57 ` Alexander Smirnov
2015-06-25 6:32 ` Sascha Hauer
2015-06-24 12:57 ` [RFC V2 3/3] add decode command (SPD EEPROM data decoder) Alexander Smirnov
2 siblings, 1 reply; 8+ messages in thread
From: Alexander Smirnov @ 2015-06-24 12:57 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox, Alexander Smirnov
Signed-off-by: Alexander Smirnov <alllecs@yandex.ru>
---
common/ddr_spd.c | 245 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
include/ddr_spd.h | 1 +
2 files changed, 246 insertions(+)
diff --git a/common/ddr_spd.c b/common/ddr_spd.c
index ea0b529..8a98cc4 100644
--- a/common/ddr_spd.c
+++ b/common/ddr_spd.c
@@ -61,3 +61,248 @@ 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 prin(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;
+
+ ctime = ddr2_sdram_ctime(record[9]);
+ ddrclk = 2 * (1000 / ctime) * 100;
+ tbits = (record[7] << 8) + record[6];
+ if ((record[11] & 0x03) == 1) {
+ tbits = tbits - 8;
+ }
+ pcclk = ddrclk * tbits / 8;
+ pcclk = pcclk - (pcclk % 100);
+ i_i = (record[3] & 0x0f) + (record[4] & 0x0f) - 17;
+ k = ((record[5] & 0x7) + 1) * record[17];
+ trcd = ((record[29] >> 2) + ((record[29] & 3) * 0.25)) / ctime * 100;
+ trp = ((record[27] >> 2) + ((record[27] & 3) * 0.25)) / ctime * 100;
+ tras = record[30] * 100 / ctime ;
+ x = (int)(ctime / 100);
+ y = (ctime - (int)((ctime / 100) * 100)) / 10;
+
+ for (i_i = 2; i_i < 7; i_i++) {
+ if (record[18] & (1 << i_i)) {
+ highestCAS = i_i;
+ cas[highestCAS]++;
+ }
+ }
+
+ printf("---=== SPD EEPROM Information ===---\n");
+ printf("EEPROM Checksum of bytes 0-62\t\t\t OK (0x%0X)\n", record[63]);
+ printf("# of bytes written to SDRAM EEPROM\t\t %d\n", record[0]);
+ printf("Total number of bytes in EEPROM\t\t\t %d\n", 1 << record[1]);
+
+ if (record[2] < 11) {
+ printf("Fundamental Memory type\t\t\t\t %s\n", type_list[record[2]]);
+ } else {
+ printf("Warning: unknown memory type (%02x)\n", record[2]);
+ }
+ printf("SPD Revision\t\t\t\t\t %x.%x\n", record[62] >> 4, record[62] & 0x0f);
+
+ printf("\n---=== Memory Characteristics ===---\n");
+ printf("Maximum module speed\t\t\t\t %d MHz (PC2-%d)\n", ddrclk, pcclk);
+ if (i_i > 0 && i_i <= 12 && k > 0) {
+ printf("Size\t\t\t\t\t\t %d MB\n", ((1 << i_i) * k));
+ } else {
+ printf("Size\t\t\t\t\t\t INVALID: %02x %02x %02x %02x\n", record[3], record[4], record[5], record[17]);
+ }
+ printf("Banks x Rows x Columns x Bits\t\t\t %d x %d x %d x %d\n", record[17], record[3], record[4], record[6]);
+ printf("Ranks\t\t\t\t\t\t %d\n", (record[5] & 0x7) + 1);
+ printf("SDRAM Device Width\t\t\t\t %d bits\n", record[13]);
+
+ if ((record[5] >> 5) < 7) {
+ printf("Module Height\t\t\t\t\t %s mm\n", heights[(record[5] >> 5)]);
+ } else {
+ printf("Error height\n");
+ }
+ printf("Module Type\t\t\t\t\t %s\n", ddr2_module_types[fls(record[20]) - 1]);
+ printf("DRAM Package\t\t\t\t\t ");
+ if ((record[5] & 0x10) == 1) {
+ printf("Stack\n");
+ } else {
+ printf("Planar\n");
+ }
+ if (record[8] < 7) {
+ printf("Voltage Interface Level\t\t\t\t %s\n", sdram_voltage_interface_level[record[8]]);
+ } else {
+ printf("Error Voltage Interface Level\n");
+ }
+ printf("Module Configuration Type \t\t\t ");
+
+ parity = record[11] & 0x07;
+ if (parity == 0) {
+ printf("No Parity\n");
+ }
+ if ((parity & 0x03) == 0x01) {
+ printf("Data Parity\n");
+ }
+ if (parity & 0x02) {
+ printf("Data ECC\n");
+ }
+ if (parity & 0x04) {
+ printf("Address/Command Parity\n");
+ }
+ if ((record[12] >> 7) == 1) {
+ ref = "- Self Refresh";
+ } else {
+ ref = " ";
+ }
+ printf("Refresh Rate\t\t\t\t\t Reduced (%s us) %s\n", refresh[record[12] & 0x7f], ref);
+ printf("Supported Burst Lengths\t\t\t\t %d, %d\n", record[16] & 4, record[16] & 8);
+
+ printf("Supported CAS Latencies (tCL)\t\t\t %dT\n", highestCAS);
+ printf("tCL-tRCD-tRP-tRAS\t\t\t\t %d-%d-%d-%d as DDR2-%d\n", highestCAS, trcd, trp, tras, ddrclk);
+ printf("Minimum Cycle Time\t\t\t\t %d.%d ns at CAS %d\n", x, y, highestCAS);
+ printf("Maximum Access Time\t\t\t\t 0.%d%d ns at CAS %d\n", (record[10] >> 4), (record[10] & 0xf), highestCAS);
+ printf("Maximum Cycle Time (tCK max)\t\t\t %d ns\n", (record[43] >> 4) + (record[43] & 0x0f));
+
+ printf("\n---=== Timing Parameters ===---\n");
+ printf("Address/Command Setup Time Before Clock (tIS)\t 0.%d ns\n", (funct(record[32])));
+ printf("Address/Command Hold Time After Clock (tIH)\t 0.%d ns\n", (funct(record[33])));
+ printf("Data Input Setup Time Before Strobe (tDS)\t 0.%d%d ns\n", (record[34] >> 4), (record[34] & 0xf));
+ printf("Data Input Hold Time After Strobe (tDH)\t\t 0.%d%d ns\n", (record[35] >> 4), (record[35] & 0xf));
+
+ printf("Minimum Row Precharge Delay (tRP)\t\t %d.%d ns\n", integ(record[27]), des(record[27]));
+ printf("Minimum Row Active to Row Active Delay (tRRD)\t %d.%d ns\n", integ(record[28]), des(record[28]));
+ printf("Minimum RAS# to CAS# Delay (tRCD)\t\t %d.%d ns\n", integ(record[29]), des(record[29]));
+ printf("Minimum RAS# Pulse Width (tRAS)\t\t\t %d ns\n", ((record[30] & 0xfc) + (record[30] & 0x3)));
+ printf("Write Recovery Time (tWR)\t\t\t %d.%d ns\n", integ(record[36]), des(record[36]));
+ printf("Minimum Write to Read CMD Delay (tWTR)\t\t %d.%d ns\n", integ(record[37]), des(record[37]));
+ printf("Minimum Read to Pre-charge CMD Delay (tRTP)\t %d.%d ns\n", integ(record[38]), des(record[38]));
+ printf("Minimum Active to Auto-refresh Delay (tRC)\t %d ns\n", record[41]);
+ printf("Minimum Recovery Delay (tRFC)\t\t\t %d ns\n", record[42]);
+ printf("Maximum DQS to DQ Skew (tDQSQ)\t\t\t 0.%d ns\n", record[44]);
+ printf("Maximum Read Data Hold Skew (tQHS)\t\t 0.%d ns\n", record[45]);
+
+ printf("\n---=== Manufacturing Information ===---\n");
+
+ printf("Manufacturer JEDEC ID\t\t\t\t");
+ for (i = 64; i < 72; i++) {
+ printf(" %02x", record[i]);
+ }
+ printf("\n");
+ if (record[72]) {
+ printf("Manufacturing Location Code\t\t\t 0x%02x\n", record[72]);
+ }
+ printf("Part Number\t\t\t\t\t ");
+ for (i = 73; i < 91; i++) {
+ if (record[i] >= 32 && record[i] < 127) {
+ printf("%c", record[i]);
+ } else {
+ printf("%d", record[i]);
+ }
+ }
+ printf("\n");
+ printf("Manufacturing Date\t\t\t\t 20%d-W%d\n", record[93], record[94]);
+ printf("Assembly Serial Number\t\t\t\t 0x");
+ for (i = 95; i < 99; i++) {
+ printf("%02X", record[i]);
+ }
+}
diff --git a/include/ddr_spd.h b/include/ddr_spd.h
index fc03bac..1c308ef 100644
--- a/include/ddr_spd.h
+++ b/include/ddr_spd.h
@@ -228,6 +228,7 @@ struct ddr3_spd_eeprom_s {
uint8_t cust[80]; /* 176-255 Open for Customer Use */
};
+extern void prin(uint8_t *record);
extern uint32_t ddr3_spd_checksum_pass(const struct ddr3_spd_eeprom_s *spd);
extern uint32_t ddr2_spd_checksum_pass(const struct ddr2_spd_eeprom_s *spd);
--
2.1.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 8+ messages in thread
* [RFC V2 3/3] add decode command (SPD EEPROM data decoder)
2015-06-24 12:57 [RFC V2 0/3] add decode command (SPD EEPROM data decoder) Alexander Smirnov
2015-06-24 12:57 ` [RFC V2 1/3] common: move DDR_SPD to common/Kconfig Alexander Smirnov
2015-06-24 12:57 ` [RFC V2 2/3] ddr_spd: add routune for printing SPD contents in human readable format Alexander Smirnov
@ 2015-06-24 12:57 ` Alexander Smirnov
2015-06-24 16:50 ` Antony Pavlov
2015-06-25 6:35 ` Sascha Hauer
2 siblings, 2 replies; 8+ messages in thread
From: Alexander Smirnov @ 2015-06-24 12:57 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox, Alexander Smirnov
decode-dimms perl script is used as prototype
(see https://github.com/groeck/i2c-tools/blob/master/eeprom/decode-dimms).
Here is a sample decode output:
barebox@barebox sandbox:/ decode env/crucial_pc2-6400_ddr2
Decoding EEPROM: env/crucial_pc2-6400_ddr2
---=== SPD EEPROM Information ===---
EEPROM Checksum of bytes 0-62 OK (0xCA)
Total number of bytes in EEPROM 256
Fundamental Memory type DDR2 SDRAM
SPD Revision 1.3
---=== Memory Characteristics ===---
Maximum module speed 800 MHz (PC2-6400)
Size 1024 MB
Banks x Rows x Columns x Bits 8 x 14 x 10 x 64
Ranks 1
SDRAM Device Width 8 bits
Module Height 30.0 mm
Module Type SO-DIMM (67.6 mm)
DRAM Package Planar
Voltage Interface Level SSTL 1.8V
Module Configuration Type No Parity
Refresh Rate Reduced (7.8 us) - Self Refresh
Supported Burst Lengths 4, 8
Supported CAS Latencies (tCL) 6T
tCL-tRCD-tRP-tRAS 6-6-6-18 as DDR2-800
Minimum Cycle Time 250 (ns*100) at CAS 6
Maximum Access Time 4 (ns*10) at CAS 6
Maximum Cycle Time (tCK max) 8 ns
---=== Timing Parameters ===---
Address/Command Setup Time Before Clock (tIS) 17 (ns*100)
Address/Command Hold Time After Clock (tIH) 25 (ns*100)
Data Input Setup Time Before Strobe (tDS) 5 (ns*100)
Data Input Hold Time After Strobe (tDH) 12 (ns*100)
Minimum Row Precharge Delay (tRP) 150 (ns*10)
Minimum Row Active to Row Active Delay (tRRD) 75 (ns*10)
Minimum RAS# to CAS# Delay (tRCD) 150 (ns*10)
Minimum RAS# Pulse Width (tRAS) 450 (ns*10)
Write Recovery Time (tWR) 150 (ns*10)
Minimum Write to Read CMD Delay (tWTR) 75 (ns*10)
Minimum Read to Pre-charge CMD Delay (tRTP) 75 (ns*10)
Minimum Active to Auto-refresh Delay (tRC) 600 (ns*10)
Minimum Recovery Delay (tRFC) 1270 (ns*10)
Maximum DQS to DQ Skew (tDQSQ) 20 (ns*100)
Maximum Read Data Hold Skew (tQHS) 30 (ns*100)
---=== Manufacturing Information ===---
Manufacturer JEDEC ID 7f 7f 7f 7f 7f 9b 00 00
Part Number CT12864AC800.M8FM8
Manufacturing Date 2014-W24
Assembly Serial Number 0x00000000
TODOs:
* Timing Parameters section output format is slightly
differ from decode-dimms' format;
* supports only DDR2 SPD EEPROM.
Signed-off-by: Alexander Smirnov <alllecs@yandex.ru>
---
commands/Kconfig | 7 ++++++
commands/Makefile | 1 +
commands/decode.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 73 insertions(+)
diff --git a/commands/Kconfig b/commands/Kconfig
index bb6674e..9230873 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -2102,6 +2102,13 @@ config CMD_STATE
depends on STATE
prompt "state"
+config CMD_DECODE
+ tristate
+ prompt "decode"
+ select DDR_SPD
+ help
+ decode spd eeprom
+
# end Miscellaneous commands
endmenu
diff --git a/commands/Makefile b/commands/Makefile
index 3698347..71cd877 100644
--- a/commands/Makefile
+++ b/commands/Makefile
@@ -112,3 +112,4 @@ obj-$(CONFIG_CMD_NV) += nv.o
obj-$(CONFIG_CMD_DEFAULTENV) += defaultenv.o
obj-$(CONFIG_CMD_STATE) += state.o
obj-$(CONFIG_CMD_DHCP) += dhcp.o
+obj-$(CONFIG_CMD_DECODE) += decode.o
diff --git a/commands/decode.c b/commands/decode.c
new file mode 100644
index 0000000..80da80c
--- /dev/null
+++ b/commands/decode.c
@@ -0,0 +1,65 @@
+#include <fcntl.h>
+#include <common.h>
+#include <getopt.h>
+#include <command.h>
+#include <envfs.h>
+#include <errno.h>
+#include <fs.h>
+#include <libfile.h>
+#include <malloc.h>
+#include <globalvar.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <ddr_spd.h>
+
+void dump(uint8_t *addr, int len)
+{
+ int i;
+
+ printf("\t 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f\n\n");
+
+ for (i = 0; i < len; i++) {
+ if ((i % 0x10) == 0x00) {
+ printf("%07x:", i);
+ }
+ printf(" %02x", addr[i]);
+ if ((i % 0x10) == 0xf) {
+ printf("\n");
+ }
+ }
+
+ printf("\n");
+}
+
+static int do_decode(int argc, char *argv[])
+{
+ int fp;
+ uint8_t record[256];
+
+ if (argc != 2) {
+ return COMMAND_ERROR_USAGE;
+ }
+
+ fp = open(argv[1], O_RDONLY);
+
+ if (fp < 0) {
+ printf("could not open %s: %s\n", argv[args], errno_str());
+ }
+
+ read(fp, &record[0], 256);
+ close(fp);
+
+ printf("Decoding EEPROM: %s\n\n", argv[1]);
+
+ prin(record);
+ printf("\n\n");
+
+ return 0;
+}
+BAREBOX_CMD_HELP_START(decode)
+BAREBOX_CMD_HELP_TEXT("Not enough or more than one argument to continue.")
+BAREBOX_CMD_HELP_END
+
+BAREBOX_CMD_START(decode)
+ .cmd = do_decode,
+BAREBOX_CMD_END
--
2.1.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC V2 3/3] add decode command (SPD EEPROM data decoder)
2015-06-24 12:57 ` [RFC V2 3/3] add decode command (SPD EEPROM data decoder) Alexander Smirnov
@ 2015-06-24 16:50 ` Antony Pavlov
2015-06-25 6:35 ` Sascha Hauer
1 sibling, 0 replies; 8+ messages in thread
From: Antony Pavlov @ 2015-06-24 16:50 UTC (permalink / raw)
To: Alexander Smirnov; +Cc: barebox
On Wed, 24 Jun 2015 15:57:29 +0300
Alexander Smirnov <alllecs@yandex.ru> wrote:
> decode-dimms perl script is used as prototype
> (see https://github.com/groeck/i2c-tools/blob/master/eeprom/decode-dimms).
>
> Here is a sample decode output:
>
> barebox@barebox sandbox:/ decode env/crucial_pc2-6400_ddr2
> Decoding EEPROM: env/crucial_pc2-6400_ddr2
>
> ---=== SPD EEPROM Information ===---
> EEPROM Checksum of bytes 0-62 OK (0xCA)
> Total number of bytes in EEPROM 256
> Fundamental Memory type DDR2 SDRAM
> SPD Revision 1.3
>
> ---=== Memory Characteristics ===---
> Maximum module speed 800 MHz (PC2-6400)
> Size 1024 MB
> Banks x Rows x Columns x Bits 8 x 14 x 10 x 64
> Ranks 1
> SDRAM Device Width 8 bits
> Module Height 30.0 mm
> Module Type SO-DIMM (67.6 mm)
> DRAM Package Planar
> Voltage Interface Level SSTL 1.8V
> Module Configuration Type No Parity
> Refresh Rate Reduced (7.8 us) - Self Refresh
> Supported Burst Lengths 4, 8
> Supported CAS Latencies (tCL) 6T
> tCL-tRCD-tRP-tRAS 6-6-6-18 as DDR2-800
> Minimum Cycle Time 250 (ns*100) at CAS 6
> Maximum Access Time 4 (ns*10) at CAS 6
> Maximum Cycle Time (tCK max) 8 ns
>
> ---=== Timing Parameters ===---
> Address/Command Setup Time Before Clock (tIS) 17 (ns*100)
> Address/Command Hold Time After Clock (tIH) 25 (ns*100)
> Data Input Setup Time Before Strobe (tDS) 5 (ns*100)
> Data Input Hold Time After Strobe (tDH) 12 (ns*100)
> Minimum Row Precharge Delay (tRP) 150 (ns*10)
> Minimum Row Active to Row Active Delay (tRRD) 75 (ns*10)
> Minimum RAS# to CAS# Delay (tRCD) 150 (ns*10)
> Minimum RAS# Pulse Width (tRAS) 450 (ns*10)
> Write Recovery Time (tWR) 150 (ns*10)
> Minimum Write to Read CMD Delay (tWTR) 75 (ns*10)
> Minimum Read to Pre-charge CMD Delay (tRTP) 75 (ns*10)
> Minimum Active to Auto-refresh Delay (tRC) 600 (ns*10)
> Minimum Recovery Delay (tRFC) 1270 (ns*10)
> Maximum DQS to DQ Skew (tDQSQ) 20 (ns*100)
> Maximum Read Data Hold Skew (tQHS) 30 (ns*100)
>
> ---=== Manufacturing Information ===---
> Manufacturer JEDEC ID 7f 7f 7f 7f 7f 9b 00 00
> Part Number CT12864AC800.M8FM8
> Manufacturing Date 2014-W24
> Assembly Serial Number 0x00000000
>
> TODOs:
>
> * Timing Parameters section output format is slightly
> differ from decode-dimms' format;
> * supports only DDR2 SPD EEPROM.
>
> Signed-off-by: Alexander Smirnov <alllecs@yandex.ru>
> ---
> commands/Kconfig | 7 ++++++
> commands/Makefile | 1 +
> commands/decode.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 73 insertions(+)
>
> diff --git a/commands/Kconfig b/commands/Kconfig
> index bb6674e..9230873 100644
> --- a/commands/Kconfig
> +++ b/commands/Kconfig
> @@ -2102,6 +2102,13 @@ config CMD_STATE
> depends on STATE
> prompt "state"
>
> +config CMD_DECODE
> + tristate
> + prompt "decode"
> + select DDR_SPD
> + help
> + decode spd eeprom
> +
> # end Miscellaneous commands
> endmenu
>
> diff --git a/commands/Makefile b/commands/Makefile
> index 3698347..71cd877 100644
> --- a/commands/Makefile
> +++ b/commands/Makefile
> @@ -112,3 +112,4 @@ obj-$(CONFIG_CMD_NV) += nv.o
> obj-$(CONFIG_CMD_DEFAULTENV) += defaultenv.o
> obj-$(CONFIG_CMD_STATE) += state.o
> obj-$(CONFIG_CMD_DHCP) += dhcp.o
> +obj-$(CONFIG_CMD_DECODE) += decode.o
> diff --git a/commands/decode.c b/commands/decode.c
> new file mode 100644
> index 0000000..80da80c
> --- /dev/null
> +++ b/commands/decode.c
> @@ -0,0 +1,65 @@
> +#include <fcntl.h>
> +#include <common.h>
> +#include <getopt.h>
> +#include <command.h>
> +#include <envfs.h>
> +#include <errno.h>
> +#include <fs.h>
> +#include <libfile.h>
> +#include <malloc.h>
> +#include <globalvar.h>
> +#include <stdlib.h>
> +#include <stdio.h>
> +#include <ddr_spd.h>
Please drop unused header files.
> +
> +void dump(uint8_t *addr, int len)
> +{
> + int i;
> +
> + printf("\t 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f\n\n");
> +
> + for (i = 0; i < len; i++) {
> + if ((i % 0x10) == 0x00) {
> + printf("%07x:", i);
> + }
> + printf(" %02x", addr[i]);
> + if ((i % 0x10) == 0xf) {
> + printf("\n");
> + }
> + }
> +
> + printf("\n");
> +}
We have no need in this dump function in barebox because
* we can use 'md' command with '-s' from barebox command line;
* we can use memory_display from C code.
> +
> +static int do_decode(int argc, char *argv[])
> +{
> + int fp;
Please change 'fp' -> 'fd' as Sascha already asked.
> + uint8_t record[256];
> +
> + if (argc != 2) {
> + return COMMAND_ERROR_USAGE;
> + }
> +
> + fp = open(argv[1], O_RDONLY);
> +
> + if (fp < 0) {
> + printf("could not open %s: %s\n", argv[args], errno_str());
You can't continue command execution after this error.
Please return with error code status.
> + }
> +
> + read(fp, &record[0], 256);
> + close(fp);
> +
> + printf("Decoding EEPROM: %s\n\n", argv[1]);
> +
> + prin(record);
> + printf("\n\n");
> +
> + return 0;
> +}
> +BAREBOX_CMD_HELP_START(decode)
> +BAREBOX_CMD_HELP_TEXT("Not enough or more than one argument to continue.")
This does not look like help message for the command.
> +BAREBOX_CMD_HELP_END
> +
> +BAREBOX_CMD_START(decode)
> + .cmd = do_decode,
> +BAREBOX_CMD_END
> --
> 2.1.4
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
--
--
Best regards,
Antony Pavlov
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC V2 2/3] ddr_spd: add routune for printing SPD contents in human readable format
2015-06-24 12:57 ` [RFC V2 2/3] ddr_spd: add routune for printing SPD contents in human readable format Alexander Smirnov
@ 2015-06-25 6:32 ` Sascha Hauer
0 siblings, 0 replies; 8+ messages in thread
From: Sascha Hauer @ 2015-06-25 6:32 UTC (permalink / raw)
To: Alexander Smirnov; +Cc: barebox
On Wed, Jun 24, 2015 at 03:57:28PM +0300, Alexander Smirnov wrote:
> Signed-off-by: Alexander Smirnov <alllecs@yandex.ru>
> ---
> +void prin(uint8_t *record)
Please use a more meaningful name.
> +{
> + 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;
> +
> + ctime = ddr2_sdram_ctime(record[9]);
> + ddrclk = 2 * (1000 / ctime) * 100;
> + tbits = (record[7] << 8) + record[6];
> + if ((record[11] & 0x03) == 1) {
> + tbits = tbits - 8;
> + }
> + pcclk = ddrclk * tbits / 8;
> + pcclk = pcclk - (pcclk % 100);
> + i_i = (record[3] & 0x0f) + (record[4] & 0x0f) - 17;
> + k = ((record[5] & 0x7) + 1) * record[17];
> + trcd = ((record[29] >> 2) + ((record[29] & 3) * 0.25)) / ctime * 100;
> + trp = ((record[27] >> 2) + ((record[27] & 3) * 0.25)) / ctime * 100;
> + tras = record[30] * 100 / ctime ;
> + x = (int)(ctime / 100);
> + y = (ctime - (int)((ctime / 100) * 100)) / 10;
> +
> + for (i_i = 2; i_i < 7; i_i++) {
> + if (record[18] & (1 << i_i)) {
> + highestCAS = i_i;
> + cas[highestCAS]++;
> + }
indention broken here.
> + }
> +
> + printf("---=== SPD EEPROM Information ===---\n");
> + printf("EEPROM Checksum of bytes 0-62\t\t\t OK (0x%0X)\n", record[63]);
> + printf("# of bytes written to SDRAM EEPROM\t\t %d\n", record[0]);
> + printf("Total number of bytes in EEPROM\t\t\t %d\n", 1 << record[1]);
> +
> + if (record[2] < 11) {
> + printf("Fundamental Memory type\t\t\t\t %s\n", type_list[record[2]]);
> + } else {
> + printf("Warning: unknown memory type (%02x)\n", record[2]);
> + }
Please drop unnecessary braces here and elsewhere.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC V2 3/3] add decode command (SPD EEPROM data decoder)
2015-06-24 12:57 ` [RFC V2 3/3] add decode command (SPD EEPROM data decoder) Alexander Smirnov
2015-06-24 16:50 ` Antony Pavlov
@ 2015-06-25 6:35 ` Sascha Hauer
1 sibling, 0 replies; 8+ messages in thread
From: Sascha Hauer @ 2015-06-25 6:35 UTC (permalink / raw)
To: Alexander Smirnov; +Cc: barebox
On Wed, Jun 24, 2015 at 03:57:29PM +0300, Alexander Smirnov wrote:
> decode-dimms perl script is used as prototype
> (see https://github.com/groeck/i2c-tools/blob/master/eeprom/decode-dimms).
>
> Here is a sample decode output:
>
> barebox@barebox sandbox:/ decode env/crucial_pc2-6400_ddr2
> Decoding EEPROM: env/crucial_pc2-6400_ddr2
>
> ---=== SPD EEPROM Information ===---
> EEPROM Checksum of bytes 0-62 OK (0xCA)
> Total number of bytes in EEPROM 256
> Fundamental Memory type DDR2 SDRAM
> SPD Revision 1.3
>
> ---=== Memory Characteristics ===---
> Maximum module speed 800 MHz (PC2-6400)
> Size 1024 MB
> Banks x Rows x Columns x Bits 8 x 14 x 10 x 64
> Ranks 1
> SDRAM Device Width 8 bits
> Module Height 30.0 mm
> Module Type SO-DIMM (67.6 mm)
> DRAM Package Planar
> Voltage Interface Level SSTL 1.8V
> Module Configuration Type No Parity
> Refresh Rate Reduced (7.8 us) - Self Refresh
> Supported Burst Lengths 4, 8
> Supported CAS Latencies (tCL) 6T
> tCL-tRCD-tRP-tRAS 6-6-6-18 as DDR2-800
> Minimum Cycle Time 250 (ns*100) at CAS 6
> Maximum Access Time 4 (ns*10) at CAS 6
> Maximum Cycle Time (tCK max) 8 ns
>
> ---=== Timing Parameters ===---
> Address/Command Setup Time Before Clock (tIS) 17 (ns*100)
> Address/Command Hold Time After Clock (tIH) 25 (ns*100)
> Data Input Setup Time Before Strobe (tDS) 5 (ns*100)
> Data Input Hold Time After Strobe (tDH) 12 (ns*100)
> Minimum Row Precharge Delay (tRP) 150 (ns*10)
> Minimum Row Active to Row Active Delay (tRRD) 75 (ns*10)
> Minimum RAS# to CAS# Delay (tRCD) 150 (ns*10)
> Minimum RAS# Pulse Width (tRAS) 450 (ns*10)
> Write Recovery Time (tWR) 150 (ns*10)
> Minimum Write to Read CMD Delay (tWTR) 75 (ns*10)
> Minimum Read to Pre-charge CMD Delay (tRTP) 75 (ns*10)
> Minimum Active to Auto-refresh Delay (tRC) 600 (ns*10)
> Minimum Recovery Delay (tRFC) 1270 (ns*10)
> Maximum DQS to DQ Skew (tDQSQ) 20 (ns*100)
> Maximum Read Data Hold Skew (tQHS) 30 (ns*100)
>
> ---=== Manufacturing Information ===---
> Manufacturer JEDEC ID 7f 7f 7f 7f 7f 9b 00 00
> Part Number CT12864AC800.M8FM8
> Manufacturing Date 2014-W24
> Assembly Serial Number 0x00000000
>
> TODOs:
>
> * Timing Parameters section output format is slightly
> differ from decode-dimms' format;
> * supports only DDR2 SPD EEPROM.
>
> Signed-off-by: Alexander Smirnov <alllecs@yandex.ru>
> ---
> commands/Kconfig | 7 ++++++
> commands/Makefile | 1 +
> commands/decode.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 73 insertions(+)
>
> diff --git a/commands/Kconfig b/commands/Kconfig
> index bb6674e..9230873 100644
> --- a/commands/Kconfig
> +++ b/commands/Kconfig
> @@ -2102,6 +2102,13 @@ config CMD_STATE
> depends on STATE
> prompt "state"
>
> +config CMD_DECODE
> + tristate
> + prompt "decode"
> + select DDR_SPD
> + help
> + decode spd eeprom
> +
> # end Miscellaneous commands
> endmenu
>
> diff --git a/commands/Makefile b/commands/Makefile
> index 3698347..71cd877 100644
> --- a/commands/Makefile
> +++ b/commands/Makefile
> @@ -112,3 +112,4 @@ obj-$(CONFIG_CMD_NV) += nv.o
> obj-$(CONFIG_CMD_DEFAULTENV) += defaultenv.o
> obj-$(CONFIG_CMD_STATE) += state.o
> obj-$(CONFIG_CMD_DHCP) += dhcp.o
> +obj-$(CONFIG_CMD_DECODE) += decode.o
> diff --git a/commands/decode.c b/commands/decode.c
> new file mode 100644
> index 0000000..80da80c
> --- /dev/null
> +++ b/commands/decode.c
> @@ -0,0 +1,65 @@
> +#include <fcntl.h>
> +#include <common.h>
> +#include <getopt.h>
> +#include <command.h>
> +#include <envfs.h>
> +#include <errno.h>
> +#include <fs.h>
> +#include <libfile.h>
> +#include <malloc.h>
> +#include <globalvar.h>
> +#include <stdlib.h>
> +#include <stdio.h>
> +#include <ddr_spd.h>
> +
> +void dump(uint8_t *addr, int len)
> +{
> + int i;
> +
> + printf("\t 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f\n\n");
> +
> + for (i = 0; i < len; i++) {
> + if ((i % 0x10) == 0x00) {
> + printf("%07x:", i);
> + }
> + printf(" %02x", addr[i]);
> + if ((i % 0x10) == 0xf) {
> + printf("\n");
> + }
> + }
> +
> + printf("\n");
> +}
> +
> +static int do_decode(int argc, char *argv[])
> +{
> + int fp;
> + uint8_t record[256];
> +
> + if (argc != 2) {
> + return COMMAND_ERROR_USAGE;
> + }
> +
> + fp = open(argv[1], O_RDONLY);
> +
> + if (fp < 0) {
> + printf("could not open %s: %s\n", argv[args], errno_str());
> + }
> +
> + read(fp, &record[0], 256);
> + close(fp);
read_file_2 is your friend here. It reads a file into an allocated
buffer.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RFC V2 1/3] common: move DDR_SPD to common/Kconfig
2015-06-24 12:57 ` [RFC V2 1/3] common: move DDR_SPD to common/Kconfig Alexander Smirnov
@ 2015-06-25 9:32 ` Renaud Barbier
0 siblings, 0 replies; 8+ messages in thread
From: Renaud Barbier @ 2015-06-25 9:32 UTC (permalink / raw)
To: barebox
There may be an issue in the future. DDR_SPD selects the PPC Freescale
DDR driver support (my fault for this bad choice). If somebody was to
add and build a PPC machine with DDR support that is none of the
Freescale boards then the Freescale DDR driver will be selected too.
To be safe, something like that could be used:
diff --git a/arch/ppc/mach-mpc85xx/Makefile b/arch/ppc/mach-mpc85xx/Makefile
index 3e64617..a7453f7 100644
--- a/arch/ppc/mach-mpc85xx/Makefile
+++ b/arch/ppc/mach-mpc85xx/Makefile
@@ -9,5 +9,6 @@ obj-y += fsl_i2c.o
obj-$(CONFIG_MP) += mp.o
obj-$(CONFIG_OFTREE) += fdt.o
obj-$(CONFIG_DRIVER_NET_GIANFAR) += eth-devices.o
-obj-$(CONFIG_DDR_SPD) += ../ddr-8xxx/
+obj-$(CONFIG_FSL_DDR2) += ../ddr-8xxx/
+obj-$(CONFIG_FSL_DDR3) += ../ddr-8xxx/
On 24/06/2015 13:57, Alexander Smirnov wrote:
> This patch makes it possible to use ddr_spd-related
> routines in any arch not only in ppc.
>
> Signed-off-by: Alexander Smirnov <alllecs@yandex.ru>
> ---
> arch/ppc/mach-mpc85xx/Kconfig | 4 ----
> common/Kconfig | 4 ++++
> 2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/ppc/mach-mpc85xx/Kconfig b/arch/ppc/mach-mpc85xx/Kconfig
> index e29be9c..aa518b9 100644
> --- a/arch/ppc/mach-mpc85xx/Kconfig
> +++ b/arch/ppc/mach-mpc85xx/Kconfig
> @@ -81,10 +81,6 @@ config P1022
> config MPC8544
> bool
>
> -config DDR_SPD
> - bool
> - select CRC16
> -
> config FSL_DDR2
> bool
>
> diff --git a/common/Kconfig b/common/Kconfig
> index 925fe4b..91e4ef3 100644
> --- a/common/Kconfig
> +++ b/common/Kconfig
> @@ -941,3 +941,7 @@ endmenu
>
> config HAS_DEBUG_LL
> bool
> +
> +config DDR_SPD
> + bool
> + select CRC16
>
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2015-06-25 9:32 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-24 12:57 [RFC V2 0/3] add decode command (SPD EEPROM data decoder) Alexander Smirnov
2015-06-24 12:57 ` [RFC V2 1/3] common: move DDR_SPD to common/Kconfig Alexander Smirnov
2015-06-25 9:32 ` Renaud Barbier
2015-06-24 12:57 ` [RFC V2 2/3] ddr_spd: add routune for printing SPD contents in human readable format Alexander Smirnov
2015-06-25 6:32 ` Sascha Hauer
2015-06-24 12:57 ` [RFC V2 3/3] add decode command (SPD EEPROM data decoder) Alexander Smirnov
2015-06-24 16:50 ` Antony Pavlov
2015-06-25 6:35 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox