forked from ssvb/a10-dram-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
a10-dram-info.rb
384 lines (341 loc) · 13.5 KB
/
a10-dram-info.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
# Copyright © 2014 Siarhei Siamashka <[email protected]>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
###############################################################################
def tRFC_ns(density)
return 350.0 if not density
return { 512 => 90.0, 1024 => 110.0, 2048 => 160.0,
4096 => 300.0, 8192 => 350.0}[density]
end
###############################################################################
# JEDEC speed bin DDR3-800E
###############################################################################
def derive_from_JEDEC_DDR3_800_6_6_6(extra_info)
density = extra_info[:density]
page_size = extra_info[:page_size]
def tFAW_ns(page_size) return {1024 => 40.0, 2048 => 50.0}[page_size] end
def tRRD_ns(page_size) return {1024 => 10.0, 2048 => 10.0}[page_size] end
timings_info = {
# tCK CL CWL
:tCK => [[ 2.5, 6, 5]], # 300MHz - 400MHz
:tXS => {:ns => tRFC_ns(density) + 10.0},
:tRCD => {:ns => 15.0},
:tRP => {:ns => 15.0},
:tRC => {:ns => 52.5},
:tRAS => {:ns => 37.5},
:tFAW => {:ns => tFAW_ns(page_size)},
:tRRD => {:ck => 4, :ns => tRRD_ns(page_size)},
:tCKE => {:ck => 3, :ns => 7.5},
:tWTR => {:ck => 4, :ns => 7.5},
:tXP => {:ck => 3, :ns => 7.5},
:tXPDLL => {:ck => 10, :ns => 24.0},
:tMRD => {:ck => 4},
:tRTP => {:ck => 4, :ns => 7.5},
:tWR => {:ns => 15.0},
:tDLLK => {:ck => 512},
:tMOD => {:ck => 12, :ns => 15.0},
:tRFC => {:ns => tRFC_ns(density)},
:tCCD => {:ck => 4},
:density => density,
}
# And override some of the timings by the externally provided data
extra_info.each {|k, v| timings_info[k] = v }
return timings_info
end
###############################################################################
# JEDEC speed bin DDR3-1066F
###############################################################################
def derive_from_JEDEC_DDR3_1066_7_7_7(extra_info)
density = extra_info[:density]
page_size = extra_info[:page_size]
def tFAW_ns(page_size) return {1024 => 37.5, 2048 => 50.0}[page_size] end
def tRRD_ns(page_size) return {1024 => 7.5, 2048 => 10.0}[page_size] end
timings_info = {
# tCK CL CWL
:tCK => [[ 2.5, 6, 5], # 300MHz - 400MHz
[1.875, 7, 6]], # 400MHz - 533MHz
:tXS => {:ns => tRFC_ns(density) + 10.0},
:tRCD => {:ns => 13.125},
:tRP => {:ns => 13.125},
:tRC => {:ns => 50.625},
:tRAS => {:ns => 37.5},
:tFAW => {:ns => tFAW_ns(page_size)},
:tRRD => {:ck => 4, :ns => tRRD_ns(page_size)},
:tCKE => {:ck => 3, :ns => 5.625},
:tWTR => {:ck => 4, :ns => 7.5},
:tXP => {:ck => 3, :ns => 7.5},
:tXPDLL => {:ck => 10, :ns => 24.0},
:tMRD => {:ck => 4},
:tRTP => {:ck => 4, :ns => 7.5},
:tWR => {:ns => 15.0},
:tDLLK => {:ck => 512},
:tMOD => {:ck => 12, :ns => 15.0},
:tRFC => {:ns => tRFC_ns(density)},
:tCCD => {:ck => 4},
:density => density,
}
# And override some of the timings by the externally provided data
extra_info.each {|k, v| timings_info[k] = v }
return timings_info
end
###############################################################################
# JEDEC speed bin DDR3-1066G
###############################################################################
def derive_from_JEDEC_DDR3_1066_8_8_8(extra_info)
density = extra_info[:density]
page_size = extra_info[:page_size]
def tFAW_ns(page_size) return {1024 => 37.5, 2048 => 50.0}[page_size] end
def tRRD_ns(page_size) return {1024 => 7.5, 2048 => 10.0}[page_size] end
timings_info = {
# tCK CL CWL
:tCK => [[ 2.5, 6, 5], # 300MHz - 400MHz
[1.875, 8, 6]], # 400MHz - 533MHz
:tXS => {:ns => tRFC_ns(density) + 10.0},
:tRCD => {:ns => 15.0},
:tRP => {:ns => 15.0},
:tRC => {:ns => 52.5},
:tRAS => {:ns => 37.5},
:tFAW => {:ns => tFAW_ns(page_size)},
:tRRD => {:ck => 4, :ns => tRRD_ns(page_size)},
:tCKE => {:ck => 3, :ns => 5.625},
:tWTR => {:ck => 4, :ns => 7.5},
:tXP => {:ck => 3, :ns => 7.5},
:tXPDLL => {:ck => 10, :ns => 24.0},
:tMRD => {:ck => 4},
:tRTP => {:ck => 4, :ns => 7.5},
:tWR => {:ns => 15.0},
:tDLLK => {:ck => 512},
:tMOD => {:ck => 12, :ns => 15.0},
:tRFC => {:ns => tRFC_ns(density)},
:tCCD => {:ck => 4},
:density => density,
}
# And override some of the timings by the externally provided data
extra_info.each {|k, v| timings_info[k] = v }
return timings_info
end
###############################################################################
# JEDEC speed bin DDR3-1333H
###############################################################################
def derive_from_JEDEC_DDR3_1333_9_9_9(extra_info)
density = extra_info[:density]
page_size = extra_info[:page_size]
def tFAW_ns(page_size) return {1024 => 30.0, 2048 => 45.0}[page_size] end
def tRRD_ns(page_size) return {1024 => 6.0, 2048 => 7.5}[page_size] end
timings_info = {
# tCK CL CWL
:tCK => [[ 2.5, 6, 5], # 300MHz - 400MHz
[1.875, 8, 6], # 400MHz - 533MHz
[ 1.5, 9, 7]], # 533MHz - 667MHz
:tXS => {:ns => tRFC_ns(density) + 10.0},
:tRCD => {:ns => 13.5},
:tRP => {:ns => 13.5},
:tRC => {:ns => 49.5},
:tRAS => {:ns => 36.0},
:tFAW => {:ns => tFAW_ns(page_size)},
:tRRD => {:ck => 4, :ns => tRRD_ns(page_size)},
:tCKE => {:ck => 3, :ns => 5.625},
:tWTR => {:ck => 4, :ns => 7.5},
:tXP => {:ck => 3, :ns => 6.0},
:tXPDLL => {:ck => 10, :ns => 24.0},
:tMRD => {:ck => 4},
:tRTP => {:ck => 4, :ns => 7.5},
:tWR => {:ns => 15.0},
:tDLLK => {:ck => 512},
:tMOD => {:ck => 12, :ns => 15.0},
:tRFC => {:ns => tRFC_ns(density)},
:tCCD => {:ck => 4},
:density => density,
}
# And override some of the timings by the externally provided data
extra_info.each {|k, v| timings_info[k] = v }
return timings_info
end
###############################################################################
# JEDEC speed bin DDR3-1333J
###############################################################################
def derive_from_JEDEC_DDR3_1333_10_10_10(extra_info)
density = extra_info[:density]
page_size = extra_info[:page_size]
def tFAW_ns(page_size) return {1024 => 30.0, 2048 => 45.0}[page_size] end
def tRRD_ns(page_size) return {1024 => 6.0, 2048 => 7.5}[page_size] end
timings_info = {
# tCK CL CWL
:tCK => [[ 2.5, 6, 5], # 300MHz - 400MHz
[1.875, 8, 6], # 400MHz - 533MHz
[ 1.5, 10, 7]], # 533MHz - 667MHz
:tXS => {:ns => tRFC_ns(density) + 10.0},
:tRCD => {:ns => 15.0},
:tRP => {:ns => 15.0},
:tRC => {:ns => 51.0},
:tRAS => {:ns => 36.0},
:tFAW => {:ns => tFAW_ns(page_size)},
:tRRD => {:ck => 4, :ns => tRRD_ns(page_size)},
:tCKE => {:ck => 3, :ns => 5.625},
:tWTR => {:ck => 4, :ns => 7.5},
:tXP => {:ck => 3, :ns => 6.0},
:tXPDLL => {:ck => 10, :ns => 24.0},
:tMRD => {:ck => 4},
:tRTP => {:ck => 4, :ns => 7.5},
:tWR => {:ns => 15.0},
:tDLLK => {:ck => 512},
:tMOD => {:ck => 12, :ns => 15.0},
:tRFC => {:ns => tRFC_ns(density)},
:tCCD => {:ck => 4},
:density => density,
}
# And override some of the timings by the externally provided data
extra_info.each {|k, v| timings_info[k] = v }
return timings_info
end
###############################################################################
# This is using a bit wrong datasheet, but we are optimistically assuming
# that GT8UB512M8_BG has the same timings as GT8UB256M8_BG
GT8UB512M8_BG = derive_from_JEDEC_DDR3_1333_9_9_9({
:density => 4096,
:page_size => 1024,
:io_width => 8,
:label => "GT GT8UB512M 8EN-BG",
:url => "http://dl.linux-sunxi.org/chips/GT-DDR3-2Gbit-B-DIE-(X8,X16).pdf",
:tRCD => {:ns => 13.125},
:tRP => {:ns => 13.125},
:tRTW => {:ck => 0}, # 0 - default, 1 - extra cycle
:tRTODT => {:ck => 0}, # 0 - default, 1 - extra cycle
})
GT8UB256M16_BG = derive_from_JEDEC_DDR3_1333_9_9_9({
:density => 4096,
:page_size => 2048,
:io_width => 16,
:label => "GT GT8UB256M16BP-BG",
:url => "http://dl.linux-sunxi.org/chips/GT-DDR3-2Gbit-B-DIE-(X8,X16).pdf",
:tRCD => {:ns => 13.125},
:tRP => {:ns => 13.125},
:tRTW => {:ck => 0}, # 0 - default, 1 - extra cycle
:tRTODT => {:ck => 0}, # 0 - default, 1 - extra cycle
})
###############################################################################
# It is DDR3-1600, but we still derive from DDR-1333 9-9-9 and just
# tweak the timings
MEM4G16D3EABG_125 = derive_from_JEDEC_DDR3_1333_9_9_9({
:density => 4096,
:page_size => 2048,
:io_width => 16,
:label => "MEMPHIS MEM4G16D3E ABG-125",
:url => "http://www.memphis.ag/fileadmin/datasheets/MEM4G16D3EABG_10.pdf",
:tRCD => {:ns => 13.125},
:tRP => {:ns => 13.125},
:tRC => {:ns => 48.125},
:tRAS => {:ns => 35.0},
:tFAW => {:ns => 30.0},
:tRRD => {:ck => 4, :ns => 6.0},
:tCKE => {:ck => 3, :ns => 5.0},
:tRFC => {:ns => 260.0},
:tRTW => {:ck => 0}, # 0 - default, 1 - extra cycle
:tRTODT => {:ck => 0}, # 0 - default, 1 - extra cycle
})
###############################################################################
H5TQ2G63BFR = derive_from_JEDEC_DDR3_1333_9_9_9({
:density => 2048,
:page_size => 2048,
:io_width => 16,
:label => "Hynix H5TQ2G63BFR",
:url => "http://hands.com/~lkcl/H5TQ2G63BFR.pdf",
:tRTW => {:ck => 0}, # 0 - default, 1 - extra cycle
:tRTODT => {:ck => 0}, # 0 - default, 1 - extra cycle
})
###############################################################################
GENERIC_DDR3_1333 = derive_from_JEDEC_DDR3_1333_9_9_9({
:page_size => 2048,
:io_width => 16,
:tRTW => {:ck => 0}, # 0 - default, 1 - extra cycle
:tRTODT => {:ck => 0}, # 0 - default, 1 - extra cycle
})
###############################################################################
def get_generic_board()
return {
dram_chip: GENERIC_DDR3_1333,
dram_para: {
zq: 123,
odt_en: 0,
tpr3: 0,
tpr4: 0,
emr1: 0,
}
}
end
def get_the_list_of_boards()
return {
"Cubieboard" => {
url: "http://linux-sunxi.org/Cubietech_Cubieboard",
dram_size: 1024,
dram_chip: GT8UB256M16_BG,
dram_para: {
zq: 123,
odt_en: 0,
tpr3: 0,
tpr4: 0,
emr1: 0,
}
},
"Cubieboard2" => {
url: "http://linux-sunxi.org/Cubietech_Cubieboard2",
dram_size: 1024,
dram_chip: GT8UB256M16_BG,
dram_para: {
zq: 0x7f,
odt_en: 0,
tpr3: 0,
tpr4: 0x1,
emr1: 0x4,
}
},
"Cubietruck" => {
url: "http://linux-sunxi.org/Cubietruck",
dram_size: 2048,
dram_chip: GT8UB512M8_BG,
dram_para: {
zq: 0x7f,
odt_en: 0,
tpr3: 0x72222,
tpr4: 0x1,
emr1: 0x4,
}
},
"A10-OLinuXino-Lime" => {
url: "http://linux-sunxi.org/Olimex_A10-OLinuXino-Lime",
dram_size: 512,
dram_chip: MEM4G16D3EABG_125,
dram_para: {
zq: 123,
odt_en: 0,
tpr3: 0,
tpr4: 0,
emr1: 0x4,
}
},
"Mele_A1000" => {
url: "http://linux-sunxi.org/Mele_A1000",
dram_size: 512,
dram_chip: H5TQ2G63BFR,
dram_para: {
zq: 123,
odt_en: 0,
tpr3: 0,
tpr4: 0,
emr1: 0,
}
},
}
end