lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | /* |
| 2 | * ddr.c |
| 3 | * |
| 4 | * Copyright(c) 2016 ZXIC Inc. All rights reserved. |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #include <common.h> |
| 9 | #include <asm/io.h> |
| 10 | #include <board.h> |
| 11 | #include <ddr.h> |
| 12 | #include <asm/arch/top_clock.h> |
| 13 | |
| 14 | #define _DDR_BYPASS_MODE 1 //1//1: 312m; 0:400m |
| 15 | #if !_DDR_BYPASS_MODE |
| 16 | #define _DDR_DS_48om |
| 17 | #endif |
| 18 | |
| 19 | #define _DDR32M_BYPASS_MODE 0 //1//1: 312m; 0:400m |
| 20 | #if !_DDR32M_BYPASS_MODE |
| 21 | //#define _DDR32M_DS_48om //-40du 48ohm has problem,modify to 60ohm |
| 22 | #endif |
| 23 | /***************************************** |
| 24 | * Routine: nsdelay |
| 25 | * Description: Configure DDR |
| 26 | *****************************************/ |
| 27 | |
| 28 | void nsdelay(volatile int count) |
| 29 | { |
| 30 | volatile int cnt = 0; |
| 31 | |
| 32 | while(cnt<count) |
| 33 | { |
| 34 | cnt++; |
| 35 | } |
| 36 | return; |
| 37 | } |
| 38 | |
| 39 | |
| 40 | /***************************************** |
| 41 | * Routine: ddr_init |
| 42 | * Description: Configure DDR |
| 43 | *****************************************/ |
| 44 | #ifdef DDR_FFC |
| 45 | static UINT32 g_PhyReg[DDR_CLKEND][4]={0};//g_PhyReg[N][0]~PHY_PHYREGN[N][3]·Ö±ð´æ´¢PHYREGFB~FE |
| 46 | |
| 47 | void pow_DdrClkConfig(T_zDrvPow_DDRCLK clock_value) |
| 48 | { |
| 49 | UINT32 rdata; |
| 50 | |
| 51 | if(clock_value>=DDR_CLKEND) |
| 52 | return; |
| 53 | |
| 54 | rdata = __REG(MOD_CLK_SEL)&0xfffffffc; |
| 55 | switch (clock_value) |
| 56 | { |
| 57 | //DDR top clock select, bit0-1, 0=156, 1=200, 2=104, 3=78 |
| 58 | case DDR_156M: |
| 59 | { |
| 60 | __REG(MOD_CLK_SEL) = rdata|3; |
| 61 | break; |
| 62 | } |
| 63 | case DDR_208M: |
| 64 | { |
| 65 | __REG(MOD_CLK_SEL) = rdata|2; |
| 66 | break; |
| 67 | } |
| 68 | case DDR_312M: |
| 69 | { |
| 70 | __REG(MOD_CLK_SEL) = rdata|0; |
| 71 | break; |
| 72 | } |
| 73 | case DDR_400M: |
| 74 | { |
| 75 | __REG(MOD_CLK_SEL) = rdata|1; |
| 76 | break; |
| 77 | } |
| 78 | default: |
| 79 | break; |
| 80 | } |
| 81 | |
| 82 | } |
| 83 | |
| 84 | void pow_DdrFreqDivFactorConfig(T_zDrvPow_DDRCLK clock_value) |
| 85 | { |
| 86 | if(clock_value>=DDR_CLKEND) |
| 87 | return; |
| 88 | |
| 89 | //pow_DdrPllPowerdown(); |
| 90 | |
| 91 | __REG(DDR_PHY_BASE+0x3b0) =0; |
| 92 | __REG(DDR_PHY_BASE+0x3b4) &= ~0x1;//fbdiv[8]=0 |
| 93 | __REG(DDR_PHY_BASE+0x3b8) =0; |
| 94 | |
| 95 | /****************************************** |
| 96 | Fclk4x = Fref ¡Á N ¡Â M ¡Â P |
| 97 | 0x013043b0:bit7~0--fbdiv[7:0] |
| 98 | 0x013043b4:bit4--PLL clock out enable, |
| 99 | bit1--PLL power down enable |
| 100 | bit0--fbdiv[8] |
| 101 | 0x013043b8:bit7~5--postdiv, |
| 102 | bit4~0--prediv |
| 103 | N=fbdiv[8:0] |
| 104 | M=prediv[4:0] |
| 105 | P=2^postdiv[2:0]; |
| 106 | |
| 107 | fref N M P |
| 108 | 10~20m 64 1 16 |
| 109 | 21~50M 32 1 8 |
| 110 | 51~100M 32 2 4 |
| 111 | 101~200M 16 2 2 |
| 112 | 201~400M 16 4 1 |
| 113 | ******************************************/ |
| 114 | switch (clock_value) |
| 115 | { |
| 116 | case DDR_156M://Fref=78m |
| 117 | { |
| 118 | __REG(DDR_PHY_BASE+0x3b0) =32 ;//N=fbdiv[7:0]=32 |
| 119 | __REG(DDR_PHY_BASE+0x3b8) =(2<<5)|(2<<0) ;//postdiv=2; M=prediv=2 |
| 120 | break; |
| 121 | } |
| 122 | case DDR_208M:////Fref=104m |
| 123 | { |
| 124 | __REG(DDR_PHY_BASE+0x3b0) =16 ;//N=fbdiv[7:0]=16 |
| 125 | __REG(DDR_PHY_BASE+0x3b8) =(1<<5)|(2<<0) ;//postdiv=1; M=prediv=2 |
| 126 | break; |
| 127 | } |
| 128 | case DDR_312M://Fref=156m |
| 129 | { |
| 130 | __REG(DDR_PHY_BASE+0x3b0) =16 ;//N=fbdiv[7:0]=16 |
| 131 | __REG(DDR_PHY_BASE+0x3b8) =(1<<5)|(2<<0) ;//postdiv=1; M=prediv=2 |
| 132 | break; |
| 133 | } |
| 134 | case DDR_400M://Fref=200m |
| 135 | { |
| 136 | __REG(DDR_PHY_BASE+0x3b0) =16 ;//N=fbdiv[7:0]=16 |
| 137 | __REG(DDR_PHY_BASE+0x3b8) =(1<<5)|(2<<0) ;//postdiv=0; M=prediv=4 |
| 138 | break; |
| 139 | } |
| 140 | default: |
| 141 | break; |
| 142 | } |
| 143 | |
| 144 | //pow_DdrPllPoweron(); |
| 145 | |
| 146 | } |
| 147 | |
| 148 | |
| 149 | void pow_DdrPllDllLock(void) |
| 150 | { |
| 151 | |
| 152 | //ʹÄÜÁË0x00146000+0x4c*4µÄbit7£¬Ôò½øÈí¼þ×Ôˢкópll»ápowerdown£¬lockÐźÅûÓÐÁË |
| 153 | //Í˳ö×ÔˢкóÓ²¼þ»á×Ô¶¯´¥·¢pll lock£¬Èí¼þÖ»ÐèÒªµÈlockÐźŠ|
| 154 | //wait phy pll lock |
| 155 | while((__REG(DDR_PHY_BASE + 0x3e0)&0x1)!=0x1); |
| 156 | //start dll init ,ϽµÑØ´¥·¢ |
| 157 | __REG(DDR_PHY_BASE + 0x17c) = 0x2a; |
| 158 | __REG(DDR_PHY_BASE + 0x17c) = 0xa; |
| 159 | nsdelay(2); |
| 160 | //wait phy dll lock,phy init done, |
| 161 | while((__REG(DDR_PHY_BASE + 0x3e0)&0x3)!=0x3); |
| 162 | } |
| 163 | |
| 164 | void pow_DdrTraining(T_zDrvPow_DDRCLK clock_value) |
| 165 | { |
| 166 | //phy DQS gate training start |
| 167 | __REG(DDR_PHY_BASE+0x02*4)=0x1;; |
| 168 | nsdelay(1); |
| 169 | //Ñ»·¼ì²âtraining over |
| 170 | while( (__REG(DDR_PHY_BASE+ 0xff*4)&0xf) != 0xf); |
| 171 | |
| 172 | g_PhyReg[clock_value][0]=__REG(DDR_PHY_BASE+0xfb*4); |
| 173 | g_PhyReg[clock_value][1]=__REG(DDR_PHY_BASE+0xfc*4); |
| 174 | g_PhyReg[clock_value][2]=__REG(DDR_PHY_BASE+0xfd*4); |
| 175 | g_PhyReg[clock_value][3]=__REG(DDR_PHY_BASE+0xfe*4); |
| 176 | |
| 177 | //phy DQS gate training stop |
| 178 | __REG(DDR_PHY_BASE+0x02*4)=0x0; |
| 179 | } |
| 180 | |
| 181 | |
| 182 | /******************************************************************************* |
| 183 | * Function:pow_DdrChangeClk |
| 184 | * Description: |
| 185 | * Parameters: |
| 186 | * Input: |
| 187 | * |
| 188 | * Output: |
| 189 | * |
| 190 | * Returns: |
| 191 | * |
| 192 | * |
| 193 | * Others: |
| 194 | ********************************************************************************/ |
| 195 | void pow_DdrChangeClk(T_zDrvPow_DDRCLK clock_value) |
| 196 | { |
| 197 | |
| 198 | /* PWRCTL[5].selfref_sw=1, ʹ¿ØÖÆÆ÷½øÈëÈí¼þ×ÔË¢ÐÂģʽ*/ |
| 199 | __REG(CRTL_PWRCTL) |= (1<<SELFREF_SW); |
| 200 | |
| 201 | /*Ñ»·¼ì²âÖ±µ½STAT[2:0]==3'b011ÇÒSTAT[5:4]==2'b10£¬DDR´¦ÓÚÈí¼þ×ÔË¢ÐÂ״̬*/ |
| 202 | while( (__REG(CTRL_STAT) & 0x37 ) !=0x23); |
| 203 | |
| 204 | //ÅäÖÃϵͳCRM½øÐÐʱÖÓÇл» |
| 205 | pow_DdrClkConfig(clock_value); |
| 206 | |
| 207 | //¸ù¾ÝƵÂÊÅäÖÃPHY PLLÄ¿±êƵµãµÄ·ÖƵϵÊý |
| 208 | pow_DdrFreqDivFactorConfig(clock_value); |
| 209 | |
| 210 | |
| 211 | //Ö»¹ØÊ±ÖÓ/ÇÐÆµ²»¶Ïµç£¬½øÈëÈí¼þ×ÔˢУ¬phy½øÉî˯Ãߣ¬pll»á¹Ø±Õ£¬ |
| 212 | //Í˳öʱ»á×Ô¶¯´ò¿ªÆÚ¼ä²»ÓöÔpll½øÐпª¹Ø,ÒªµÈpll/dll lock, |
| 213 | pow_DdrPllDllLock(); |
| 214 | |
| 215 | //Éϵç³õʼ»¯½øÐÐÇÐÆµtrainingѵÁ·Ê±£¬ |
| 216 | //ÔòÅäÖüĴæÆ÷PHYREG02[0]=1£¬â§·¢dqs gate training¡£ |
| 217 | //È»ºóÑ»·¶ÁÈ¡PHYREGFF£¬Ö±µ½bit[3:0]Ϊ0xf£¬training¹ý³ÌÍê³É£¬ |
| 218 | //¼Ç¼¼Ä´æÆ÷PHYREGFB~FEµÄÖµ |
| 219 | |
| 220 | /* PWRCTL[5].selfref_sw=0, ʹ¿ØÖÆÆ÷Í˳öÈí¼þ×ÔË¢ÐÂģʽ*/ |
| 221 | __REG(CRTL_PWRCTL) &= ~(1<<SELFREF_SW); |
| 222 | |
| 223 | /* Ñ»·¼ì²âÖ±µ½STAT[2:0]==3'b001ÇÒSTAT[5:4]==2'b00£¬DDRÍ˳öÈí¼þ×ÔˢУ¬´¦ÓÚnormal״̬*/ |
| 224 | while( (__REG(CTRL_STAT) & 0x37 ) !=0x1); |
| 225 | /*traning*/ |
| 226 | pow_DdrTraining(clock_value); |
| 227 | |
| 228 | |
| 229 | } |
| 230 | |
| 231 | |
| 232 | void save_ddr_training(UINT32 count, T_zDrvPow_DDRCLK clock_value) |
| 233 | { |
| 234 | __REG(DDR_FFC_ADDR_BASE+0x70*count+0x54) = g_PhyReg[clock_value][0]; |
| 235 | __REG(DDR_FFC_ADDR_BASE+0x70*count+0x58) = g_PhyReg[clock_value][1]; |
| 236 | __REG(DDR_FFC_ADDR_BASE+0x70*count+0x5c) = g_PhyReg[clock_value][2]; |
| 237 | __REG(DDR_FFC_ADDR_BASE+0x70*count+0x60) = g_PhyReg[clock_value][3]; |
| 238 | |
| 239 | } |
| 240 | |
| 241 | void ddr_ffc_init(void) |
| 242 | { |
| 243 | UINT32 count; |
| 244 | __REG(STD_CRM_REG_BASE + 0x100) |= (0xf << 24); //release ddr ffc work and apb |
| 245 | for(count = 0; count <= 3; count++) |
| 246 | { |
| 247 | pow_DdrChangeClk(count); |
| 248 | save_ddr_training(count,count); |
| 249 | } |
| 250 | pow_DdrChangeClk(DDR_312M); |
| 251 | } |
| 252 | #endif |
| 253 | |
| 254 | #define ABSa_b(a,b) (((a) > (b)) ? (a-b) : (b-a)) |
| 255 | |
| 256 | int ddr_clk_init(int flag) |
| 257 | { |
| 258 | //DDR top clock select top clk 156M, bit0-1, 0=156, 1=200, 2=104, 3=78 |
| 259 | // 0: top clk=156M, ddr use mission mode , dram io clk=312M |
| 260 | // 1: top clk=200M, ddr use mission mode , dram io clk=400M |
| 261 | // 2: top clk=104M, ddr use mission mode , dram io clk=208M |
| 262 | // 3: top clk=78M, ddr use mission mode , dram io clk=156M |
| 263 | if(flag == CHIP_DDR_IS_32M) |
| 264 | { |
| 265 | #if _DDR32M_BYPASS_MODE |
| 266 | __REG( 0x01306050 ) = 0x00000000 ; //·ÖƵÉèÖ㬶ÔÓ¦ÐèÒªÐÞ¸ÄÂð |
| 267 | #else |
| 268 | __REG( 0x01306050 ) = 0x00000001 ; //·ÖƵÉèÖ㬶ÔÓ¦ÐèÒªÐÞ¸ÄÂð |
| 269 | #endif |
| 270 | } |
| 271 | else |
| 272 | { |
| 273 | #if _DDR_BYPASS_MODE |
| 274 | __REG( 0x01306050 ) = 0x00000000 ; //·ÖƵÉèÖ㬶ÔÓ¦ÐèÒªÐÞ¸ÄÂð |
| 275 | #else |
| 276 | __REG( 0x01306050 ) = 0x00000001 ; //·ÖƵÉèÖ㬶ÔÓ¦ÐèÒªÐÞ¸ÄÂð |
| 277 | #endif |
| 278 | } |
| 279 | |
| 280 | return 0; |
| 281 | |
| 282 | } |
| 283 | |
| 284 | int ddr_phy_init(int flag) |
| 285 | { |
| 286 | if(flag == CHIP_DDR_IS_32M) |
| 287 | { |
| 288 | __REG( 0x00154000 ) = 0x0000003f ; //VALUE_PHYREG00 0x0000003f(16bit ddr) default: 0x000000ff(32bit ddr) |
| 289 | } |
| 290 | |
| 291 | __REG( 0x00154004 ) = 0x00000007 ; //VALUE_PHYREG01 / Reserved:RW:2:6:=0x1, PHY_MODE:RW:0:2:=0x2(LPDDR2:0x3,LPDDR3:0x2) |
| 292 | __REG( 0x0015402c ) = 0x00000080 ; //VALUE_PHYREG0B / RL:RW:4:4:=0x8 |
| 293 | __REG( 0x00154030 ) = 0x00000004 ; //VALUE_PHYREG0C / WL:RW:0:4:=0x4 |
| 294 | |
| 295 | __REG( 0x001543b0 ) = 0x00000010 ; //VALUE_PHYREGEC / fbdiv[7:0]=0x10 |
| 296 | __REG( 0x001543b4 ) = 0x0000001a ; //VALUE_PHYREGED / PLLCLKOUTEN:RW:4:1:=0x1,Reserved:RW:2:2:=0x2, pllpd:RW:1:1:=0x1, fbdiv[8]:RW:0:1:=0x0 |
| 297 | __REG( 0x001543b8 ) = 0x00000022 ; //VALUE_PHYREGEE / prediv[4:0]:RW:0:5:=0x2,postdiv[2:0]:RW:5:3:=0x1 |
| 298 | |
| 299 | if(flag == CHIP_DDR_IS_32M) |
| 300 | { |
| 301 | #ifndef _DDR32M_DS_48om //60ohm |
| 302 | __REG( 0x00154044 )= 0x00000008; //VALUE_PHYREG11 / CMD drive strength: cmd_nrcomp[4:0]:RW:0:5:=0xa |
| 303 | __REG(0x00154058 )= 0x00000008; //VALUE_PHYREG16 / CK drive strength: ck_nrcomp [4:0]:RW:0:5:=0xa |
| 304 | __REG(0x00154064 )= 0x00000008; //VALUE_PHYREG19 / CK pull_up drive strength(DS):RW:0:5:=0xa |
| 305 | __REG(0x00154068 )= 0x00000008; //VALUE_PHYREG1A / CMD pull_up drive strength(DS):RW:0:5:=0xa |
| 306 | __REG(0x00154080 )= 0x00000008; //VALUE_PHYREG20 / A_DQ0~A_DQ7 pull_down DS :RW:0:5:=0xa |
| 307 | __REG(0x00154084 )= 0x00000004; //VALUE_PHYREG21 / A_DQ0~A_DQ7 pull_down ODT:RW:0:5:=0xa |
| 308 | __REG(0x001540b8 )= 0x00000088; //VALUE_PHYREG2E / A_DQ0~A_DQ7 pull_up DS :RW:0:5:=0xa, falling edge slew rate:RW:5:3:=0x4 |
| 309 | __REG(0x001540bc )= 0x00000084; //VALUE_PHYREG2F / A_DQ0~A_DQ7 pull_up ODT:RW:0:5:=0xa, rising edge slew rate:RW:5:3:=0x4 |
| 310 | __REG(0x001540c0 )= 0x00000088; //VALUE_PHYREG30 / A_DQ8~A_DQ15 pull_down DS :RW:0:5:=0xa, falling edge slew rate:RW:5:3:=0x4 |
| 311 | __REG(0x001540c4 )= 0x00000084; //VALUE_PHYREG31 / A_DQ8~A_DQ15 pull_down ODT:RW:0:5:=0xa, rising edge slew rate:RW:5:3:=0x4 |
| 312 | __REG(0x001540f8 )= 0x00000008; //VALUE_PHYREG3E / A_DQ8~A_DQ15 pull_up DS :RW:0:5:=0xa |
| 313 | __REG(0x001540fc )= 0x00000004; //VALUE_PHYREG3F / A_DQ8~A_DQ15 pull_up ODT:RW:0:5:=0xa |
| 314 | |
| 315 | __REG(0x00154100 )= 0x00000008; //VALUE_PHYREG40 / B_DQ0~B_DQ7 pull_down DS :RW:0:5:=0xa |
| 316 | __REG(0x00154104 )= 0x00000004; //VALUE_PHYREG41 / B_DQ0~B_DQ7 pull_down ODT:RW:0:5:=0xa |
| 317 | __REG(0x00154138 )= 0x00000088; //VALUE_PHYREG4E / B_DQ0~B_DQ7 pull_up DS :RW:0:5:=0xa, falling edge slew rate:RW:5:3:=0x4 |
| 318 | __REG(0x0015413c )= 0x00000084; //VALUE_PHYREG4F / B_DQ0~B_DQ7 pull_up ODT:RW:0:5:=0xa, rising edge slew rate:RW:5:3:=0x4 |
| 319 | |
| 320 | __REG(0x00154140 )= 0x00000088; //VALUE_PHYREG50 / B_DQ8~B_DQ15 pull_down DS :RW:0:5:=0xa, falling edge slew rate:RW:5:3:=0x4 |
| 321 | __REG(0x00154144 )= 0x00000084; //VALUE_PHYREG51 / B_DQ8~B_DQ15 pull_down ODT:RW:0:5:=0xa, rising edge slew rate:RW:5:3:=0x4 |
| 322 | __REG(0x00154178 )= 0x00000008; //VALUE_PHYREG5E / B_DQ8~B_DQ15 pull_up DS :RW:0:5:=0xa |
| 323 | __REG(0x0015417c )= 0x00000024; //VALUE_PHYREG5F / B_DQ8~B_DQ15 pull_up ODT:RW:0:5:=0xa |
| 324 | #else //48om |
| 325 | //Drive strength(defualt) ODT µÈЧ48om |
| 326 | __REG( 0x00154044 ) = 0x0000000a ; //VALUE_PHYREG11 / CMD drive strength: cmd_prcomp[3:0]:RW:4:4:=0xa,cmd_nrcomp[3:0]:RW:0:4:=0xa |
| 327 | __REG( 0x00154058 ) = 0x0000000a ; //VALUE_PHYREG16 / CK drive strength: ck_prcomp [3:0]:RW:4:4:=0xa,ck_nrcomp [3:0]:RW:0:4:=0xa |
| 328 | __REG( 0x00154064 ) = 0x0000000a ; //VALUE_PHYREG19 / CK pull_up drive strength(DS):RW:0:5:=0xa |
| 329 | __REG( 0x00154068 ) = 0x0000000a ; //VALUE_PHYREG1A / CMD pull_up drive strength(DS):RW:0:5:=0xa |
| 330 | __REG( 0x00154080 ) = 0x0000000a ; //VALUE_PHYREG20 / A_DQ0~A_DQ7 pull_down DS :RW:0:5:=0xa |
| 331 | __REG( 0x00154084 ) = 0x00000005 ; //VALUE_PHYREG21 / A_DQ0~A_DQ7 pull_down ODT:RW:0:5:=0xa |
| 332 | __REG( 0x001540b8 ) = 0x0000008a ; //VALUE_PHYREG2E / A_DQ0~A_DQ7 pull_up DS :RW:0:5:=0xa, falling edge slew rate:RW:5:3:=0x4 |
| 333 | __REG( 0x001540bc ) = 0x00000085 ; //VALUE_PHYREG2F / A_DQ0~A_DQ7 pull_up ODT:RW:0:5:=0xa, rising edge slew rate:RW:5:3:=0x4 |
| 334 | __REG( 0x001540c0 ) = 0x0000008a ; //VALUE_PHYREG30 / A_DQ8~A_DQ15 pull_down DS :RW:0:5:=0xa, falling edge slew rate:RW:5:3:=0x4 |
| 335 | __REG( 0x001540c4 ) = 0x00000085 ; //VALUE_PHYREG31 / A_DQ8~A_DQ15 pull_down ODT:RW:0:5:=0xa, rising edge slew rate:RW:5:3:=0x4 |
| 336 | __REG( 0x001540f8 ) = 0x0000000a ; //VALUE_PHYREG3E / A_DQ8~A_DQ15 pull_up DS :RW:0:5:=0xa |
| 337 | __REG( 0x001540fc ) = 0x00000005 ; //VALUE_PHYREG3F / A_DQ8~A_DQ15 pull_up ODT:RW:0:5:=0xa |
| 338 | |
| 339 | __REG( 0x00154100 ) = 0x0000000a ; //VALUE_PHYREG40 / B_DQ0~B_DQ7 pull_down DS :RW:0:5:=0xa |
| 340 | __REG( 0x00154104 ) = 0x00000005 ; //VALUE_PHYREG41 / B_DQ0~B_DQ7 pull_down ODT:RW:0:5:=0xa |
| 341 | __REG( 0x00154138 ) = 0x0000008a ; //VALUE_PHYREG4E / B_DQ0~B_DQ7 pull_up DS :RW:0:5:=0xa, falling edge slew rate:RW:5:3:=0x4 |
| 342 | __REG( 0x0015413c ) = 0x00000085 ; //VALUE_PHYREG4F / B_DQ0~B_DQ7 pull_up ODT:RW:0:5:=0xa, rising edge slew rate:RW:5:3:=0x4 |
| 343 | |
| 344 | __REG( 0x00154140 ) = 0x0000008a ; //VALUE_PHYREG50 / B_DQ8~B_DQ15 pull_down DS :RW:0:5:=0xa, falling edge slew rate:RW:5:3:=0x4 |
| 345 | __REG( 0x00154144 ) = 0x00000085 ; //VALUE_PHYREG51 / B_DQ8~B_DQ15 pull_down ODT:RW:0:5:=0xa, rising edge slew rate:RW:5:3:=0x4 |
| 346 | __REG( 0x00154178 ) = 0x0000000a ; //VALUE_PHYREG5E / B_DQ8~B_DQ15 pull_up DS :RW:0:5:=0xa |
| 347 | __REG( 0x0015417c ) = 0x00000025 ; //VALUE_PHYREG5F / B_DQ8~B_DQ15 pull_up ODT:RW:0:5:=0xa |
| 348 | #endif |
| 349 | |
| 350 | } |
| 351 | else |
| 352 | { |
| 353 | #ifndef _DDR_DS_48om //60ohm |
| 354 | __REG( 0x00154044 )= 0x00000008; //VALUE_PHYREG11 / CMD drive strength: cmd_nrcomp[4:0]:RW:0:5:=0xa |
| 355 | __REG(0x00154058 )= 0x00000008; //VALUE_PHYREG16 / CK drive strength: ck_nrcomp [4:0]:RW:0:5:=0xa |
| 356 | __REG(0x00154064 )= 0x00000008; //VALUE_PHYREG19 / CK pull_up drive strength(DS):RW:0:5:=0xa |
| 357 | __REG(0x00154068 )= 0x00000008; //VALUE_PHYREG1A / CMD pull_up drive strength(DS):RW:0:5:=0xa |
| 358 | __REG(0x00154080 )= 0x00000008; //VALUE_PHYREG20 / A_DQ0~A_DQ7 pull_down DS :RW:0:5:=0xa |
| 359 | __REG(0x00154084 )= 0x00000004; //VALUE_PHYREG21 / A_DQ0~A_DQ7 pull_down ODT:RW:0:5:=0xa |
| 360 | __REG(0x001540b8 )= 0x00000088; //VALUE_PHYREG2E / A_DQ0~A_DQ7 pull_up DS :RW:0:5:=0xa, falling edge slew rate:RW:5:3:=0x4 |
| 361 | __REG(0x001540bc )= 0x00000084; //VALUE_PHYREG2F / A_DQ0~A_DQ7 pull_up ODT:RW:0:5:=0xa, rising edge slew rate:RW:5:3:=0x4 |
| 362 | __REG(0x001540c0 )= 0x00000088; //VALUE_PHYREG30 / A_DQ8~A_DQ15 pull_down DS :RW:0:5:=0xa, falling edge slew rate:RW:5:3:=0x4 |
| 363 | __REG(0x001540c4 )= 0x00000084; //VALUE_PHYREG31 / A_DQ8~A_DQ15 pull_down ODT:RW:0:5:=0xa, rising edge slew rate:RW:5:3:=0x4 |
| 364 | __REG(0x001540f8 )= 0x00000008; //VALUE_PHYREG3E / A_DQ8~A_DQ15 pull_up DS :RW:0:5:=0xa |
| 365 | __REG(0x001540fc )= 0x00000004; //VALUE_PHYREG3F / A_DQ8~A_DQ15 pull_up ODT:RW:0:5:=0xa |
| 366 | |
| 367 | __REG(0x00154100 )= 0x00000008; //VALUE_PHYREG40 / B_DQ0~B_DQ7 pull_down DS :RW:0:5:=0xa |
| 368 | __REG(0x00154104 )= 0x00000004; //VALUE_PHYREG41 / B_DQ0~B_DQ7 pull_down ODT:RW:0:5:=0xa |
| 369 | __REG(0x00154138 )= 0x00000088; //VALUE_PHYREG4E / B_DQ0~B_DQ7 pull_up DS :RW:0:5:=0xa, falling edge slew rate:RW:5:3:=0x4 |
| 370 | __REG(0x0015413c )= 0x00000084; //VALUE_PHYREG4F / B_DQ0~B_DQ7 pull_up ODT:RW:0:5:=0xa, rising edge slew rate:RW:5:3:=0x4 |
| 371 | |
| 372 | __REG(0x00154140 )= 0x00000088; //VALUE_PHYREG50 / B_DQ8~B_DQ15 pull_down DS :RW:0:5:=0xa, falling edge slew rate:RW:5:3:=0x4 |
| 373 | __REG(0x00154144 )= 0x00000084; //VALUE_PHYREG51 / B_DQ8~B_DQ15 pull_down ODT:RW:0:5:=0xa, rising edge slew rate:RW:5:3:=0x4 |
| 374 | __REG(0x00154178 )= 0x00000008; //VALUE_PHYREG5E / B_DQ8~B_DQ15 pull_up DS :RW:0:5:=0xa |
| 375 | __REG(0x0015417c )= 0x00000024; //VALUE_PHYREG5F / B_DQ8~B_DQ15 pull_up ODT:RW:0:5:=0xa |
| 376 | #else //48om |
| 377 | //Drive strength(defualt) ODT µÈЧ48om |
| 378 | __REG( 0x00154044 ) = 0x0000000a ; //VALUE_PHYREG11 / CMD drive strength: cmd_prcomp[3:0]:RW:4:4:=0xa,cmd_nrcomp[3:0]:RW:0:4:=0xa |
| 379 | __REG( 0x00154058 ) = 0x0000000a ; //VALUE_PHYREG16 / CK drive strength: ck_prcomp [3:0]:RW:4:4:=0xa,ck_nrcomp [3:0]:RW:0:4:=0xa |
| 380 | __REG( 0x00154064 ) = 0x0000000a ; //VALUE_PHYREG19 / CK pull_up drive strength(DS):RW:0:5:=0xa |
| 381 | __REG( 0x00154068 ) = 0x0000000a ; //VALUE_PHYREG1A / CMD pull_up drive strength(DS):RW:0:5:=0xa |
| 382 | __REG( 0x00154080 ) = 0x0000000a ; //VALUE_PHYREG20 / A_DQ0~A_DQ7 pull_down DS :RW:0:5:=0xa |
| 383 | __REG( 0x00154084 ) = 0x00000005 ; //VALUE_PHYREG21 / A_DQ0~A_DQ7 pull_down ODT:RW:0:5:=0xa |
| 384 | __REG( 0x001540b8 ) = 0x0000008a ; //VALUE_PHYREG2E / A_DQ0~A_DQ7 pull_up DS :RW:0:5:=0xa, falling edge slew rate:RW:5:3:=0x4 |
| 385 | __REG( 0x001540bc ) = 0x00000085 ; //VALUE_PHYREG2F / A_DQ0~A_DQ7 pull_up ODT:RW:0:5:=0xa, rising edge slew rate:RW:5:3:=0x4 |
| 386 | __REG( 0x001540c0 ) = 0x0000008a ; //VALUE_PHYREG30 / A_DQ8~A_DQ15 pull_down DS :RW:0:5:=0xa, falling edge slew rate:RW:5:3:=0x4 |
| 387 | __REG( 0x001540c4 ) = 0x00000085 ; //VALUE_PHYREG31 / A_DQ8~A_DQ15 pull_down ODT:RW:0:5:=0xa, rising edge slew rate:RW:5:3:=0x4 |
| 388 | __REG( 0x001540f8 ) = 0x0000000a ; //VALUE_PHYREG3E / A_DQ8~A_DQ15 pull_up DS :RW:0:5:=0xa |
| 389 | __REG( 0x001540fc ) = 0x00000005 ; //VALUE_PHYREG3F / A_DQ8~A_DQ15 pull_up ODT:RW:0:5:=0xa |
| 390 | |
| 391 | __REG( 0x00154100 ) = 0x0000000a ; //VALUE_PHYREG40 / B_DQ0~B_DQ7 pull_down DS :RW:0:5:=0xa |
| 392 | __REG( 0x00154104 ) = 0x00000005 ; //VALUE_PHYREG41 / B_DQ0~B_DQ7 pull_down ODT:RW:0:5:=0xa |
| 393 | __REG( 0x00154138 ) = 0x0000008a ; //VALUE_PHYREG4E / B_DQ0~B_DQ7 pull_up DS :RW:0:5:=0xa, falling edge slew rate:RW:5:3:=0x4 |
| 394 | __REG( 0x0015413c ) = 0x00000085 ; //VALUE_PHYREG4F / B_DQ0~B_DQ7 pull_up ODT:RW:0:5:=0xa, rising edge slew rate:RW:5:3:=0x4 |
| 395 | |
| 396 | __REG( 0x00154140 ) = 0x0000008a ; //VALUE_PHYREG50 / B_DQ8~B_DQ15 pull_down DS :RW:0:5:=0xa, falling edge slew rate:RW:5:3:=0x4 |
| 397 | __REG( 0x00154144 ) = 0x00000085 ; //VALUE_PHYREG51 / B_DQ8~B_DQ15 pull_down ODT:RW:0:5:=0xa, rising edge slew rate:RW:5:3:=0x4 |
| 398 | __REG( 0x00154178 ) = 0x0000000a ; //VALUE_PHYREG5E / B_DQ8~B_DQ15 pull_up DS :RW:0:5:=0xa |
| 399 | __REG( 0x0015417c ) = 0x00000025 ; //VALUE_PHYREG5F / B_DQ8~B_DQ15 pull_up ODT:RW:0:5:=0xa |
| 400 | #endif |
| 401 | } |
| 402 | |
| 403 | return 0; |
| 404 | |
| 405 | } |
| 406 | |
| 407 | int ddr_ctrl_init(int flag) |
| 408 | { |
| 409 | |
| 410 | if(flag == CHIP_DDR_IS_32M) |
| 411 | { |
| 412 | __REG( 0x00150000 ) = 0x01041004; // 0x01041004(16bit) ; //VALUE_MSTR / device_config:RW:30:2:=0x0 frequency_mode:RW:29:1:=0x0 active_ranks:RW:24:4:=0x3 burst_rdwr:RW:16:4:=0x4 dll_off_mode:RW:15:1:=0x0 data_bus_width:RW:12:2:=0x0 geardown_mode:RW:11:1:=0x0 en_2t_timing_mode:RW:10:1:=0x0 burstchop:RW:9:1:=0x0 burst_mode:RW:8:1:=0x0 lpddr4:RW:5:1:=0x0 ddr4:RW:4:1:=0x0 lpddr3:RW:3:1:=0x0 lpddr2:RW:2:1:=0x1 mobile:RW:1:1:=0x0 ddr3:RW:0:1:=0x0 |
| 413 | } |
| 414 | else |
| 415 | { |
| 416 | __REG( 0x00150000 ) = 0x01040004; // 0x01040004(32bit) |
| 417 | } |
| 418 | |
| 419 | __REG( 0x00150010 ) = 0x00000030 ; //VALUE_MRCTRL0 / mr_wr:RW:31:1:=0x0 mr_addr:RW:12:4:=0x0 mr_rank:RW:4:4:=0x3 sw_init_int:RW:3:1:=0x0 pda_en:RW:2:1:=0x0 mpr_en:RW:1:1:=0x0 mr_type:RW:0:1:=0x0 |
| 420 | __REG( 0x00150014 ) = 0x00000000 ; //VALUE_MRCTRL1 /mr_data:RW:0:16:=0x0 |
| 421 | __REG( 0x00150020 ) = 0x00000000 ; //VALUE_DERATEEN /rc_derate_value:RW:8:2:=0x0 derate_byte:RW:4:4:=0x0 derate_value:RW:1:1:=0x0 derate_enable:RW:0:1:=0x0 |
| 422 | __REG( 0x00150024 ) = 0x00800000 ; //VALUE_DERATEINT /mr4_read_interval:RW:0:32:=0x800000 |
| 423 | |
| 424 | __REG( 0x00150030 ) = 0x00000000 ; //VALUE_PWRCTL / stay_in_selfref:RW:6:1:=0x0 selfref_sw:RW:5:1:=0x0 mpsm_en:RW:4:1:=0x0 en_dfi_dram_clk_disable:RW:3:1:=0x0 deeppowerdown_en:RW:2:1:=0x0 powerdown_en:RW:1:1:=0x1 selfref_en:RW:0:1:=0x1 |
| 425 | __REG( 0x00150034 ) = 0x00052002 ; //VALUE_PWRTMG / selfref_to_x32:RW:16:8:=0x5 deeppowerdown_to_x1024:RW:8:8:=0x20 powerdown_to_x32:RW:0:5:=0x2 |
| 426 | __REG( 0x00150038 ) = 0x00040003 ; //VALUE_HWLPCTL / hw_lp_idle_x32:RW:16:12:=0x4 hw_lp_exit_idle_en:RW:1:1:=0x1 hw_lp_en:RW:0:1:=0x1 |
| 427 | __REG( 0x00150050 ) = 0x00210000 ; //VALUE_RFSHCTL0 / refresh_margin:RW:20:4:=0x2 refresh_to_x32:RW:12:5:=0x10 refresh_burst:RW:4:5:=0x0 per_bank_refresh:RW:2:1:=0x0 |
| 428 | __REG( 0x00150054 ) = 0x00000000 ; //VALUE_RFSHCTL1 / refresh_timer1_start_value_x32:RW:16:12:=0x0 refresh_timer0_start_value_x32:RW:0:12:=0x0 |
| 429 | __REG( 0x00150058 ) = 0x00000000 ; //VALUE_RFSHCTL2 / refresh_timer3_start_value_x32:RW:16:12:=0x0 refresh_timer2_start_value_x32:RW:0:12:=0x0 |
| 430 | __REG( 0x00150060 ) = 0x00000000 ; //VALUE_RFSHCTL3 / refresh_mode:RW:4:3:=0x0 refresh_update_level:RW:1:1:=0x0 dis_auto_refresh:RW:0:1:=0x0 |
| 431 | |
| 432 | if(flag == CHIP_DDR_IS_32M) |
| 433 | { |
| 434 | #if _DDR32M_BYPASS_MODE |
| 435 | __REG( 0x00150064 ) = 0x00260014 ; //VALUE_RFSHTMG / t_rfc_nom_x32(trefi):RW:16:12:=0x26 lpddr3_trefbw_en:RW:15:1:=0x0 t_rfc_min:RW:0:9:=0x14 |
| 436 | __REG( 0x001500d0 ) = 0x001f0001 ; //VALUE_INIT0 / skip_dram_init:RW:31:2:=0x0 post_cke_x1024:RW:16:10:=0x1f pre_cke_x1024:RW:0:11:=0x1 |
| 437 | __REG( 0x001500d4 ) = 0x00000000 ; //VALUE_INIT1 / dram_rstn_x1024:RW:16:8:=0x0 final_wait_x32:RW:8:7:=0x0 pre_ocd_x32:RW:0:4:=0x0 |
| 438 | __REG( 0x001500d8 ) = 0x00000405 ; //VALUE_INIT2 / idle_after_reset_x32:RW:8:8:=0x4 min_stable_clock_x1:RW:0:4:=0x5 |
| 439 | //MR2=RL/WL£¬1£ºRL3/WL1£¬2£ºRL4/WL2£¬3£ºRL:5/WL2£¬4£ºRL6/WL3:£¬5£ºRL7/WL4£¬6£ºRL8/WL4 |
| 440 | __REG( 0x001500dc ) = 0x00630006 ; //VALUE_INIT3 / mr:RW:16:16:=0x63 emr:RW:0:16:=0x6 |
| 441 | //bit16-31£¬LPDDR2 MR3 value£¬Æ÷¼þDSĬÈÏÊÇ40ohm£¬£¨1=34.3£¬2=40,3=48,4=60,6=80£© |
| 442 | #ifndef _DDR32M_DS_48om //60ohm |
| 443 | __REG( 0x001500e0 ) = 0x00040000 ; //VALUE_INIT4 / emr2:RW:16:16:=0x2 emr3:RW:0:16:=0x0 |
| 444 | #else //48ohm |
| 445 | __REG( 0x001500e0 ) = 0x00030000 ; //VALUE_INIT4 / emr2:RW:16:16:=0x2 emr3:RW:0:16:=0x0 |
| 446 | #endif |
| 447 | __REG( 0x001500e4 ) = 0x00050002 ; //VALUE_INIT5 / dev_zqinit_x32:RW:16:8:=0x5 max_auto_init_x1024:RW:0:10:=0x2 |
| 448 | __REG( 0x001500f4 ) = 0x0000066f ; //VALUE_RANKCTL / diff_rank_wr_gap:RW:8:4:=0x6 diff_rank_rd_gap:RW:4:4:=0x6 max_rank_rd:RW:0:4:=0xf |
| 449 | __REG( 0x00150100 ) = 0x06080a07 ; //VALUE_DRAMTMG0 / wr2pre:RW:24:6:=0x6 t_faw:RW:16:6:=0x8 t_ras_max:RW:8:7:=0xa t_ras_min:RW:0:6:=0x7 |
| 450 | __REG( 0x00150104 ) = 0x0002020a ; //VALUE_DRAMTMG1 / t_xp:RW:16:5:=0x2 rd2pre:RW:8:5:=0x2 t_rc:RW:0:6:=0x9 |
| 451 | //RL=bit16-21£¬1£ºRL=2£¬2£ºRL=4£¬3£ºRL=6£¬4£ºR=8£¬WL=bit24-29£¬1£ºWL=2£¬2£ºWL=4 |
| 452 | //ÕâÀïµ¼ÖÂMR2µÄÅäÖã¨0x012160dc£©²»ÄÜÑ¡Ôñº¬ÓÐÆæÊýµÄÖµ? |
| 453 | __REG( 0x00150108 ) = 0x02040606 ; //VALUE_DRAMTMG2 / write_latency:RW:24:6:=0x2 read_latency:RW:16:6:=0x4 rd2wr:RW:8:6:=0x6 wr2rd:RW:0:6:=0x6 |
| 454 | __REG( 0x0015010c ) = 0x00501000 ; //VALUE_DRAMTMG3 / t_mrw:RW:20:10:=0x5 t_mrd:RW:12:6:=0x1 t_mod:RW:0:10:=0x0 |
| 455 | __REG( 0x00150110 ) = 0x03010204 ; //VALUE_DRAMTMG4 / t_rcd:RW:24:5:=0x3 t_ccd:RW:16:4:=0x1 t_rrd:RW:8:4:=0x2 t_rp:RW:0:5:=0x4 |
| 456 | __REG( 0x00150114 ) = 0x01010303 ; //VALUE_DRAMTMG5 / t_cksrx:RW:24:4:=0x1 t_cksre:RW:16:4:=0x1 t_ckesr:RW:8:6:=0x3 t_cke:RW:0:4:=0x3 |
| 457 | __REG( 0x00150118 ) = 0x02020003 ; //VALUE_DRAMTMG6 / t_ckdpde:RW:24:4:=0x2 t_ckdpdx:RW:16:4:=0x2 t_ckcsx:RW:0:4:=0x3 |
| 458 | __REG( 0x0015011c ) = 0x00000202 ; //VALUE_DRAMTMG7 / t_ckpde:RW:8:4:=0x2 t_ckpdx:RW:0:4:=0x2 |
| 459 | __REG( 0x00150138 ) = 0x00000016 ; //VALUE_DRAMTMG14 / t_xsr:RW:0:12:=0x16 |
| 460 | //bit30=1 Disable issuing of ZQCL/MPC(ZQ calibration) command at Self-Refresh/SR-Powerdown exit £¬7520×ʼÅäÖÃΪ0£¬µ¼ÖÂ×Ô¶¯×Ôˢй¦ÄÜÍ˳öʱÑÓʱºÜ´ó£¬sdio¶ÁÊý¾Ý³ö´í |
| 461 | __REG( 0x00150180 ) = 0x4039000f ; //VALUE_ZQCTL0 / dis_auto_zq:RW:31:1:=0x0 dis_srx_zqcl:RW:30:1:=0x1 zq_resistor_shared:RW:29:1:=0x0 dis_mpsmx_zqcl:RW:28:1:=0x0 t_zq_long_nop:RW:16:10:=0x39 t_zq_short_nop:RW:0:10:=0xf |
| 462 | __REG( 0x00150184 ) = 0x00800100 ; //VALUE_ZQCTL1 / t_zq_reset_nop:RW:20:10:=0x8 t_zq_short_interval_x1024:RW:0:20:=0x100 |
| 463 | |
| 464 | #else |
| 465 | __REG( 0x00150064 ) = 0x0030001a ; //VALUE_RFSHTMG / t_rfc_nom_x32(trefi):RW:16:12:=0x26 lpddr3_trefbw_en:RW:15:1:=0x0 t_rfc_min:RW:0:9:=0x14 |
| 466 | __REG( 0x001500d0 ) = 0x00280001 ; //VALUE_INIT0 / skip_dram_init:RW:31:2:=0x0 post_cke_x1024:RW:16:10:=0x1f pre_cke_x1024:RW:0:11:=0x1 |
| 467 | __REG( 0x001500d4 ) = 0x00000000 ; //VALUE_INIT1 / dram_rstn_x1024:RW:16:8:=0x0 final_wait_x32:RW:8:7:=0x0 pre_ocd_x32:RW:0:4:=0x0 |
| 468 | __REG( 0x001500d8 ) = 0x00000605 ; //VALUE_INIT2 / idle_after_reset_x32:RW:8:8:=0x4 min_stable_clock_x1:RW:0:4:=0x5 |
| 469 | //MR2=RL/WL£¬1£ºRL3/WL1£¬2£ºRL4/WL2£¬3£ºRL:5/WL2£¬4£ºRL6/WL3:£¬5£ºRL7/WL4£¬6£ºRL8/WL4 |
| 470 | __REG( 0x001500dc ) = 0x00830006 ; //VALUE_INIT3 / mr:RW:16:16:=0x63 emr:RW:0:16:=0x6 |
| 471 | //bit16-31£¬LPDDR2 MR3 value£¬Æ÷¼þDSĬÈÏÊÇ40ohm£¬£¨1=34.3£¬2=40,3=48,4=60,6=80£© |
| 472 | #ifndef _DDR32M_DS_48om //60ohm |
| 473 | __REG( 0x001500e0 ) = 0x00040000 ; //VALUE_INIT4 / emr2:RW:16:16:=0x2 emr3:RW:0:16:=0x0 |
| 474 | #else //48ohm |
| 475 | __REG( 0x001500e0 ) = 0x00030000 ; //VALUE_INIT4 / emr2:RW:16:16:=0x2 emr3:RW:0:16:=0x0 |
| 476 | #endif |
| 477 | __REG( 0x001500e4 ) = 0x00070002 ; //VALUE_INIT5 / dev_zqinit_x32:RW:16:8:=0x5 max_auto_init_x1024:RW:0:10:=0x2 |
| 478 | __REG( 0x001500f4 ) = 0x0000066f ; //VALUE_RANKCTL / diff_rank_wr_gap:RW:8:4:=0x6 diff_rank_rd_gap:RW:4:4:=0x6 max_rank_rd:RW:0:4:=0xf |
| 479 | __REG( 0x00150100 ) = 0x070a0d08 ; //VALUE_DRAMTMG0 / wr2pre:RW:24:6:=0x6 t_faw:RW:16:6:=0x8 t_ras_max:RW:8:7:=0xa t_ras_min:RW:0:6:=0x7 |
| 480 | __REG( 0x00150104 ) = 0x0002020d ; //VALUE_DRAMTMG1 / t_xp:RW:16:5:=0x2 rd2pre:RW:8:5:=0x2 t_rc:RW:0:6:=0x9 |
| 481 | //RL=bit16-21£¬1£ºRL=2£¬2£ºRL=4£¬3£ºRL=6£¬4£ºR=8£¬WL=bit24-29£¬1£ºWL=2£¬2£ºWL=4 |
| 482 | //ÕâÀïµ¼ÖÂMR2µÄÅäÖã¨0x012160dc£©²»ÄÜÑ¡Ôñº¬ÓÐÆæÊýµÄÖµ? |
| 483 | __REG( 0x00150108 ) = 0x02040607 ; //VALUE_DRAMTMG2 / write_latency:RW:24:6:=0x2 read_latency:RW:16:6:=0x4 rd2wr:RW:8:6:=0x6 wr2rd:RW:0:6:=0x6 |
| 484 | __REG( 0x0015010c ) = 0x00501000 ; //VALUE_DRAMTMG3 / t_mrw:RW:20:10:=0x5 t_mrd:RW:12:6:=0x1 t_mod:RW:0:10:=0x0 |
| 485 | __REG( 0x00150110 ) = 0x04010205 ; //VALUE_DRAMTMG4 / t_rcd:RW:24:5:=0x3 t_ccd:RW:16:4:=0x1 t_rrd:RW:8:4:=0x2 t_rp:RW:0:5:=0x4 |
| 486 | __REG( 0x00150114 ) = 0x01010303 ; //VALUE_DRAMTMG5 / t_cksrx:RW:24:4:=0x1 t_cksre:RW:16:4:=0x1 t_ckesr:RW:8:6:=0x3 t_cke:RW:0:4:=0x3 |
| 487 | __REG( 0x00150118 ) = 0x02020003 ; //VALUE_DRAMTMG6 / t_ckdpde:RW:24:4:=0x2 t_ckdpdx:RW:16:4:=0x2 t_ckcsx:RW:0:4:=0x3 |
| 488 | __REG( 0x0015011c ) = 0x00000202 ; //VALUE_DRAMTMG7 / t_ckpde:RW:8:4:=0x2 t_ckpdx:RW:0:4:=0x2 |
| 489 | __REG( 0x00150138 ) = 0x0000001c ; //VALUE_DRAMTMG14 / t_xsr:RW:0:12:=0x16 |
| 490 | //bit30=1 Disable issuing of ZQCL/MPC(ZQ calibration) command at Self-Refresh/SR-Powerdown exit £¬7520×ʼÅäÖÃΪ0£¬µ¼ÖÂ×Ô¶¯×Ôˢй¦ÄÜÍ˳öʱÑÓʱºÜ´ó£¬sdio¶ÁÊý¾Ý³ö´í |
| 491 | __REG( 0x00150180 ) = 0x40480012 ; //VALUE_ZQCTL0 / dis_auto_zq:RW:31:1:=0x0 dis_srx_zqcl:RW:30:1:=0x1 zq_resistor_shared:RW:29:1:=0x0 dis_mpsmx_zqcl:RW:28:1:=0x0 t_zq_long_nop:RW:16:10:=0x39 t_zq_short_nop:RW:0:10:=0xf |
| 492 | __REG( 0x00150184 ) = 0x00a00100 ; //VALUE_ZQCTL1 / t_zq_reset_nop:RW:20:10:=0x8 t_zq_short_interval_x1024:RW:0:20:=0x100 |
| 493 | #endif |
| 494 | |
| 495 | } |
| 496 | else |
| 497 | { |
| 498 | #if _DDR_BYPASS_MODE |
xf.li | ca7c3fc | 2024-02-21 22:59:57 -0800 | [diff] [blame] | 499 | if((flag == CHIP_DDR_IS_256M)||(flag == CHIP_DDR_IS_512M)) |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 500 | __REG( 0x00150064 ) = 0x00130014 ; //VALUE_RFSHTMG / t_rfc_nom_x32(trefi):RW:16:12:=0x13 lpddr3_trefbw_en:RW:15:1:=0x0 t_rfc_min:RW:0:9:=0x0a |
| 501 | else |
| 502 | __REG( 0x00150064 ) = 0x00260014 ; //VALUE_RFSHTMG / t_rfc_nom_x32(trefi):RW:16:12:=0x26 lpddr3_trefbw_en:RW:15:1:=0x0 t_rfc_min:RW:0:9:=0x14 |
| 503 | __REG( 0x001500d0 ) = 0x001f0001 ; //VALUE_INIT0 / skip_dram_init:RW:31:2:=0x0 post_cke_x1024:RW:16:10:=0x1f pre_cke_x1024:RW:0:11:=0x1 |
| 504 | __REG( 0x001500d4 ) = 0x00000000 ; //VALUE_INIT1 / dram_rstn_x1024:RW:16:8:=0x0 final_wait_x32:RW:8:7:=0x0 pre_ocd_x32:RW:0:4:=0x0 |
| 505 | __REG( 0x001500d8 ) = 0x00000405 ; //VALUE_INIT2 / idle_after_reset_x32:RW:8:8:=0x4 min_stable_clock_x1:RW:0:4:=0x5 |
| 506 | //MR2=RL/WL£¬1£ºRL3/WL1£¬2£ºRL4/WL2£¬3£ºRL:5/WL2£¬4£ºRL6/WL3:£¬5£ºRL7/WL4£¬6£ºRL8/WL4 |
| 507 | __REG( 0x001500dc ) = 0x00630006 ; //VALUE_INIT3 / mr:RW:16:16:=0x63 emr:RW:0:16:=0x6 |
| 508 | //bit16-31£¬LPDDR2 MR3 value£¬Æ÷¼þDSĬÈÏÊÇ40ohm£¬£¨1=34.3£¬2=40,3=48,4=60,6=80£© |
| 509 | #ifndef _DDR_DS_48om //60ohm |
| 510 | __REG( 0x001500e0 ) = 0x00040000 ; //VALUE_INIT4 / emr2:RW:16:16:=0x2 emr3:RW:0:16:=0x0 |
| 511 | #else //48ohm |
| 512 | __REG( 0x001500e0 ) = 0x00030000 ; //VALUE_INIT4 / emr2:RW:16:16:=0x2 emr3:RW:0:16:=0x0 |
| 513 | #endif |
| 514 | __REG( 0x001500e4 ) = 0x00050002 ; //VALUE_INIT5 / dev_zqinit_x32:RW:16:8:=0x5 max_auto_init_x1024:RW:0:10:=0x2 |
| 515 | __REG( 0x001500f4 ) = 0x0000066f ; //VALUE_RANKCTL / diff_rank_wr_gap:RW:8:4:=0x6 diff_rank_rd_gap:RW:4:4:=0x6 max_rank_rd:RW:0:4:=0xf |
| 516 | __REG( 0x00150100 ) = 0x06080a07 ; //VALUE_DRAMTMG0 / wr2pre:RW:24:6:=0x6 t_faw:RW:16:6:=0x8 t_ras_max:RW:8:7:=0xa t_ras_min:RW:0:6:=0x7 |
| 517 | __REG( 0x00150104 ) = 0x0002020a ; //VALUE_DRAMTMG1 / t_xp:RW:16:5:=0x2 rd2pre:RW:8:5:=0x2 t_rc:RW:0:6:=0x9 |
| 518 | //RL=bit16-21£¬1£ºRL=2£¬2£ºRL=4£¬3£ºRL=6£¬4£ºR=8£¬WL=bit24-29£¬1£ºWL=2£¬2£ºWL=4 |
| 519 | //ÕâÀïµ¼ÖÂMR2µÄÅäÖã¨0x012160dc£©²»ÄÜÑ¡Ôñº¬ÓÐÆæÊýµÄÖµ? |
| 520 | __REG( 0x00150108 ) = 0x02040606 ; //VALUE_DRAMTMG2 / write_latency:RW:24:6:=0x2 read_latency:RW:16:6:=0x4 rd2wr:RW:8:6:=0x6 wr2rd:RW:0:6:=0x6 |
| 521 | __REG( 0x0015010c ) = 0x00501000 ; //VALUE_DRAMTMG3 / t_mrw:RW:20:10:=0x5 t_mrd:RW:12:6:=0x1 t_mod:RW:0:10:=0x0 |
| 522 | __REG( 0x00150110 ) = 0x03010204 ; //VALUE_DRAMTMG4 / t_rcd:RW:24:5:=0x3 t_ccd:RW:16:4:=0x1 t_rrd:RW:8:4:=0x2 t_rp:RW:0:5:=0x4 |
| 523 | __REG( 0x00150114 ) = 0x01010303 ; //VALUE_DRAMTMG5 / t_cksrx:RW:24:4:=0x1 t_cksre:RW:16:4:=0x1 t_ckesr:RW:8:6:=0x3 t_cke:RW:0:4:=0x3 |
| 524 | __REG( 0x00150118 ) = 0x02020003 ; //VALUE_DRAMTMG6 / t_ckdpde:RW:24:4:=0x2 t_ckdpdx:RW:16:4:=0x2 t_ckcsx:RW:0:4:=0x3 |
| 525 | __REG( 0x0015011c ) = 0x00000202 ; //VALUE_DRAMTMG7 / t_ckpde:RW:8:4:=0x2 t_ckpdx:RW:0:4:=0x2 |
| 526 | __REG( 0x00150138 ) = 0x00000016 ; //VALUE_DRAMTMG14 / t_xsr:RW:0:12:=0x16 |
| 527 | //bit30=1 Disable issuing of ZQCL/MPC(ZQ calibration) command at Self-Refresh/SR-Powerdown exit £¬7520×ʼÅäÖÃΪ0£¬µ¼ÖÂ×Ô¶¯×Ôˢй¦ÄÜÍ˳öʱÑÓʱºÜ´ó£¬sdio¶ÁÊý¾Ý³ö´í |
| 528 | __REG( 0x00150180 ) = 0x4039000f ; //VALUE_ZQCTL0 / dis_auto_zq:RW:31:1:=0x0 dis_srx_zqcl:RW:30:1:=0x1 zq_resistor_shared:RW:29:1:=0x0 dis_mpsmx_zqcl:RW:28:1:=0x0 t_zq_long_nop:RW:16:10:=0x39 t_zq_short_nop:RW:0:10:=0xf |
| 529 | __REG( 0x00150184 ) = 0x00800100 ; //VALUE_ZQCTL1 / t_zq_reset_nop:RW:20:10:=0x8 t_zq_short_interval_x1024:RW:0:20:=0x100 |
| 530 | |
| 531 | #else |
xf.li | ca7c3fc | 2024-02-21 22:59:57 -0800 | [diff] [blame] | 532 | if((flag == CHIP_DDR_IS_256M)||(flag == CHIP_DDR_IS_512M)) |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 533 | __REG( 0x00150064 ) = 0x0018001a ; //VALUE_RFSHTMG / t_rfc_nom_x32(trefi):RW:16:12:=0x18 lpddr3_trefbw_en:RW:15:1:=0x0 t_rfc_min:RW:0:9:=0x0d |
| 534 | else |
| 535 | __REG( 0x00150064 ) = 0x0030001a ; //VALUE_RFSHTMG / t_rfc_nom_x32(trefi):RW:16:12:=0x26 lpddr3_trefbw_en:RW:15:1:=0x0 t_rfc_min:RW:0:9:=0x14 |
| 536 | __REG( 0x001500d0 ) = 0x00280001 ; //VALUE_INIT0 / skip_dram_init:RW:31:2:=0x0 post_cke_x1024:RW:16:10:=0x1f pre_cke_x1024:RW:0:11:=0x1 |
| 537 | __REG( 0x001500d4 ) = 0x00000000 ; //VALUE_INIT1 / dram_rstn_x1024:RW:16:8:=0x0 final_wait_x32:RW:8:7:=0x0 pre_ocd_x32:RW:0:4:=0x0 |
| 538 | __REG( 0x001500d8 ) = 0x00000605 ; //VALUE_INIT2 / idle_after_reset_x32:RW:8:8:=0x4 min_stable_clock_x1:RW:0:4:=0x5 |
| 539 | //MR2=RL/WL£¬1£ºRL3/WL1£¬2£ºRL4/WL2£¬3£ºRL:5/WL2£¬4£ºRL6/WL3:£¬5£ºRL7/WL4£¬6£ºRL8/WL4 |
| 540 | __REG( 0x001500dc ) = 0x00830006 ; //VALUE_INIT3 / mr:RW:16:16:=0x63 emr:RW:0:16:=0x6 |
| 541 | //bit16-31£¬LPDDR2 MR3 value£¬Æ÷¼þDSĬÈÏÊÇ40ohm£¬£¨1=34.3£¬2=40,3=48,4=60,6=80£© |
| 542 | #ifndef _DDR_DS_48om //60ohm |
| 543 | __REG( 0x001500e0 ) = 0x00040000 ; //VALUE_INIT4 / emr2:RW:16:16:=0x2 emr3:RW:0:16:=0x0 |
| 544 | #else //48ohm |
| 545 | __REG( 0x001500e0 ) = 0x00030000 ; //VALUE_INIT4 / emr2:RW:16:16:=0x2 emr3:RW:0:16:=0x0 |
| 546 | #endif |
| 547 | __REG( 0x001500e4 ) = 0x00070002 ; //VALUE_INIT5 / dev_zqinit_x32:RW:16:8:=0x5 max_auto_init_x1024:RW:0:10:=0x2 |
| 548 | __REG( 0x001500f4 ) = 0x0000066f ; //VALUE_RANKCTL / diff_rank_wr_gap:RW:8:4:=0x6 diff_rank_rd_gap:RW:4:4:=0x6 max_rank_rd:RW:0:4:=0xf |
| 549 | __REG( 0x00150100 ) = 0x070a0d08 ; //VALUE_DRAMTMG0 / wr2pre:RW:24:6:=0x6 t_faw:RW:16:6:=0x8 t_ras_max:RW:8:7:=0xa t_ras_min:RW:0:6:=0x7 |
| 550 | __REG( 0x00150104 ) = 0x0002020d ; //VALUE_DRAMTMG1 / t_xp:RW:16:5:=0x2 rd2pre:RW:8:5:=0x2 t_rc:RW:0:6:=0x9 |
| 551 | //RL=bit16-21£¬1£ºRL=2£¬2£ºRL=4£¬3£ºRL=6£¬4£ºR=8£¬WL=bit24-29£¬1£ºWL=2£¬2£ºWL=4 |
| 552 | //ÕâÀïµ¼ÖÂMR2µÄÅäÖã¨0x012160dc£©²»ÄÜÑ¡Ôñº¬ÓÐÆæÊýµÄÖµ? |
| 553 | __REG( 0x00150108 ) = 0x02040607 ; //VALUE_DRAMTMG2 / write_latency:RW:24:6:=0x2 read_latency:RW:16:6:=0x4 rd2wr:RW:8:6:=0x6 wr2rd:RW:0:6:=0x6 |
| 554 | __REG( 0x0015010c ) = 0x00501000 ; //VALUE_DRAMTMG3 / t_mrw:RW:20:10:=0x5 t_mrd:RW:12:6:=0x1 t_mod:RW:0:10:=0x0 |
| 555 | __REG( 0x00150110 ) = 0x04010205 ; //VALUE_DRAMTMG4 / t_rcd:RW:24:5:=0x3 t_ccd:RW:16:4:=0x1 t_rrd:RW:8:4:=0x2 t_rp:RW:0:5:=0x4 |
| 556 | __REG( 0x00150114 ) = 0x01010303 ; //VALUE_DRAMTMG5 / t_cksrx:RW:24:4:=0x1 t_cksre:RW:16:4:=0x1 t_ckesr:RW:8:6:=0x3 t_cke:RW:0:4:=0x3 |
| 557 | __REG( 0x00150118 ) = 0x02020003 ; //VALUE_DRAMTMG6 / t_ckdpde:RW:24:4:=0x2 t_ckdpdx:RW:16:4:=0x2 t_ckcsx:RW:0:4:=0x3 |
| 558 | __REG( 0x0015011c ) = 0x00000202 ; //VALUE_DRAMTMG7 / t_ckpde:RW:8:4:=0x2 t_ckpdx:RW:0:4:=0x2 |
| 559 | __REG( 0x00150138 ) = 0x0000001c ; //VALUE_DRAMTMG14 / t_xsr:RW:0:12:=0x16 |
| 560 | //bit30=1 Disable issuing of ZQCL/MPC(ZQ calibration) command at Self-Refresh/SR-Powerdown exit £¬7520×ʼÅäÖÃΪ0£¬µ¼ÖÂ×Ô¶¯×Ôˢй¦ÄÜÍ˳öʱÑÓʱºÜ´ó£¬sdio¶ÁÊý¾Ý³ö´í |
| 561 | __REG( 0x00150180 ) = 0x40480012 ; //VALUE_ZQCTL0 / dis_auto_zq:RW:31:1:=0x0 dis_srx_zqcl:RW:30:1:=0x1 zq_resistor_shared:RW:29:1:=0x0 dis_mpsmx_zqcl:RW:28:1:=0x0 t_zq_long_nop:RW:16:10:=0x39 t_zq_short_nop:RW:0:10:=0xf |
| 562 | __REG( 0x00150184 ) = 0x00a00100 ; //VALUE_ZQCTL1 / t_zq_reset_nop:RW:20:10:=0x8 t_zq_short_interval_x1024:RW:0:20:=0x100 |
| 563 | #endif |
| 564 | } |
| 565 | |
| 566 | __REG( 0x00150188 ) = 0x00000000 ; //VALUE_ZQCTL2 / zq_reset:RW:0:1:=0x0 |
| 567 | //dfi_t_rddata_en=3,֮ǰ7520ÉÏÉè³É2»áµ¼Ö¶Ámr¶Á´í |
| 568 | __REG( 0x00150190 ) = 0x04030001 ; //VALUE_DFITMG0 / dfi_t_ctrl_delay:RW:24:5:=0x4 dfi_rddata_use_sdr:RW:23:1:=0x0 dfi_t_rddata_en:RW:16:6:=0x3 dfi_wrdata_use_sdr:RW:15:1:=0x0 dfi_tphy_wrdata:RW:8:6:=0x0 dfi_tphy_wrlat:RW:0:6:=0x1 |
| 569 | __REG( 0x00150194 ) = 0x00020404 ; //VALUE_DFITMG1 / dfi_t_cmd_lat:RW:28:4:=0x0 dfi_t_parin_lat:RW:24:2:=0x0 dfi_t_wrdata_delay:RW:16:5:=0x2 dfi_t_dram_clk_disable:RW:8:4:=0x4 dfi_t_dram_clk_enable:RW:0:4:=0x4 |
| 570 | __REG( 0x00150198 ) = 0x09001111 ; //VALUE_DFILPCFG0 / dfi_tlp_resp:RW:24:4:=0x9 dfi_lp_wakeup_dpd:RW:20:4:=0x0 dfi_lp_en_dpd:RW:16:1:=0x0 dfi_lp_wakeup_sr:RW:12:4:=0x1 dfi_lp_en_sr:RW:8:1:=0x1 dfi_lp_wakeup_pd:RW:4:4:=0x1 dfi_lp_en_pd:RW:0:1:=0x1 |
| 571 | __REG( 0x001501a0 ) = 0x80400003 ; //VALUE_DFIUPD0 / dis_auto_ctrlupd:RW:31:1:=0x1 dfi_t_ctrlup_max:RW:16:10:=0x40 dfi_t_ctrlup_min:RW:0:10:=0x3 |
| 572 | __REG( 0x001501a4 ) = 0x00000000 ; //VALUE_DFIUPD1 / dfi_t_ctrlupd_interval_min_x1024:RW:16:8:=0x0 dfi_t_ctrlupd_interval_max_x1024:RW:0:8:=0x0 |
| 573 | __REG( 0x001501a8 ) = 0x80100010 ; //VALUE_DFIUPD2 / dfi_phyupd_en:RW:31:1:=0x1 dfi_phyupd_type1:RW:16:12:=0x10 dfi_phyupd_type0:RW:0:12:=0x10 |
| 574 | __REG( 0x001501b0 ) = 0x00000000 ; //VALUE_DFIMISC / dfi_data_cs_polarity:RW:2:1:=0x0 phy_dbi_mode:RW:1:1:=0x0 dfi_init_complete_en:RW:0:1:=0x0 |
| 575 | __REG( 0x00150200 ) = 0x0000001f ; //VALUE_ADDRMAP0 / addrmap_dch_bit0:RW:16:5:=0x0 addrmap_cs_bit1:RW:8:5:=0x0 addrmap_cs_bit0:RW:0:5:=0x1f |
| 576 | |
| 577 | if(flag == CHIP_DDR_IS_32M) |
| 578 | { |
| 579 | __REG( 0x00150204 ) = 0x001f0606 ; //VALUE_ADDRMAP1 / addrmap_bank_b2:RW:16:4:=0x7 addrmap_bank_b1:RW:8:4:=0x7 addrmap_bank_b0:RW:0:4:=0x7 |
| 580 | __REG( 0x00150208 ) = 0x00000000 ; //VALUE_ADDRMAP2 / addrmap_col_b5:RW:24:4:=0x0 addrmap_col_b4:RW:16:4:=0x0 addrmap_col_b3:RW:8:4:=0x0 addrmap_col_b2:RW:0:4:=0x0 |
| 581 | __REG( 0x0015020c ) = 0x0f0f0000 ; //VALUE_ADDRMAP3 / addrmap_col_b9:RW:24:4:=0xf addrmap_col_b8:RW:16:4:=0x0 addrmap_col_b7:RW:8:4:=0x0 addrmap_col_b6:RW:0:4:=0x0 |
| 582 | __REG( 0x00150210 ) = 0x00000f0f ; //VALUE_ADDRMAP4 / addrmap_col_b11:RW:8:4:=0xf addrmap_col_b10:RW:0:4:=0xf |
| 583 | |
| 584 | } |
| 585 | else if(flag == CHIP_DDR_IS_64M) |
| 586 | { |
| 587 | __REG( 0x00150204 ) = 0x001f0707 ; //VALUE_ADDRMAP1 / addrmap_bank_b2:RW:16:4:=0x7 addrmap_bank_b1:RW:8:4:=0x7 addrmap_bank_b0:RW:0:4:=0x7 |
| 588 | __REG( 0x00150208 ) = 0x00000000 ; //VALUE_ADDRMAP2 / addrmap_col_b5:RW:24:4:=0x0 addrmap_col_b4:RW:16:4:=0x0 addrmap_col_b3:RW:8:4:=0x0 addrmap_col_b2:RW:0:4:=0x0 |
| 589 | __REG( 0x0015020c ) = 0x0f000000 ; //VALUE_ADDRMAP3 / addrmap_col_b9:RW:24:4:=0xf addrmap_col_b8:RW:16:4:=0x0 addrmap_col_b7:RW:8:4:=0x0 addrmap_col_b6:RW:0:4:=0x0 |
| 590 | __REG( 0x00150210 ) = 0x00000f0f ; //VALUE_ADDRMAP4 / addrmap_col_b11:RW:8:4:=0xf addrmap_col_b10:RW:0:4:=0xf |
| 591 | |
| 592 | } |
xf.li | ca7c3fc | 2024-02-21 22:59:57 -0800 | [diff] [blame] | 593 | else if((flag == CHIP_DDR_IS_128M)||(flag == CHIP_DDR_IS_256M)) |
| 594 | { |
| 595 | __REG( 0x00150204 ) = 0x00070707 ; //VALUE_ADDRMAP1 / addrmap_bank_b2:RW:16:4:=0x7 addrmap_bank_b1:RW:8:4:=0x7 addrmap_bank_b0:RW:0:4:=0x7 |
| 596 | __REG( 0x00150208 ) = 0x00000000 ; //VALUE_ADDRMAP2 / addrmap_col_b5:RW:24:4:=0x0 addrmap_col_b4:RW:16:4:=0x0 addrmap_col_b3:RW:8:4:=0x0 addrmap_col_b2:RW:0:4:=0x0 |
| 597 | __REG( 0x0015020c ) = 0x0f000000 ; //VALUE_ADDRMAP3 / addrmap_col_b9:RW:24:4:=0xf addrmap_col_b8:RW:16:4:=0x0 addrmap_col_b7:RW:8:4:=0x0 addrmap_col_b6:RW:0:4:=0x0 |
| 598 | __REG( 0x00150210 ) = 0x00000f0f ; //VALUE_ADDRMAP4 / addrmap_col_b11:RW:8:4:=0xf addrmap_col_b10:RW:0:4:=0xf |
| 599 | |
| 600 | } |
| 601 | else if(flag == CHIP_DDR_IS_512M){ |
| 602 | __REG( 0x00150204 ) = 0x00080808 ; //VALUE_ADDRMAP1 / addrmap_bank_b2:RW:16:4:=0x7 addrmap_bank_b1:RW:8:4:=0x7 addrmap_bank_b0:RW:0:4:=0x7 |
| 603 | __REG( 0x00150208 ) = 0x00000000 ; //VALUE_ADDRMAP2 / addrmap_col_b5:RW:24:4:=0x0 addrmap_col_b4:RW:16:4:=0x0 addrmap_col_b3:RW:8:4:=0x0 addrmap_col_b2:RW:0:4:=0x0 |
| 604 | __REG( 0x0015020c ) = 0x00000000 ; //VALUE_ADDRMAP3 / addrmap_col_b9:RW:24:4:=0x0 addrmap_col_b8:RW:16:4:=0x0 addrmap_col_b7:RW:8:4:=0x0 addrmap_col_b6:RW:0:4:=0x0 |
| 605 | __REG( 0x00150210 ) = 0x00000f0f ; //VALUE_ADDRMAP4 / addrmap_col_b11:RW:8:4:=0xf addrmap_col_b10:RW:0:4:=0xf |
| 606 | } |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 607 | else |
| 608 | { |
| 609 | __REG( 0x00150204 ) = 0x00070707 ; //VALUE_ADDRMAP1 / addrmap_bank_b2:RW:16:4:=0x7 addrmap_bank_b1:RW:8:4:=0x7 addrmap_bank_b0:RW:0:4:=0x7 |
| 610 | __REG( 0x00150208 ) = 0x00000000 ; //VALUE_ADDRMAP2 / addrmap_col_b5:RW:24:4:=0x0 addrmap_col_b4:RW:16:4:=0x0 addrmap_col_b3:RW:8:4:=0x0 addrmap_col_b2:RW:0:4:=0x0 |
| 611 | __REG( 0x0015020c ) = 0x0f000000 ; //VALUE_ADDRMAP3 / addrmap_col_b9:RW:24:4:=0xf addrmap_col_b8:RW:16:4:=0x0 addrmap_col_b7:RW:8:4:=0x0 addrmap_col_b6:RW:0:4:=0x0 |
| 612 | __REG( 0x00150210 ) = 0x00000f0f ; //VALUE_ADDRMAP4 / addrmap_col_b11:RW:8:4:=0xf addrmap_col_b10:RW:0:4:=0xf |
| 613 | |
| 614 | } |
| 615 | |
| 616 | if(flag == CHIP_DDR_IS_32M) |
| 617 | { |
| 618 | __REG( 0x00150214 ) = 0x04040404 ; //VALUE_ADDRMAP5 / addrmap_row_b11:RW:24:4:=0x6 addrmap_row_b2_10:RW:16:4:=0x6 addrmap_row_b1:RW:8:4:=0x6 addrmap_row_b0:RW:0:4:=0x6 |
| 619 | __REG( 0x00150218 ) = 0x0f0f0f04 ; //VALUE_ADDRMAP6 / addrmap_row_b15:RW:24:4:=0xf addrmap_row_b14:RW:16:4:=0xf addrmap_row_b13:RW:8:4:=0xf addrmap_row_b12:RW:0:4:=0x6 |
| 620 | } |
| 621 | else if(flag == CHIP_DDR_IS_64M) |
| 622 | { |
| 623 | __REG( 0x00150214 ) = 0x05050505 ; //VALUE_ADDRMAP5 / addrmap_row_b11:RW:24:4:=0x6 addrmap_row_b2_10:RW:16:4:=0x6 addrmap_row_b1:RW:8:4:=0x6 addrmap_row_b0:RW:0:4:=0x6 |
| 624 | __REG( 0x00150218 ) = 0x0f0f0f05 ; //VALUE_ADDRMAP6 / addrmap_row_b15:RW:24:4:=0xf addrmap_row_b14:RW:16:4:=0xf addrmap_row_b13:RW:8:4:=0xf addrmap_row_b12:RW:0:4:=0x6 |
| 625 | } |
xf.li | ca7c3fc | 2024-02-21 22:59:57 -0800 | [diff] [blame] | 626 | else if(flag == CHIP_DDR_IS_128M) |
| 627 | { |
| 628 | __REG( 0x00150214 ) = 0x06060606 ; //VALUE_ADDRMAP5 / addrmap_row_b11:RW:24:4:=0x6 addrmap_row_b2_10:RW:16:4:=0x6 addrmap_row_b1:RW:8:4:=0x6 addrmap_row_b0:RW:0:4:=0x6 |
| 629 | __REG( 0x00150218 ) = 0x0f0f0f06 ; //VALUE_ADDRMAP6 / addrmap_row_b15:RW:24:4:=0xf addrmap_row_b14:RW:16:4:=0xf addrmap_row_b13:RW:8:4:=0xf addrmap_row_b12:RW:0:4:=0x6 |
| 630 | } |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 631 | else if(flag == CHIP_DDR_IS_256M) |
| 632 | { |
| 633 | __REG( 0x00150214 ) = 0x06060606 ; //VALUE_ADDRMAP5 / addrmap_row_b11:RW:24:4:=0x6 addrmap_row_b2_10:RW:16:4:=0x6 addrmap_row_b1:RW:8:4:=0x6 addrmap_row_b0:RW:0:4:=0x6 |
| 634 | __REG( 0x00150218 ) = 0x0f0f0606 ; //VALUE_ADDRMAP6 / addrmap_row_b15:RW:24:4:=0xf addrmap_row_b14:RW:16:4:=0xf addrmap_row_b13:RW:8:4:=0x6 addrmap_row_b12:RW:0:4:=0x6 |
| 635 | } |
xf.li | ca7c3fc | 2024-02-21 22:59:57 -0800 | [diff] [blame] | 636 | else if(flag == CHIP_DDR_IS_512M) |
| 637 | { |
| 638 | __REG( 0x00150214 ) = 0x07070707 ; //VALUE_ADDRMAP5 / addrmap_row_b11:RW:24:4:=0x6 addrmap_row_b2_10:RW:16:4:=0x6 addrmap_row_b1:RW:8:4:=0x6 addrmap_row_b0:RW:0:4:=0x6 |
| 639 | __REG( 0x00150218 ) = 0x0f0f0707 ; //VALUE_ADDRMAP6 / addrmap_row_b15:RW:24:4:=0xf addrmap_row_b14:RW:16:4:=0xf addrmap_row_b13:RW:8:4:=0x6 addrmap_row_b12:RW:0:4:=0x6 |
| 640 | } |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 641 | else |
| 642 | { |
| 643 | __REG( 0x00150214 ) = 0x06060606 ; //VALUE_ADDRMAP5 / addrmap_row_b11:RW:24:4:=0x6 addrmap_row_b2_10:RW:16:4:=0x6 addrmap_row_b1:RW:8:4:=0x6 addrmap_row_b0:RW:0:4:=0x6 |
| 644 | __REG( 0x00150218 ) = 0x0f0f0f06 ; //VALUE_ADDRMAP6 / addrmap_row_b15:RW:24:4:=0xf addrmap_row_b14:RW:16:4:=0xf addrmap_row_b13:RW:8:4:=0xf addrmap_row_b12:RW:0:4:=0x6 |
| 645 | } |
| 646 | __REG( 0x00150240 ) = 0x04000400 ; //VALUE_ODTCFG / wr_odt_hold:RW:24:4:=0x4 wr_odt_delay:RW:16:4:=0x0 rd_odt_hold:RW:8:4:=0x4 rd_odt_delay:RW:2:4:=0x0 |
| 647 | __REG( 0x00150244 ) = 0x00000000 ; //VALUE_ODTMAP / rank3_rd_odt:RW:28:4:=0x0 rank3_wr_odt:RW:24:4:=0x0 rank2_rd_odt:RW:20:4:=0x0 rank2_wr_odt:RW:16:4:=0x0 rank1_rd_odt:RW:12:4:=0x0 rank1_wr_odt:RW:8:4:=0x0 rank0_rd_odt:RW:4:4:=0x0 rank0_wr_odt:RW:0:4:=0x0 |
| 648 | __REG( 0x00150250 ) = 0x00001805 ; //VALUE_SCHED / rdwr_idle_gap:RW:24:7:=0x0 go2critical_hysteresis:RW:16:8:=0x0 lpr_num_entries:RW:8:6:=0x18 pageclose:RW:2:1:=0x1 prefer_write:RW:1:1:=0x0 force_low_pri_n:RW:0:1:=0x1 |
| 649 | __REG( 0x00150254 ) = 0x00000000 ; //VALUE_SCHED1 / pageclose_timer:RW:0:8:=0x0 |
| 650 | |
| 651 | __REG( 0x00150300 ) = 0x00000000 ; //VALUE_DBG0 / dis_collision_page_opt:RW:4:1:=0x0 dis_act_bypass:RW:2:1:=0x0 dis_rd_bypass:RW:1:1:=0x0 dis_wc:RW:0:1:=0x0 |
| 652 | __REG( 0x00150304 ) = 0x00000000 ; //VALUE_DBG1 / dis_dq:RW:1:1:=0x0 dis_hig:RW:0:1:=0x0 |
| 653 | __REG( 0x0015030c ) = 0x00000000 ; //VALUE_DBGCMD / ctrlupd:RWSC:5:1:=0x0 zq_calib_short:RWSC:4:1:=0x0 rank3_refresh:RWSC:3:1:=0x0 rank2_refresh:RWSC:2:1:=0x0 rank1_refresh:RWSC:1:1:=0x0 rank0_refresh:RWSC:0:1:=0x0 |
| 654 | |
| 655 | __REG( 0x00150400 ) = 0x00000000 ; //VALUE_PCCFG / bl_exp_mode:RW:8:1:=0x0 pagematch_limit:RW:1:1:=0x0 go2critical_en:RW:0:1:=0x0 |
| 656 | |
| 657 | return 0; |
| 658 | |
| 659 | } |
| 660 | |
| 661 | int ddr_prio_init(int flag) |
| 662 | { |
| 663 | //port read static priority bit0-9, bit0-4 timeout, bit5-9 priority |
| 664 | __REG( 0x00150404 ) = 0x000013ff ; //VALUE_PCFGR_0 / rdwr_ordered_en:RW:16:1:=0x0 rd_port_pagematch_en:RW:14:1:=0x0 rd_port_urgent_en:RW:13:1:=0x0 rd_port_aging_en:RW:12:1:=0x1 read_reorder_bypass_en:RW:11:1:=0x0 rd_port_priority:RW:0:10:=0x3ff |
| 665 | __REG( 0x001504b4 ) = 0x00001020 ; //VALUE_PCFGR_1 / rdwr_ordered_en:RW:16:1:=0x0 rd_port_pagematch_en:RW:14:1:=0x0 rd_port_urgent_en:RW:13:1:=0x0 rd_port_aging_en:RW:12:1:=0x1 read_reorder_bypass_en:RW:11:1:=0x0 rd_port_priority:RW:0:10:=0x20 |
| 666 | __REG( 0x00150564 ) = 0x00001000 ; //VALUE_PCFGR_2 / rdwr_ordered_en:RW:16:1:=0x0 rd_port_pagematch_en:RW:14:1:=0x0 rd_port_urgent_en:RW:13:1:=0x0 rd_port_aging_en:RW:12:1:=0x1 read_reorder_bypass_en:RW:11:1:=0x0 rd_port_priority:RW:0:10:=0x0 |
| 667 | __REG( 0x00150614 ) = 0x00001004 ; //VALUE_PCFGR_3 / rdwr_ordered_en:RW:16:1:=0x0 rd_port_pagematch_en:RW:14:1:=0x0 rd_port_urgent_en:RW:13:1:=0x0 rd_port_aging_en:RW:12:1:=0x1 read_reorder_bypass_en:RW:11:1:=0x0 rd_port_priority:RW:0:10:=0x4 |
| 668 | //port write static priority bit0-9 |
| 669 | __REG( 0x00150408 ) = 0x000013ff ; //VALUE_PCFGW_0 / wr_port_pagematch_en:RW:14:1:=0x0 wr_port_urgent_en:RW:13:1:=0x0 wr_port_aging_en:RW:12:1:=0x1 wr_port_priority:RW:0:10:=0x3ff |
| 670 | __REG( 0x001504b8 ) = 0x000010ff ; //VALUE_PCFGW_1 / wr_port_pagematch_en:RW:14:1:=0x0 wr_port_urgent_en:RW:13:1:=0x0 wr_port_aging_en:RW:12:1:=0x1 wr_port_priority:RW:0:10:=0xff |
| 671 | __REG( 0x00150568 ) = 0x0000103f ; //VALUE_PCFGW_2 / wr_port_pagematch_en:RW:14:1:=0x0 wr_port_urgent_en:RW:13:1:=0x0 wr_port_aging_en:RW:12:1:=0x1 wr_port_priority:RW:0:10:=0x3f |
| 672 | __REG( 0x00150618 ) = 0x0000105f ; //VALUE_PCFGW_3 / wr_port_pagematch_en:RW:14:1:=0x0 wr_port_urgent_en:RW:13:1:=0x0 wr_port_aging_en:RW:12:1:=0x1 wr_port_priority:RW:0:10:=0x5f |
| 673 | //port read region set |
| 674 | __REG( 0x00150494 ) = 0x0020000e ; //VALUE_PCFGQOS0_0 / rqos_map_region2:RW:24:2:=0x0 rqos_map_region1:RW:20:2:=0x2 rqos_map_region0:RW:16:2:=0x0 rqos_map_level2:RW:8:4:=0x0 rqos_map_level1:RW:0:4:=0xe |
| 675 | __REG( 0x00150544 ) = 0x0020000e ; //VALUE_PCFGQOS0_1 / rqos_map_region2:RW:24:2:=0x0 rqos_map_region1:RW:20:2:=0x2 rqos_map_region0:RW:16:2:=0x0 rqos_map_level2:RW:8:4:=0x0 rqos_map_level1:RW:0:4:=0xe |
| 676 | __REG( 0x001505f4 ) = 0x0020000e ; //VALUE_PCFGQOS0_2 / rqos_map_region2:RW:24:2:=0x0 rqos_map_region1:RW:20:2:=0x2 rqos_map_region0:RW:16:2:=0x0 rqos_map_level2:RW:8:4:=0x0 rqos_map_level1:RW:0:4:=0xe |
| 677 | __REG( 0x001506a4 ) = 0x0020000e ; //VALUE_PCFGQOS0_3 / rqos_map_region2:RW:24:2:=0x0 rqos_map_region1:RW:20:2:=0x2 rqos_map_region0:RW:16:2:=0x0 rqos_map_level2:RW:8:4:=0x0 rqos_map_level1:RW:0:4:=0xe |
| 678 | //port write region set |
| 679 | __REG( 0x0015049c ) = 0x00000000 ; //VALUE_PCFGWQOS0_0 / wqos_map_region1:RW:20:2:=0x0 wqos_map_region0:RW:16:2:=0x0 wqos_map_level:RW:0:4:=0x0 |
| 680 | __REG( 0x0015054c ) = 0x00000000 ; //VALUE_PCFGWQOS0_1 / wqos_map_region1:RW:20:2:=0x0 wqos_map_region0:RW:16:2:=0x0 wqos_map_level:RW:0:4:=0x0 |
| 681 | __REG( 0x001505fc ) = 0x00000000 ; //VALUE_PCFGWQOS0_2 / wqos_map_region1:RW:20:2:=0x0 wqos_map_region0:RW:16:2:=0x0 wqos_map_level:RW:0:4:=0x0 |
| 682 | __REG( 0x001506ac ) = 0x00000000 ; //VALUE_PCFGWQOS0_3 / wqos_map_region1:RW:20:2:=0x0 wqos_map_region0:RW:16:2:=0x0 wqos_map_level:RW:0:4:=0x0 |
| 683 | //vpr timeout, region2 is red queue |
| 684 | __REG( 0x00150498 ) = 0x00000000 ; //VALUE_PCFGQOS1_0 / rqos_map_timeoutr:RW:16:11:=0x0 rqos_map_timeoutb:RW:0:11:=0x0 |
| 685 | __REG( 0x00150548 ) = 0x00000000 ; //VALUE_PCFGQOS1_1 / rqos_map_timeoutr:RW:16:11:=0x0 rqos_map_timeoutb:RW:0:11:=0x0 |
| 686 | __REG( 0x001505f8 ) = 0x00000000 ; //VALUE_PCFGQOS1_2 / rqos_map_timeoutr:RW:16:11:=0x0 rqos_map_timeoutb:RW:0:11:=0x0 |
| 687 | __REG( 0x001506a8 ) = 0x00000000 ; //VALUE_PCFGQOS1_3 / rqos_map_timeoutr:RW:16:11:=0x0 rqos_map_timeoutb:RW:0:11:=0x0 |
| 688 | //vpw timeout |
| 689 | __REG( 0x001504a0 ) = 0x00000000 ; //VALUE_PCFGWQOS1_0 / wqos_map_timeout:RW:0:11:=0x0 |
| 690 | __REG( 0x00150550 ) = 0x00000000 ; //VALUE_PCFGWQOS1_1 / wqos_map_timeout:RW:0:11:=0x0 |
| 691 | __REG( 0x00150600 ) = 0x00000000 ; //VALUE_PCFGWQOS1_2 / wqos_map_timeout:RW:0:11:=0x0 |
| 692 | __REG( 0x001506b0 ) = 0x00000000 ; //VALUE_PCFGWQOS1_3 / wqos_map_timeout:RW:0:11:=0x0 |
| 693 | //in CAM set |
| 694 | __REG( 0x0015025c ) = 0x0f000001 ; //VALUE_PERFHPR1 / hpr_xact_run_length:RW:24:8:=0xf hpr_max_starve:RW:0:16:=0x1 |
| 695 | __REG( 0x00150264 ) = 0x0f00007f ; //VALUE_PERFLPR1 / lpr_xact_run_length:RW:24:8:=0xf lpr_max_starve:RW:0:16:=0x7f |
| 696 | __REG( 0x0015026c ) = 0x0f00007f ; //VALUE_PERFWR1 / w_xact_run_length:RW:24:8:=0xf w_max_starve:RW:0:16:=0x7f |
| 697 | __REG( 0x00150274 ) = 0x00000000 ; //VALUE_PERFVPR1 / vpr_timeout_range:RW:0:11:=0x0 |
| 698 | __REG( 0x00150278 ) = 0x00000000 ; //VALUE_PERFVPW1 / vpw_timeout_range:RW:0:11:=0x0 |
| 699 | //port extern static priority |
| 700 | //__REG( 0x0013d034 ) = 0xf0f00000 ; //port0,1 rqos=0(LPR); port2,3 rqos=F(HPR) |
| 701 | |
| 702 | return 0; |
| 703 | |
| 704 | } |
| 705 | |
| 706 | int ddr_init(int flag) |
| 707 | { |
| 708 | UINT32 g_PhyJZ[6]={0}; |
| 709 | |
| 710 | //__REG( 0x01306100 ) = 0xffffe000 ; //ddr all reset enable bit6-12=0 |
| 711 | __REG( 0x01306100 ) = 0x0affe000 ; //ddr all reset enable bit6-12=0 |
| 712 | nsdelay(200000);//0.01s |
| 713 | __REG( 0x01306100 ) = 0x0affe400 ; //release ddr apb(bit10) |
| 714 | nsdelay(200000);//0.01s |
| 715 | |
| 716 | //ddr clk init |
| 717 | ddr_clk_init(flag); |
| 718 | |
| 719 | //phy register init |
| 720 | ddr_phy_init(flag); |
| 721 | |
| 722 | //controller register init |
| 723 | ddr_ctrl_init(flag); |
| 724 | |
| 725 | //ddr_priority_config |
| 726 | ddr_prio_init(flag); |
| 727 | |
| 728 | //wait all register configer done in hardware |
| 729 | nsdelay(200000);//0.01s |
| 730 | |
| 731 | |
| 732 | //*********************************************************** |
| 733 | //ctroller and inno phy registers configer done |
| 734 | //*********************************************************** |
| 735 | __REG( 0x01306100 ) = 0x0affffc0 ; //release ddr ctl(bit11) and axi_sn reset(bit6-9) and phy reset(bit12) ; //ÉèÖÃϵͳ¼Ä´æÆ÷Öµ |
| 736 | nsdelay(200000);//0.01s |
| 737 | |
| 738 | |
| 739 | //sw config done |
| 740 | __REG( 0x00150320 ) = 0x00000000 ; //SWCTL ; // sw_done:RW:0:1:=0x0 |
| 741 | //check phy auto init done, wait 0x00150324 bit0 =0 |
| 742 | nsdelay(200000);//0.01s |
| 743 | |
| 744 | |
| 745 | //power on PHY PLL |
| 746 | __REG( 0x001543b4 ) = 0x00000018 ; //PHYREGED,PLLCLKOUTEN:RW:4:1:=0x1,Reserved:RW:2:2:=0x2, pll_pd_en:RW:1:1:=0x0, fbdiv[8]:RW:0:1:=0x0 |
| 747 | //wait PHY PLL lock,PHYREGF8[0]Pll lock indicate signal |
| 748 | |
| 749 | nsdelay(200000);//0.01s |
| 750 | |
| 751 | |
| 752 | //PHY DLL init start, fall edge trigger |
| 753 | if(flag == CHIP_DDR_IS_32M) |
| 754 | { |
| 755 | #ifndef _DDR32M_DS_48om //60ohm |
| 756 | __REG( 0x0015417c ) = 0x00000004 ; //PHYREG5F, PHY init start:5:1:=0x1 |
| 757 | #else //48ohm |
| 758 | __REG( 0x0015417c ) = 0x00000005 ; //PHYREG5F, PHY init start:5:1:=0x1 |
| 759 | #endif |
| 760 | } |
| 761 | else |
| 762 | { |
| 763 | #ifndef _DDR_DS_48om //60ohm |
| 764 | __REG( 0x0015417c ) = 0x00000004 ; //PHYREG5F, PHY init start:5:1:=0x1 |
| 765 | #else //48ohm |
| 766 | __REG( 0x0015417c ) = 0x00000005 ; //PHYREG5F, PHY init start:5:1:=0x1 |
| 767 | #endif |
| 768 | } |
| 769 | //wait dll lock, phy init done, PHYREGF8[1]Phy init complete signal |
| 770 | nsdelay(200000);//0.01s |
| 771 | |
| 772 | |
| 773 | //enable controller dfi_init_complete_en to start sdram init, then will send dram init cmd |
| 774 | __REG( 0x001501b0 ) = 0x00000001 ; //DFIMISC ; // phy_dbi_mode:RW:1:1:=0x0 dfi_init_complete_en:RW:0:1:=0x1 ÊÇ·ñÈ¥µô£¬»òÕß¶ÔÓ¦ÐÞ¸Ä |
| 775 | //check controller status is sdram init done,wait 0x00150004 bit0-2 !=0 |
| 776 | nsdelay(200000);//0.01s |
| 777 | |
| 778 | __REG( 0x001501b0 ) = 0x00000000 ; //dfimisc[0] phy_dbi_mode:RW:1:1:=0x0 dfi_init_complete_en:RW:0:1:=0x0 |
| 779 | |
| 780 | if(flag == CHIP_DDR_IS_32M) |
| 781 | { |
| 782 | do |
| 783 | { |
| 784 | //phy DQS gate training start |
| 785 | __REG( 0x00154008 ) = 0x00000001 ; //PHYREG02,bit0:DQS gating calibration control=1, bit1:DQS gating bypass mode select=0 |
| 786 | //wait training done |
| 787 | nsdelay(200000);//0.01s |
| 788 | |
| 789 | //phy DQS gate training stop |
| 790 | __REG( 0x00154008 ) = 0x00000000 ; //PHYREG02,bit0:DQS gating calibration control=0, bit1:DQS gating bypass mode select=0 |
| 791 | |
| 792 | nsdelay(200000);//0.01s |
| 793 | g_PhyJZ[0]=ABSa_b(__REG(0x001543ec),__REG(0x001543f0)); |
| 794 | |
| 795 | }while((g_PhyJZ[0]>4)|(__REG(0x001543ec)&0x80)); |
| 796 | } |
| 797 | else |
| 798 | { |
| 799 | do |
| 800 | { |
| 801 | //phy DQS gate training start |
| 802 | __REG( 0x00154008 ) = 0x00000001 ; //PHYREG02,bit0:DQS gating calibration control=1, bit1:DQS gating bypass mode select=0 |
| 803 | //wait training done |
| 804 | nsdelay(200000);//0.01s |
| 805 | |
| 806 | //phy DQS gate training stop |
| 807 | __REG( 0x00154008 ) = 0x00000000 ; //PHYREG02,bit0:DQS gating calibration control=0, bit1:DQS gating bypass mode select=0 |
| 808 | |
| 809 | nsdelay(200000);//0.01s |
| 810 | g_PhyJZ[0]=ABSa_b(__REG(0x001543ec),__REG(0x001543f0)); |
| 811 | g_PhyJZ[1]=ABSa_b(__REG(0x001543ec),__REG(0x001543f4)); |
| 812 | g_PhyJZ[2]=ABSa_b(__REG(0x001543ec),__REG(0x001543f8)); |
| 813 | |
| 814 | g_PhyJZ[3]=ABSa_b(__REG(0x001543f0),__REG(0x001543f4)); |
| 815 | g_PhyJZ[4]=ABSa_b(__REG(0x001543f0),__REG(0x001543f8)); |
| 816 | |
| 817 | g_PhyJZ[5]=ABSa_b(__REG(0x001543f4),__REG(0x001543f8)); |
| 818 | }while((g_PhyJZ[0]>4)|(g_PhyJZ[1]>4)|(g_PhyJZ[2]>4)|(g_PhyJZ[3]>4)|(g_PhyJZ[4]>4)|(g_PhyJZ[5]>4)|(__REG(0x001543ec)&0x80)); |
| 819 | } |
| 820 | |
| 821 | //enable port_n |
| 822 | __REG( 0x00150490 ) = 0x00000001 ; //VALUE_PCTRL_0 / port_en:RW:0:1:=0x1 |
| 823 | __REG( 0x00150540 ) = 0x00000001 ; //VALUE_PCTRL_1 / port_en:RW:0:1:=0x1 |
| 824 | __REG( 0x001505f0 ) = 0x00000001 ; //VALUE_PCTRL_2 / port_en:RW:0:1:=0x1 |
| 825 | __REG( 0x001506a0 ) = 0x00000001 ; //VALUE_PCTRL_3 / port_en:RW:0:1:=0x1 |
| 826 | |
| 827 | #ifdef DDR_FFC |
| 828 | ddr_ffc_init(); |
| 829 | #endif |
| 830 | return 0; |
| 831 | |
| 832 | } |
| 833 | |
| 834 | |