blob: 25d04639fc6094051669ca14f616d48f1c95d15d [file] [log] [blame]
Patrick Georgiac959032020-05-05 22:49:26 +02001/* SPDX-License-Identifier: GPL-2.0-or-later */
Stefan Reinauereca92fb2006-08-23 14:28:37 +00002
Uwe Hermann998a57c2006-11-22 11:41:32 +00003/*
4 * Serial Presence Detect (SPD) data stored on SDRAM modules.
5 *
6 * Datasheet:
7 * - Name: PC SDRAM Serial Presence Detect (SPD) Specification
8 * Revision 1.2A, December, 1997
9 * - PDF: http://www.intel.com/design/chipsets/memory/spdsd12a.pdf
10 *
11 * Datasheet (alternative):
12 * - Name: SERIAL PRESENCE DETECT STANDARD, General Standard
13 * JEDEC Standard No. 21-C
Elyes HAOUASc8d24dd2016-06-15 21:13:07 +020014 * Annex J: Serial Presence Detects for DDR2 SDRAM (Revision 1.3):
15 * - PDF: http://www.jedec.org/download/search/4_01_02_10R17.pdf
Uwe Hermann998a57c2006-11-22 11:41:32 +000016 */
Stefan Reinauereca92fb2006-08-23 14:28:37 +000017
Uwe Hermann998a57c2006-11-22 11:41:32 +000018#ifndef _SPD_H_
19#define _SPD_H_
Stefan Reinauereca92fb2006-08-23 14:28:37 +000020
Uwe Hermann998a57c2006-11-22 11:41:32 +000021/* Byte numbers. */
Lee Leahy6a566d72017-03-07 17:45:12 -080022/* Number of bytes used by module manufacturer */
23#define SPD_NUM_MANUFACTURER_BYTES 0
Uwe Hermann998a57c2006-11-22 11:41:32 +000024#define SPD_TOTAL_SPD_MEMORY_SIZE 1 /* Total SPD memory size */
25#define SPD_MEMORY_TYPE 2 /* (Fundamental) memory type */
26#define SPD_NUM_ROWS 3 /* Number of row address bits */
Lee Leahy6a566d72017-03-07 17:45:12 -080027/* Number of column address bits */
28#define SPD_NUM_COLUMNS 4
29/* Number of module rows (banks) */
30#define SPD_NUM_DIMM_BANKS 5
Uwe Hermann998a57c2006-11-22 11:41:32 +000031#define SPD_MODULE_DATA_WIDTH_LSB 6 /* Module data width (LSB) */
32#define SPD_MODULE_DATA_WIDTH_MSB 7 /* Module data width (MSB) */
Lee Leahy6a566d72017-03-07 17:45:12 -080033/* Module interface signal levels */
34#define SPD_MODULE_VOLTAGE 8
35/* SDRAM cycle time (highest CAS latency), RAS access time (tRAC) */
36#define SPD_MIN_CYCLE_TIME_AT_CAS_MAX 9
37/* SDRAM access time from clock (highest CAS latency), CAS access time (Tac,
38 * tCAC)
39 */
40#define SPD_ACCESS_TIME_FROM_CLOCK 10
Uwe Hermann998a57c2006-11-22 11:41:32 +000041#define SPD_DIMM_CONFIG_TYPE 11 /* Module configuration type */
42#define SPD_REFRESH 12 /* Refresh rate/type */
43#define SPD_PRIMARY_SDRAM_WIDTH 13 /* SDRAM width (primary SDRAM) */
Lee Leahy6a566d72017-03-07 17:45:12 -080044/* Error checking SDRAM (data) width */
45#define SPD_ERROR_CHECKING_SDRAM_WIDTH 14
46/* SDRAM device attributes, minimum clock delay for back to back random
47 * column
48 */
49#define SPD_MIN_CLOCK_DELAY_B2B_RAND_COLUMN 15
50/* SDRAM device attributes, burst lengths supported */
51#define SPD_SUPPORTED_BURST_LENGTHS 16
52/* SDRAM device attributes, number of banks on SDRAM device */
53#define SPD_NUM_BANKS_PER_SDRAM 17
54/* SDRAM device attributes, CAS latency */
55#define SPD_ACCEPTABLE_CAS_LATENCIES 18
56/* SDRAM device attributes, CS latency */
57#define SPD_CS_LATENCY 19
58/* SDRAM device attributes, WE latency */
59#define SPD_WE_LATENCY 20
Uwe Hermann998a57c2006-11-22 11:41:32 +000060#define SPD_MODULE_ATTRIBUTES 21 /* SDRAM module attributes */
Lee Leahy6a566d72017-03-07 17:45:12 -080061/* SDRAM device attributes, general */
62#define SPD_DEVICE_ATTRIBUTES_GENERAL 22
63/* SDRAM cycle time (2nd highest CAS latency) */
64#define SPD_SDRAM_CYCLE_TIME_2ND 23
65/* SDRAM access from clock (2nd highest CAS latency) */
66#define SPD_ACCESS_TIME_FROM_CLOCK_2ND 24
67/* SDRAM cycle time (3rd highest CAS latency) */
68#define SPD_SDRAM_CYCLE_TIME_3RD 25
69/* SDRAM access from clock (3rd highest CAS latency) */
70#define SPD_ACCESS_TIME_FROM_CLOCK_3RD 26
71/* Minimum row precharge time (Trp) */
72#define SPD_MIN_ROW_PRECHARGE_TIME 27
73/* Minimum row active to row active (Trrd) */
74#define SPD_MIN_ROWACTIVE_TO_ROWACTIVE 28
75/* Minimum RAS to CAS delay (Trcd) */
76#define SPD_MIN_RAS_TO_CAS_DELAY 29
77/* Minimum RAS pulse width (Tras) */
78#define SPD_MIN_ACTIVE_TO_PRECHARGE_DELAY 30
79/* Density of each row on module */
80#define SPD_DENSITY_OF_EACH_ROW_ON_MODULE 31
81/* Command and address signal input setup time */
82#define SPD_CMD_SIGNAL_INPUT_SETUP_TIME 32
83/* Command and address signal input hold time */
84#define SPD_CMD_SIGNAL_INPUT_HOLD_TIME 33
85/* Data signal input setup time */
86#define SPD_DATA_SIGNAL_INPUT_SETUP_TIME 34
Uwe Hermann998a57c2006-11-22 11:41:32 +000087#define SPD_DATA_SIGNAL_INPUT_HOLD_TIME 35 /* Data signal input hold time */
Stefan Reinauer951c62f2008-08-01 11:40:16 +000088#define SPD_WRITE_RECOVERY_TIME 36 /* Write recovery time (tWR) */
Lee Leahy6a566d72017-03-07 17:45:12 -080089/* Internal write to read command delay (tWTR) */
90#define SPD_INT_WRITE_TO_READ_DELAY 37
91/* Internal read to precharge command delay (tRTP) */
92#define SPD_INT_READ_TO_PRECHARGE_DELAY 38
93/* Memory analysis probe characteristics */
94#define SPD_MEM_ANALYSIS_PROBE_PARAMS 39
95/* Extension of byte 41 (tRC) and byte 42 (tRFC) */
96#define SPD_BYTE_41_42_EXTENSION 40
97/* Minimum active to active auto refresh (tRCmin) */
98#define SPD_MIN_ACT_TO_ACT_AUTO_REFRESH 41
99/* Minimum auto refresh to active/auto refresh (tRFC) */
100#define SPD_MIN_AUTO_REFRESH_TO_ACT 42
101/* Maximum device cycle time (tCKmax) */
102#define SPD_MAX_DEVICE_CYCLE_TIME 43
103/* Maximum skew between DQS and DQ (tDQSQ) */
104#define SPD_MAX_DQS_DQ_SKEW 44
105/* Maximum read data-hold skew factor (tQHS) */
106#define SPD_MAX_READ_DATAHOLD_SKEW 45
Ed Swierkd39aad92008-08-28 18:23:58 +0000107#define SPD_PLL_RELOCK_TIME 46 /* PLL relock time */
Uwe Hermann998a57c2006-11-22 11:41:32 +0000108#define SPD_SPD_DATA_REVISION_CODE 62 /* SPD data revision code */
109#define SPD_CHECKSUM_FOR_BYTES_0_TO_62 63 /* Checksum for bytes 0-62 */
Lee Leahy6a566d72017-03-07 17:45:12 -0800110/* Manufacturer's JEDEC ID code, per EIA/JEP106 (bytes 64-71) */
111#define SPD_MANUFACTURER_JEDEC_ID_CODE 64
Uwe Hermann998a57c2006-11-22 11:41:32 +0000112#define SPD_MANUFACTURING_LOCATION 72 /* Manufacturing location */
Lee Leahy6a566d72017-03-07 17:45:12 -0800113/* Manufacturer's part number, in 6-bit ASCII (bytes 73-90) */
114#define SPD_MANUFACTURER_PART_NUMBER 73
Uwe Hermann998a57c2006-11-22 11:41:32 +0000115#define SPD_REVISION_CODE 91 /* Revision code (bytes 91-92) */
Lee Leahy6a566d72017-03-07 17:45:12 -0800116/* Manufacturing date (byte 93: year, byte 94: week) */
117#define SPD_MANUFACTURING_DATE 93
118/* Assembly serial number (bytes 95-98) */
119#define SPD_ASSEMBLY_SERIAL_NUMBER 95
120/* Manufacturer specific data (bytes 99-125) */
121#define SPD_MANUFACTURER_SPECIFIC_DATA 99
122/* Intel specification for frequency */
123#define SPD_INTEL_SPEC_FOR_FREQUENCY 126
124/* Intel specification details for 100MHz support */
125#define SPD_INTEL_SPEC_100_MHZ 127
Stefan Reinauereca92fb2006-08-23 14:28:37 +0000126
Marc Jonesbc8176c2007-05-04 18:24:55 +0000127/* DRAM specifications use the following naming conventions for SPD locations */
128#define SPD_tRP SPD_MIN_ROW_PRECHARGE_TIME
129#define SPD_tRRD SPD_MIN_ROWACTIVE_TO_ROWACTIVE
130#define SPD_tRCD SPD_MIN_RAS_TO_CAS_DELAY
131#define SPD_tRAS SPD_MIN_ACTIVE_TO_PRECHARGE_DELAY
132#define SPD_BANK_DENSITY SPD_DENSITY_OF_EACH_ROW_ON_MODULE
133#define SPD_ADDRESS_CMD_HOLD SPD_CMD_SIGNAL_INPUT_HOLD_TIME
Lee Leahy6a566d72017-03-07 17:45:12 -0800134/* SDRAM Device Minimum Active to Active/Auto Refresh Time (tRC) */
135#define SPD_tRC 41
136/* SDRAM Device Minimum Auto Refresh to Active/Auto Refresh (tRFC) */
137#define SPD_tRFC 42
Marc Jonesbc8176c2007-05-04 18:24:55 +0000138
Uwe Hermann998a57c2006-11-22 11:41:32 +0000139/* SPD_MEMORY_TYPE values. */
Alexandru Gagniuc32610462013-05-21 14:07:41 -0500140enum spd_memory_type {
141 SPD_MEMORY_TYPE_UNDEFINED = 0x00,
142 SPD_MEMORY_TYPE_FPM_DRAM = 0x01,
143 SPD_MEMORY_TYPE_EDO = 0x02,
144 SPD_MEMORY_TYPE_PIPELINED_NIBBLE = 0x03,
145 SPD_MEMORY_TYPE_SDRAM = 0x04,
146 SPD_MEMORY_TYPE_MULTIPLEXED_ROM = 0x05,
147 SPD_MEMORY_TYPE_SGRAM_DDR = 0x06,
148 SPD_MEMORY_TYPE_SDRAM_DDR = 0x07,
149 SPD_MEMORY_TYPE_SDRAM_DDR2 = 0x08,
150 SPD_MEMORY_TYPE_FBDIMM_DDR2 = 0x09,
151 SPD_MEMORY_TYPE_FB_PROBE_DDR2 = 0x0a,
152 SPD_MEMORY_TYPE_SDRAM_DDR3 = 0x0b,
Elyes HAOUASed3ccc22016-06-20 18:57:19 +0200153 SPD_MEMORY_TYPE_DDR4_SDRAM = 0x0c,
154 SPD_MEMORY_TYPE_DDR4E_SDRAM = 0x0e,
155 SPD_MEMORY_TYPE_LPDDR3_SDRAM = 0x0f,
156 SPD_MEMORY_TYPE_LPDDR4_SDRAM = 0x10,
Alexandru Gagniuc32610462013-05-21 14:07:41 -0500157};
Stefan Reinauereca92fb2006-08-23 14:28:37 +0000158
Uwe Hermann998a57c2006-11-22 11:41:32 +0000159/* SPD_MODULE_VOLTAGE values. */
160#define SPD_VOLTAGE_TTL 0 /* 5.0 Volt/TTL */
161#define SPD_VOLTAGE_LVTTL 1 /* LVTTL */
162#define SPD_VOLTAGE_HSTL 2 /* HSTL 1.5 */
163#define SPD_VOLTAGE_SSTL3 3 /* SSTL 3.3 */
164#define SPD_VOLTAGE_SSTL2 4 /* SSTL 2.5 */
Elyes HAOUAS46bfce32016-06-15 19:05:11 +0200165#define SPD_VOLTAGE_SSTL1 5 /* SSTL 1.8 */
Stefan Reinauereca92fb2006-08-23 14:28:37 +0000166
Uwe Hermann998a57c2006-11-22 11:41:32 +0000167/* SPD_DIMM_CONFIG_TYPE values. */
168#define ERROR_SCHEME_NONE 0
169#define ERROR_SCHEME_PARITY 1
170#define ERROR_SCHEME_ECC 2
Stefan Reinauereca92fb2006-08-23 14:28:37 +0000171
Uwe Hermann998a57c2006-11-22 11:41:32 +0000172/* SPD_ACCEPTABLE_CAS_LATENCIES values. */
173// TODO: Check values.
174#define SPD_CAS_LATENCY_1_0 0x01
175#define SPD_CAS_LATENCY_1_5 0x02
176#define SPD_CAS_LATENCY_2_0 0x04
177#define SPD_CAS_LATENCY_2_5 0x08
178#define SPD_CAS_LATENCY_3_0 0x10
179#define SPD_CAS_LATENCY_3_5 0x20
180#define SPD_CAS_LATENCY_4_0 0x40
Stefan Reinauereca92fb2006-08-23 14:28:37 +0000181
Elyes HAOUAS89186b22016-06-26 17:46:21 +0200182#define SPD_CAS_LATENCY_DDR2_2 (1 << 2)
Stefan Reinauer951c62f2008-08-01 11:40:16 +0000183#define SPD_CAS_LATENCY_DDR2_3 (1 << 3)
184#define SPD_CAS_LATENCY_DDR2_4 (1 << 4)
185#define SPD_CAS_LATENCY_DDR2_5 (1 << 5)
186#define SPD_CAS_LATENCY_DDR2_6 (1 << 6)
Elyes HAOUASd4506092016-05-26 19:53:29 +0200187#define SPD_CAS_LATENCY_DDR2_7 (1 << 7)
Stefan Reinauer951c62f2008-08-01 11:40:16 +0000188
Uwe Hermann998a57c2006-11-22 11:41:32 +0000189/* SPD_SUPPORTED_BURST_LENGTHS values. */
190#define SPD_BURST_LENGTH_1 1
191#define SPD_BURST_LENGTH_2 2
192#define SPD_BURST_LENGTH_4 4
193#define SPD_BURST_LENGTH_8 8
194#define SPD_BURST_LENGTH_PAGE (1 << 7)
Stefan Reinauereca92fb2006-08-23 14:28:37 +0000195
Uwe Hermann998a57c2006-11-22 11:41:32 +0000196/* SPD_MODULE_ATTRIBUTES values. */
197#define MODULE_BUFFERED 1
198#define MODULE_REGISTERED 2
Stefan Reinauereca92fb2006-08-23 14:28:37 +0000199
Elyes HAOUASc8d24dd2016-06-15 21:13:07 +0200200#define SPD_UNDEFINED 0x00
Raul E Rangel21db6cc2018-03-29 10:18:14 -0600201#define SPD_ECC_8BIT (1<<3)
Subrata Banik3306f372021-10-26 13:19:20 +0530202#define SPD_ECC_8BIT_LP5_DDR5 (1<<4)
Raul E Rangel21db6cc2018-03-29 10:18:14 -0600203
Elyes Haouasaec294a2022-11-07 09:18:08 +0100204/* Byte 3 [3:0]: DDR3 Module type information */
Subrata Banik6de8b422021-10-26 20:46:21 +0530205enum ddr3_module_type {
206 DDR3_SPD_RDIMM = 0x01,
207 DDR3_SPD_UDIMM = 0x02,
208 DDR3_SPD_SODIMM = 0x03,
209 DDR3_SPD_MICRO_DIMM = 0x04,
210 DDR3_SPD_MINI_RDIMM = 0x05,
211 DDR3_SPD_MINI_UDIMM = 0x06,
212 DDR3_SPD_MINI_CDIMM = 0x07,
213 DDR3_SPD_72B_SO_UDIMM = 0x08,
214 DDR3_SPD_72B_SO_RDIMM = 0x09,
215 DDR3_SPD_72B_SO_CDIMM = 0x0a,
216 DDR3_SPD_LRDIMM = 0x0b,
217 DDR3_SPD_16B_SO_DIMM = 0x0c,
218 DDR3_SPD_32B_SO_RDIMM = 0x0d,
219};
220
Elyes Haouasaec294a2022-11-07 09:18:08 +0100221/* Byte 3 [3:0]: DDR4 Module type information */
Subrata Banik6de8b422021-10-26 20:46:21 +0530222enum ddr4_module_type {
223 DDR4_SPD_RDIMM = 0x01,
224 DDR4_SPD_UDIMM = 0x02,
225 DDR4_SPD_SODIMM = 0x03,
226 DDR4_SPD_LRDIMM = 0x04,
227 DDR4_SPD_MINI_RDIMM = 0x05,
228 DDR4_SPD_MINI_UDIMM = 0x06,
Elyes Haouasec97e0a2022-03-07 17:30:02 +0100229 DDR4_SPD_72B_SO_RDIMM = 0x08,
230 DDR4_SPD_72B_SO_UDIMM = 0x09,
Subrata Banik6de8b422021-10-26 20:46:21 +0530231 DDR4_SPD_16B_SO_DIMM = 0x0c,
232 DDR4_SPD_32B_SO_RDIMM = 0x0d,
233};
234
235enum ddr5_module_type {
236 DDR5_SPD_RDIMM = 0x01,
237 DDR5_SPD_UDIMM = 0x02,
238 DDR5_SPD_SODIMM = 0x03,
239 DDR5_SPD_LRDIMM = 0x04,
240 DDR5_SPD_MINI_RDIMM = 0x05,
241 DDR5_SPD_MINI_UDIMM = 0x06,
242 DDR5_SPD_72B_SO_UDIMM = 0x08,
243 DDR5_SPD_72B_SO_RDIMM = 0x09,
244 DDR5_SPD_SOLDERED_DOWN = 0x0b,
245 DDR5_SPD_16B_SO_DIMM = 0x0c,
246 DDR5_SPD_32B_SO_RDIMM = 0x0d,
247 DDR5_SPD_1DPC = 0x0e,
248 DDR5_SPD_2DPC = 0x0f,
249};
250
251enum lpx_module_type {
252 LPX_SPD_LPDIMM = 0x07,
253 LPX_SPD_NONDIMM = 0x0e,
254};
255
Uwe Hermannd773fd32010-11-20 20:23:08 +0000256#endif