On 03/04/14 07:49, Siarhei Siamashka wrote:
>
> I would guess that the .tpr settings, bundled with .cas=6, are likely
> assuming 400MHz memory clock speed. Which also agrees with the tRFC
> hardcoded values as you mentioned above. And also with the A10
> and A20 user manuals, which specify 0~400MHz range for SDRAM_clk.
>
> The .cas=9 style sets of timings are likely very conservative and
> assuming memory clock speeds up to 667MHz if we take the cas value
> as a hint. If we are running dram at around 480MHz, these settings
> may unnecessarily sacrifice some performance.

I found some documentation for TPR registers in the rk30xx manual from
radxa. Their dram controller is pretty much different, but comparing the
default values and settable bits of the TPR registers makes it likely
that at least these registers have nearly the same bitfields.

This makes the .cas=6 set look like:
tMRD = 2, tRTP = 4, tWTR = 4, tRP = 6, tRCD = 6,
tRAS = 18, tRRD = 4, tRC = 24, tCCD = 0
tAOND_tAOFD = 0, tRTW = 0, tFAW = 18, tMOD = 0, tRTODT = 0
tXS = 200, tXP = 8, tCKE = 3

Assuming this is valid, we can do some trail and error again and try to
figure out the original timings.

As it turns out, your guess was pretty good. The settings *exactly*
match DDR2(!)-800E speed bin at 400MHz. Its DDR2 again, as with tRFC.
Interesting part is, if we assume DDR3-1333H chips (as on cubieboard)
many parameters are still in spec up to 480MHz (not all however, tFAW,
tXS and what else I missed not).

And for the .cas=9 set, most settings match DDR3-1333H speed bin at
667MHz. But some settings, like tFAW and tXP are too low,
they only fit for ~420MHz.

tMRD = 3, tRTP = 5, tWTR = 5, tRP = 9, tRCD = 9,
tRAS = 24, tRRD = 6, tRC = 33, tCCD = 0
tAOND_tAOFD = 0, tRTW = 0, tFAW = 18, tMOD = 0, tRTODT = 0
tXS = 512, tXP = 10, tCKE = 4

I tried to calculate the correct parameters for 480MHz on cubietruck,
and currently lima-memtester is running without any errors till now. I
first accidentally kept the clock at 432MHz and only changed the tprs,
and even that gave a ~150MB/s boost at tinymembench compared to the
original values.
This is highly experimental, but if somebody wants to try (only
cubietruck, other dram chips need different timings):
.clock = 480
.cas = 7
.tpr0 = 0x30b27790
.tpr1 = 0x0000a078
.tpr2 = 0x0001b200

These timings are calculated by hand, but maybe this could lead to some
program or even function in u-boot that calculates matching parameters
for given dram chip type and speed.

Last warning, all numbers were juggled around many times and I did never
check them again, so they could easily be wrong. But the overall idea
should be correct.

Jens

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to linux-sunxi+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to