1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Definitions for DDR memories based on JEDEC specs
5 * Copyright (C) 2012 Texas Instruments, Inc.
7 * Aneesh V <aneesh@ti.com>
12 #include <linux/types.h>
15 #define DDR_DENSITY_64Mb 1
16 #define DDR_DENSITY_128Mb 2
17 #define DDR_DENSITY_256Mb 3
18 #define DDR_DENSITY_512Mb 4
19 #define DDR_DENSITY_1Gb 5
20 #define DDR_DENSITY_2Gb 6
21 #define DDR_DENSITY_4Gb 7
22 #define DDR_DENSITY_8Gb 8
23 #define DDR_DENSITY_16Gb 9
24 #define DDR_DENSITY_32Gb 10
27 #define DDR_TYPE_DDR2 1
28 #define DDR_TYPE_DDR3 2
29 #define DDR_TYPE_LPDDR2_S4 3
30 #define DDR_TYPE_LPDDR2_S2 4
31 #define DDR_TYPE_LPDDR2_NVM 5
32 #define DDR_TYPE_LPDDR3 6
35 #define DDR_IO_WIDTH_4 1
36 #define DDR_IO_WIDTH_8 2
37 #define DDR_IO_WIDTH_16 3
38 #define DDR_IO_WIDTH_32 4
40 /* Number of Row bits */
50 /* Number of Column bits */
64 /* Refresh rate in nano-seconds */
65 #define T_REFI_15_6 15600
66 #define T_REFI_7_8 7800
67 #define T_REFI_3_9 3900
70 #define T_RFC_90 90000
71 #define T_RFC_110 110000
72 #define T_RFC_130 130000
73 #define T_RFC_160 160000
74 #define T_RFC_210 210000
75 #define T_RFC_300 300000
76 #define T_RFC_350 350000
78 /* Mode register numbers */
96 * LPDDR2 related defines
99 /* MR4 register fields */
100 #define MR4_SDRAM_REF_RATE_SHIFT 0
101 #define MR4_SDRAM_REF_RATE_MASK 7
102 #define MR4_TUF_SHIFT 7
103 #define MR4_TUF_MASK (1 << 7)
105 /* MR4 SDRAM Refresh Rate field values */
106 #define SDRAM_TEMP_NOMINAL 0x3
107 #define SDRAM_TEMP_RESERVED_4 0x4
108 #define SDRAM_TEMP_HIGH_DERATE_REFRESH 0x5
109 #define SDRAM_TEMP_HIGH_DERATE_REFRESH_AND_TIMINGS 0x6
110 #define SDRAM_TEMP_VERY_HIGH_SHUTDOWN 0x7
112 #define NUM_DDR_ADDR_TABLE_ENTRIES 11
113 #define NUM_DDR_TIMING_TABLE_ENTRIES 4
115 #define LPDDR2_MANID_SAMSUNG 1
116 #define LPDDR2_MANID_QIMONDA 2
117 #define LPDDR2_MANID_ELPIDA 3
118 #define LPDDR2_MANID_ETRON 4
119 #define LPDDR2_MANID_NANYA 5
120 #define LPDDR2_MANID_HYNIX 6
121 #define LPDDR2_MANID_MOSEL 7
122 #define LPDDR2_MANID_WINBOND 8
123 #define LPDDR2_MANID_ESMT 9
124 #define LPDDR2_MANID_SPANSION 11
125 #define LPDDR2_MANID_SST 12
126 #define LPDDR2_MANID_ZMOS 13
127 #define LPDDR2_MANID_INTEL 14
128 #define LPDDR2_MANID_NUMONYX 254
129 #define LPDDR2_MANID_MICRON 255
131 #define LPDDR2_TYPE_S4 0
132 #define LPDDR2_TYPE_S2 1
133 #define LPDDR2_TYPE_NVM 2
135 /* Structure for DDR addressing info from the JEDEC spec */
136 struct lpddr2_addressing {
143 * Structure for timings from the LPDDR2 datasheet
144 * All parameters are in pico seconds(ps) unless explicitly indicated
145 * with a suffix like tRAS_max_ns below
147 struct lpddr2_timings {
160 u32 tDQSCK_max_derated;
169 * Min value for some parameters in terms of number of tCK cycles(nCK)
170 * Please set to zero parameters that are not valid for a given memory
173 struct lpddr2_min_tck {
187 extern const struct lpddr2_addressing
188 lpddr2_jedec_addressing_table[NUM_DDR_ADDR_TABLE_ENTRIES];
189 extern const struct lpddr2_timings
190 lpddr2_jedec_timings[NUM_DDR_TIMING_TABLE_ENTRIES];
191 extern const struct lpddr2_min_tck lpddr2_jedec_min_tck;
193 /* Structure of MR8 */
194 union lpddr2_basic_config4 {
198 unsigned int arch_type : 2;
199 unsigned int density : 4;
200 unsigned int io_width : 2;
205 * Structure for information about LPDDR2 chip. All parameters are
206 * matching raw values of standard mode register bitfields or set to
207 * -ENOENT if info unavailable.
218 const char *lpddr2_jedec_manufacturer(unsigned int manufacturer_id);
221 * Structure for timings for LPDDR3 based on LPDDR2 plus additional fields.
222 * All parameters are in pico seconds(ps) excluding max_freq, min_freq which
225 struct lpddr3_timings {
252 * Min value for some parameters in terms of number of tCK cycles(nCK)
253 * Please set to zero parameters that are not valid for a given memory
256 struct lpddr3_min_tck {
280 #endif /* __JEDEC_DDR_H */