sdramphy/initsequence: fix and add format_mr0 function

This commit is contained in:
Florent Kermarrec 2014-08-13 16:44:20 +02:00 committed by Sebastien Bourdeauducq
parent 9844c25df9
commit 85b29c883a
1 changed files with 31 additions and 23 deletions

View File

@ -161,6 +161,8 @@ const unsigned int dfii_pix_rddata_addr[{n}] = {{
bl = 2*sdram_phy.phy_settings.nphases
if bl != 8:
raise NotImplementedError("DDR3 PHY header generator only supports BL of 8")
def format_mr0(cl, wr, dll_reset):
cl_to_mr0 = {
5 : 0b0010,
6 : 0b0100,
@ -183,7 +185,13 @@ const unsigned int dfii_pix_rddata_addr[{n}] = {{
12: 0b110,
14: 0b111
}
mr0 = cl_to_mr0[cl] << 4 | 1 << 8 | wr_to_mr0[8] # FIXME: this should be ceiling(tWR/tCK)
mr0 = (cl_to_mr0[cl] & 1) << 2
mr0 |= ((cl_to_mr0[cl] >> 1) & 0b111) << 4
mr0 |= dll_reset << 8
mr0 |= wr_to_mr0[wr] << 9
return mr0
mr0 = format_mr0(cl, 8, 1) # wr=8 FIXME: this should be ceiling(tWR/tCK)
mr1 = 6 # Output Drive Strength RZQ/7 (34 ohm) / Rtt RZQ/4 (60 ohm)
mr2 = (sdram_phy.phy_settings.cwl-5) << 3
mr3 = 0