diff options
author | Aneesh V <aneesh@ti.com> | 2012-04-27 08:24:03 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-05-02 03:04:06 -0400 |
commit | 9c1c21a0533aa37a475e8e8cce7ee064ed771881 (patch) | |
tree | 7a6ff2d0c49a31196da5bb8b486c7c9db7bcb98f | |
parent | 516cf1be07cf3ab52e6d2f64da33b0fa5d9e0042 (diff) |
ddr: add LPDDR2 data from JESD209-2
add LPDDR2 data from the JEDEC spec JESD209-2. The data
includes:
1. Addressing information for LPDDR2 memories of different
densities and types(S2/S4)
2. AC timing data.
This data will useful for memory controller device drivers.
Right now this is used by the TI EMIF SDRAM controller
driver.
Signed-off-by: Aneesh V <aneesh@ti.com>
Reviewed-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Reviewed-by: Benoit Cousson <b-cousson@ti.com>
[santosh.shilimkar@ti.com: Moved to drivers/memory from drivers/misc]
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Tested-by: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | include/memory/jedec_ddr.h | 175 | ||||
-rw-r--r-- | lib/Kconfig | 8 | ||||
-rw-r--r-- | lib/Makefile | 2 | ||||
-rw-r--r-- | lib/jedec_ddr_data.c | 135 |
4 files changed, 320 insertions, 0 deletions
diff --git a/include/memory/jedec_ddr.h b/include/memory/jedec_ddr.h new file mode 100644 index 000000000000..ddad0f870e5d --- /dev/null +++ b/include/memory/jedec_ddr.h | |||
@@ -0,0 +1,175 @@ | |||
1 | /* | ||
2 | * Definitions for DDR memories based on JEDEC specs | ||
3 | * | ||
4 | * Copyright (C) 2012 Texas Instruments, Inc. | ||
5 | * | ||
6 | * Aneesh V <aneesh@ti.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | #ifndef __LINUX_JEDEC_DDR_H | ||
13 | #define __LINUX_JEDEC_DDR_H | ||
14 | |||
15 | #include <linux/types.h> | ||
16 | |||
17 | /* DDR Densities */ | ||
18 | #define DDR_DENSITY_64Mb 1 | ||
19 | #define DDR_DENSITY_128Mb 2 | ||
20 | #define DDR_DENSITY_256Mb 3 | ||
21 | #define DDR_DENSITY_512Mb 4 | ||
22 | #define DDR_DENSITY_1Gb 5 | ||
23 | #define DDR_DENSITY_2Gb 6 | ||
24 | #define DDR_DENSITY_4Gb 7 | ||
25 | #define DDR_DENSITY_8Gb 8 | ||
26 | #define DDR_DENSITY_16Gb 9 | ||
27 | #define DDR_DENSITY_32Gb 10 | ||
28 | |||
29 | /* DDR type */ | ||
30 | #define DDR_TYPE_DDR2 1 | ||
31 | #define DDR_TYPE_DDR3 2 | ||
32 | #define DDR_TYPE_LPDDR2_S4 3 | ||
33 | #define DDR_TYPE_LPDDR2_S2 4 | ||
34 | #define DDR_TYPE_LPDDR2_NVM 5 | ||
35 | |||
36 | /* DDR IO width */ | ||
37 | #define DDR_IO_WIDTH_4 1 | ||
38 | #define DDR_IO_WIDTH_8 2 | ||
39 | #define DDR_IO_WIDTH_16 3 | ||
40 | #define DDR_IO_WIDTH_32 4 | ||
41 | |||
42 | /* Number of Row bits */ | ||
43 | #define R9 9 | ||
44 | #define R10 10 | ||
45 | #define R11 11 | ||
46 | #define R12 12 | ||
47 | #define R13 13 | ||
48 | #define R14 14 | ||
49 | #define R15 15 | ||
50 | #define R16 16 | ||
51 | |||
52 | /* Number of Column bits */ | ||
53 | #define C7 7 | ||
54 | #define C8 8 | ||
55 | #define C9 9 | ||
56 | #define C10 10 | ||
57 | #define C11 11 | ||
58 | #define C12 12 | ||
59 | |||
60 | /* Number of Banks */ | ||
61 | #define B1 0 | ||
62 | #define B2 1 | ||
63 | #define B4 2 | ||
64 | #define B8 3 | ||
65 | |||
66 | /* Refresh rate in nano-seconds */ | ||
67 | #define T_REFI_15_6 15600 | ||
68 | #define T_REFI_7_8 7800 | ||
69 | #define T_REFI_3_9 3900 | ||
70 | |||
71 | /* tRFC values */ | ||
72 | #define T_RFC_90 90000 | ||
73 | #define T_RFC_110 110000 | ||
74 | #define T_RFC_130 130000 | ||
75 | #define T_RFC_160 160000 | ||
76 | #define T_RFC_210 210000 | ||
77 | #define T_RFC_300 300000 | ||
78 | #define T_RFC_350 350000 | ||
79 | |||
80 | /* Mode register numbers */ | ||
81 | #define DDR_MR0 0 | ||
82 | #define DDR_MR1 1 | ||
83 | #define DDR_MR2 2 | ||
84 | #define DDR_MR3 3 | ||
85 | #define DDR_MR4 4 | ||
86 | #define DDR_MR5 5 | ||
87 | #define DDR_MR6 6 | ||
88 | #define DDR_MR7 7 | ||
89 | #define DDR_MR8 8 | ||
90 | #define DDR_MR9 9 | ||
91 | #define DDR_MR10 10 | ||
92 | #define DDR_MR11 11 | ||
93 | #define DDR_MR16 16 | ||
94 | #define DDR_MR17 17 | ||
95 | #define DDR_MR18 18 | ||
96 | |||
97 | /* | ||
98 | * LPDDR2 related defines | ||
99 | */ | ||
100 | |||
101 | /* MR4 register fields */ | ||
102 | #define MR4_SDRAM_REF_RATE_SHIFT 0 | ||
103 | #define MR4_SDRAM_REF_RATE_MASK 7 | ||
104 | #define MR4_TUF_SHIFT 7 | ||
105 | #define MR4_TUF_MASK (1 << 7) | ||
106 | |||
107 | /* MR4 SDRAM Refresh Rate field values */ | ||
108 | #define SDRAM_TEMP_NOMINAL 0x3 | ||
109 | #define SDRAM_TEMP_RESERVED_4 0x4 | ||
110 | #define SDRAM_TEMP_HIGH_DERATE_REFRESH 0x5 | ||
111 | #define SDRAM_TEMP_HIGH_DERATE_REFRESH_AND_TIMINGS 0x6 | ||
112 | #define SDRAM_TEMP_VERY_HIGH_SHUTDOWN 0x7 | ||
113 | |||
114 | #define NUM_DDR_ADDR_TABLE_ENTRIES 11 | ||
115 | #define NUM_DDR_TIMING_TABLE_ENTRIES 4 | ||
116 | |||
117 | /* Structure for DDR addressing info from the JEDEC spec */ | ||
118 | struct lpddr2_addressing { | ||
119 | u32 num_banks; | ||
120 | u32 tREFI_ns; | ||
121 | u32 tRFCab_ps; | ||
122 | }; | ||
123 | |||
124 | /* | ||
125 | * Structure for timings from the LPDDR2 datasheet | ||
126 | * All parameters are in pico seconds(ps) unless explicitly indicated | ||
127 | * with a suffix like tRAS_max_ns below | ||
128 | */ | ||
129 | struct lpddr2_timings { | ||
130 | u32 max_freq; | ||
131 | u32 min_freq; | ||
132 | u32 tRPab; | ||
133 | u32 tRCD; | ||
134 | u32 tWR; | ||
135 | u32 tRAS_min; | ||
136 | u32 tRRD; | ||
137 | u32 tWTR; | ||
138 | u32 tXP; | ||
139 | u32 tRTP; | ||
140 | u32 tCKESR; | ||
141 | u32 tDQSCK_max; | ||
142 | u32 tDQSCK_max_derated; | ||
143 | u32 tFAW; | ||
144 | u32 tZQCS; | ||
145 | u32 tZQCL; | ||
146 | u32 tZQinit; | ||
147 | u32 tRAS_max_ns; | ||
148 | }; | ||
149 | |||
150 | /* | ||
151 | * Min value for some parameters in terms of number of tCK cycles(nCK) | ||
152 | * Please set to zero parameters that are not valid for a given memory | ||
153 | * type | ||
154 | */ | ||
155 | struct lpddr2_min_tck { | ||
156 | u32 tRPab; | ||
157 | u32 tRCD; | ||
158 | u32 tWR; | ||
159 | u32 tRASmin; | ||
160 | u32 tRRD; | ||
161 | u32 tWTR; | ||
162 | u32 tXP; | ||
163 | u32 tRTP; | ||
164 | u32 tCKE; | ||
165 | u32 tCKESR; | ||
166 | u32 tFAW; | ||
167 | }; | ||
168 | |||
169 | extern const struct lpddr2_addressing | ||
170 | lpddr2_jedec_addressing_table[NUM_DDR_ADDR_TABLE_ENTRIES]; | ||
171 | extern const struct lpddr2_timings | ||
172 | lpddr2_jedec_timings[NUM_DDR_TIMING_TABLE_ENTRIES]; | ||
173 | extern const struct lpddr2_min_tck lpddr2_jedec_min_tck; | ||
174 | |||
175 | #endif /* __LINUX_JEDEC_DDR_H */ | ||
diff --git a/lib/Kconfig b/lib/Kconfig index 4a8aba2e5cc0..0e25c03939e3 100644 --- a/lib/Kconfig +++ b/lib/Kconfig | |||
@@ -353,6 +353,14 @@ config CORDIC | |||
353 | This option provides an implementation of the CORDIC algorithm; | 353 | This option provides an implementation of the CORDIC algorithm; |
354 | calculations are in fixed point. Module will be called cordic. | 354 | calculations are in fixed point. Module will be called cordic. |
355 | 355 | ||
356 | config DDR | ||
357 | bool "JEDEC DDR data" | ||
358 | help | ||
359 | Data from JEDEC specs for DDR SDRAM memories, | ||
360 | particularly the AC timing parameters and addressing | ||
361 | information. This data is useful for drivers handling | ||
362 | DDR SDRAM controllers. | ||
363 | |||
356 | config MPILIB | 364 | config MPILIB |
357 | tristate | 365 | tristate |
358 | select CLZ_TAB | 366 | select CLZ_TAB |
diff --git a/lib/Makefile b/lib/Makefile index 18515f0267c4..74290c9e2864 100644 --- a/lib/Makefile +++ b/lib/Makefile | |||
@@ -123,6 +123,8 @@ obj-$(CONFIG_SIGNATURE) += digsig.o | |||
123 | 123 | ||
124 | obj-$(CONFIG_CLZ_TAB) += clz_tab.o | 124 | obj-$(CONFIG_CLZ_TAB) += clz_tab.o |
125 | 125 | ||
126 | obj-$(CONFIG_DDR) += jedec_ddr_data.o | ||
127 | |||
126 | hostprogs-y := gen_crc32table | 128 | hostprogs-y := gen_crc32table |
127 | clean-files := crc32table.h | 129 | clean-files := crc32table.h |
128 | 130 | ||
diff --git a/lib/jedec_ddr_data.c b/lib/jedec_ddr_data.c new file mode 100644 index 000000000000..6d2cbf1d567f --- /dev/null +++ b/lib/jedec_ddr_data.c | |||
@@ -0,0 +1,135 @@ | |||
1 | /* | ||
2 | * DDR addressing details and AC timing parameters from JEDEC specs | ||
3 | * | ||
4 | * Copyright (C) 2012 Texas Instruments, Inc. | ||
5 | * | ||
6 | * Aneesh V <aneesh@ti.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #include <memory/jedec_ddr.h> | ||
14 | #include <linux/module.h> | ||
15 | |||
16 | /* LPDDR2 addressing details from JESD209-2 section 2.4 */ | ||
17 | const struct lpddr2_addressing | ||
18 | lpddr2_jedec_addressing_table[NUM_DDR_ADDR_TABLE_ENTRIES] = { | ||
19 | {B4, T_REFI_15_6, T_RFC_90}, /* 64M */ | ||
20 | {B4, T_REFI_15_6, T_RFC_90}, /* 128M */ | ||
21 | {B4, T_REFI_7_8, T_RFC_90}, /* 256M */ | ||
22 | {B4, T_REFI_7_8, T_RFC_90}, /* 512M */ | ||
23 | {B8, T_REFI_7_8, T_RFC_130}, /* 1GS4 */ | ||
24 | {B8, T_REFI_3_9, T_RFC_130}, /* 2GS4 */ | ||
25 | {B8, T_REFI_3_9, T_RFC_130}, /* 4G */ | ||
26 | {B8, T_REFI_3_9, T_RFC_210}, /* 8G */ | ||
27 | {B4, T_REFI_7_8, T_RFC_130}, /* 1GS2 */ | ||
28 | {B4, T_REFI_3_9, T_RFC_130}, /* 2GS2 */ | ||
29 | }; | ||
30 | EXPORT_SYMBOL_GPL(lpddr2_jedec_addressing_table); | ||
31 | |||
32 | /* LPDDR2 AC timing parameters from JESD209-2 section 12 */ | ||
33 | const struct lpddr2_timings | ||
34 | lpddr2_jedec_timings[NUM_DDR_TIMING_TABLE_ENTRIES] = { | ||
35 | /* Speed bin 400(200 MHz) */ | ||
36 | [0] = { | ||
37 | .max_freq = 200000000, | ||
38 | .min_freq = 10000000, | ||
39 | .tRPab = 21000, | ||
40 | .tRCD = 18000, | ||
41 | .tWR = 15000, | ||
42 | .tRAS_min = 42000, | ||
43 | .tRRD = 10000, | ||
44 | .tWTR = 10000, | ||
45 | .tXP = 7500, | ||
46 | .tRTP = 7500, | ||
47 | .tCKESR = 15000, | ||
48 | .tDQSCK_max = 5500, | ||
49 | .tFAW = 50000, | ||
50 | .tZQCS = 90000, | ||
51 | .tZQCL = 360000, | ||
52 | .tZQinit = 1000000, | ||
53 | .tRAS_max_ns = 70000, | ||
54 | .tDQSCK_max_derated = 6000, | ||
55 | }, | ||
56 | /* Speed bin 533(266 MHz) */ | ||
57 | [1] = { | ||
58 | .max_freq = 266666666, | ||
59 | .min_freq = 10000000, | ||
60 | .tRPab = 21000, | ||
61 | .tRCD = 18000, | ||
62 | .tWR = 15000, | ||
63 | .tRAS_min = 42000, | ||
64 | .tRRD = 10000, | ||
65 | .tWTR = 7500, | ||
66 | .tXP = 7500, | ||
67 | .tRTP = 7500, | ||
68 | .tCKESR = 15000, | ||
69 | .tDQSCK_max = 5500, | ||
70 | .tFAW = 50000, | ||
71 | .tZQCS = 90000, | ||
72 | .tZQCL = 360000, | ||
73 | .tZQinit = 1000000, | ||
74 | .tRAS_max_ns = 70000, | ||
75 | .tDQSCK_max_derated = 6000, | ||
76 | }, | ||
77 | /* Speed bin 800(400 MHz) */ | ||
78 | [2] = { | ||
79 | .max_freq = 400000000, | ||
80 | .min_freq = 10000000, | ||
81 | .tRPab = 21000, | ||
82 | .tRCD = 18000, | ||
83 | .tWR = 15000, | ||
84 | .tRAS_min = 42000, | ||
85 | .tRRD = 10000, | ||
86 | .tWTR = 7500, | ||
87 | .tXP = 7500, | ||
88 | .tRTP = 7500, | ||
89 | .tCKESR = 15000, | ||
90 | .tDQSCK_max = 5500, | ||
91 | .tFAW = 50000, | ||
92 | .tZQCS = 90000, | ||
93 | .tZQCL = 360000, | ||
94 | .tZQinit = 1000000, | ||
95 | .tRAS_max_ns = 70000, | ||
96 | .tDQSCK_max_derated = 6000, | ||
97 | }, | ||
98 | /* Speed bin 1066(533 MHz) */ | ||
99 | [3] = { | ||
100 | .max_freq = 533333333, | ||
101 | .min_freq = 10000000, | ||
102 | .tRPab = 21000, | ||
103 | .tRCD = 18000, | ||
104 | .tWR = 15000, | ||
105 | .tRAS_min = 42000, | ||
106 | .tRRD = 10000, | ||
107 | .tWTR = 7500, | ||
108 | .tXP = 7500, | ||
109 | .tRTP = 7500, | ||
110 | .tCKESR = 15000, | ||
111 | .tDQSCK_max = 5500, | ||
112 | .tFAW = 50000, | ||
113 | .tZQCS = 90000, | ||
114 | .tZQCL = 360000, | ||
115 | .tZQinit = 1000000, | ||
116 | .tRAS_max_ns = 70000, | ||
117 | .tDQSCK_max_derated = 5620, | ||
118 | }, | ||
119 | }; | ||
120 | EXPORT_SYMBOL_GPL(lpddr2_jedec_timings); | ||
121 | |||
122 | const struct lpddr2_min_tck lpddr2_jedec_min_tck = { | ||
123 | .tRPab = 3, | ||
124 | .tRCD = 3, | ||
125 | .tWR = 3, | ||
126 | .tRASmin = 3, | ||
127 | .tRRD = 2, | ||
128 | .tWTR = 2, | ||
129 | .tXP = 2, | ||
130 | .tRTP = 2, | ||
131 | .tCKE = 3, | ||
132 | .tCKESR = 3, | ||
133 | .tFAW = 8 | ||
134 | }; | ||
135 | EXPORT_SYMBOL_GPL(lpddr2_jedec_min_tck); | ||