Skip to content

Commit d78c4a6

Browse files
committed
driver: fix DDR2 W9751G6NB timing for sam9x7 sip
The number of tRC cycles is between 0 and 15. When tRC is greater than or equal to 60 ns, the maximum supported frequency is 250 MHz. When the frequency is higher than 200 MHz, an offset of one is added automatically. In such case, tRC must be set to 15 to match the value. If the frequency is higher than 200MHz, the CAS latency must be set higher than 3. For sam9x7, the frequency is 266MHz, the CAS should be 5. Adjust the DDR2 timings(tRCD, tRP, tRC and tRAS) with DDR2-800D @cl=5. Signed-off-by: Xing Chen <[email protected]>
1 parent c34739b commit d78c4a6

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

device/sam9x7/sam9x7.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ void hw_init(void)
331331

332332
reg = readl(AT91C_BASE_SFR + SFR_DDRCFG);
333333

334-
#ifdef CONFIG_DDR3
334+
#if defined(CONFIG_DDR2) || defined(CONFIG_DDR3)
335335
reg |= (AT91C_EBI_CS1A | AT91C_EBI_DDR_MP_EN);
336336
writel(reg, (AT91C_BASE_SFR + SFR_DDRCFG));
337337
/* Initialize DDRAM Controller */

driver/ddramc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,13 @@ static void ddram_reg_config(struct ddramc_register *ddramc_config)
130130
dbw = AT91C_DDRC2_DBW_16_BITS;
131131
col = AT91C_DDRC2_NC_DDR10_SDR9;
132132
row = AT91C_DDRC2_NR_13;
133-
cas = AT91C_DDRC2_CAS_3;
134133
bank = AT91C_DDRC2_NB_BANKS_4;
135134
#if defined(CONFIG_BUS_SPEED_200MHZ)
135+
cas = AT91C_DDRC2_CAS_3;
136136
/* Refresh Timer is (64ms / 8k) * 116MHz = 1562(0x61a) */
137137
ddramc_config->rtr = 0x61a;
138138
#elif defined(CONFIG_BUS_SPEED_266MHZ)
139+
cas = AT91C_DDRC2_CAS_5;
139140
/* Refresh Timer is (64ms / 8k) * 116MHz = 2078(0x81e) */
140141
ddramc_config->rtr = 0x81e;
141142
#else

include/ddr_device.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,22 +202,22 @@ static const struct ddram_timings ddr_ddram_timings = {
202202
.tfaw = 8,
203203
#elif defined(CONFIG_BUS_SPEED_266MHZ)
204204
.tras = 12,
205-
.trcd = 3,
205+
.trcd = 4,
206206
.twr = 4,
207207
.trc = 15,
208-
.trp = 3,
208+
.trp = 4,
209209
.trrd = 3,
210210
.twtr = 2,
211211
.tmrd = 2,
212212
.trfc = 28,
213-
.txsnr = 38,
213+
.txsnr = 31,
214214
.txsrd = 200,
215215
.txp = 2,
216216
.txard = 2,
217-
.txards = 6,
218-
.trpa = 3,
217+
.txards = 8,
218+
.trpa = 5,
219219
.trtp = 2,
220-
.tfaw = 10,
220+
.tfaw = 12,
221221
#endif
222222
#elif defined(CONFIG_DDR_W632GU6MB)
223223
/* Two DDR3L(W632GU6MB-12 = 16 Mbit x 16 x 8 banks), total 4 Gbit on SAMA5D2 ICP*/

0 commit comments

Comments
 (0)