Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Kever Yang | 1a94b9e | 2017-09-27 16:38:22 +0800 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2017 Rockchip Electronics Co., Ltd |
Kever Yang | 1a94b9e | 2017-09-27 16:38:22 +0800 | [diff] [blame] | 4 | */ |
| 5 | #ifndef _ASM_ARCH_SDRAM_RK322X_H |
| 6 | #define _ASM_ARCH_SDRAM_RK322X_H |
| 7 | |
| 8 | #include <common.h> |
| 9 | |
| 10 | enum { |
| 11 | DDR3 = 3, |
| 12 | LPDDR2 = 5, |
| 13 | LPDDR3 = 6, |
| 14 | UNUSED = 0xFF, |
| 15 | }; |
| 16 | |
| 17 | struct rk322x_sdram_channel { |
| 18 | /* |
| 19 | * bit width in address, eg: |
| 20 | * 8 banks using 3 bit to address, |
| 21 | * 2 cs using 1 bit to address. |
| 22 | */ |
| 23 | u8 rank; |
| 24 | u8 col; |
| 25 | u8 bk; |
| 26 | u8 bw; |
| 27 | u8 dbw; |
| 28 | u8 row_3_4; |
| 29 | u8 cs0_row; |
| 30 | u8 cs1_row; |
| 31 | #if CONFIG_IS_ENABLED(OF_PLATDATA) |
| 32 | /* |
| 33 | * For of-platdata, which would otherwise convert this into two |
| 34 | * byte-swapped integers. With a size of 9 bytes, this struct will |
| 35 | * appear in of-platdata as a byte array. |
| 36 | * |
| 37 | * If OF_PLATDATA enabled, need to add a dummy byte in dts.(i.e 0xff) |
| 38 | */ |
| 39 | u8 dummy; |
| 40 | #endif |
| 41 | }; |
| 42 | |
| 43 | struct rk322x_ddr_pctl { |
| 44 | u32 scfg; |
| 45 | u32 sctl; |
| 46 | u32 stat; |
| 47 | u32 intrstat; |
| 48 | u32 reserved0[(0x40 - 0x10) / 4]; |
| 49 | u32 mcmd; |
| 50 | u32 powctl; |
| 51 | u32 powstat; |
| 52 | u32 cmdtstat; |
| 53 | u32 cmdtstaten; |
| 54 | u32 reserved1[(0x60 - 0x54) / 4]; |
| 55 | u32 mrrcfg0; |
| 56 | u32 mrrstat0; |
| 57 | u32 mrrstat1; |
| 58 | u32 reserved2[(0x7c - 0x6c) / 4]; |
| 59 | |
| 60 | u32 mcfg1; |
| 61 | u32 mcfg; |
| 62 | u32 ppcfg; |
| 63 | u32 mstat; |
| 64 | u32 lpddr2zqcfg; |
| 65 | u32 reserved3; |
| 66 | |
| 67 | u32 dtupdes; |
| 68 | u32 dtuna; |
| 69 | u32 dtune; |
| 70 | u32 dtuprd0; |
| 71 | u32 dtuprd1; |
| 72 | u32 dtuprd2; |
| 73 | u32 dtuprd3; |
| 74 | u32 dtuawdt; |
| 75 | u32 reserved4[(0xc0 - 0xb4) / 4]; |
| 76 | |
| 77 | u32 togcnt1u; |
| 78 | u32 tinit; |
| 79 | u32 trsth; |
| 80 | u32 togcnt100n; |
| 81 | u32 trefi; |
| 82 | u32 tmrd; |
| 83 | u32 trfc; |
| 84 | u32 trp; |
| 85 | u32 trtw; |
| 86 | u32 tal; |
| 87 | u32 tcl; |
| 88 | u32 tcwl; |
| 89 | u32 tras; |
| 90 | u32 trc; |
| 91 | u32 trcd; |
| 92 | u32 trrd; |
| 93 | u32 trtp; |
| 94 | u32 twr; |
| 95 | u32 twtr; |
| 96 | u32 texsr; |
| 97 | u32 txp; |
| 98 | u32 txpdll; |
| 99 | u32 tzqcs; |
| 100 | u32 tzqcsi; |
| 101 | u32 tdqs; |
| 102 | u32 tcksre; |
| 103 | u32 tcksrx; |
| 104 | u32 tcke; |
| 105 | u32 tmod; |
| 106 | u32 trstl; |
| 107 | u32 tzqcl; |
| 108 | u32 tmrr; |
| 109 | u32 tckesr; |
| 110 | u32 tdpd; |
| 111 | u32 tref_mem_ddr3; |
| 112 | u32 reserved5[(0x180 - 0x14c) / 4]; |
| 113 | u32 ecccfg; |
| 114 | u32 ecctst; |
| 115 | u32 eccclr; |
| 116 | u32 ecclog; |
| 117 | u32 reserved6[(0x200 - 0x190) / 4]; |
| 118 | u32 dtuwactl; |
| 119 | u32 dturactl; |
| 120 | u32 dtucfg; |
| 121 | u32 dtuectl; |
| 122 | u32 dtuwd0; |
| 123 | u32 dtuwd1; |
| 124 | u32 dtuwd2; |
| 125 | u32 dtuwd3; |
| 126 | u32 dtuwdm; |
| 127 | u32 dturd0; |
| 128 | u32 dturd1; |
| 129 | u32 dturd2; |
| 130 | u32 dturd3; |
| 131 | u32 dtulfsrwd; |
| 132 | u32 dtulfsrrd; |
| 133 | u32 dtueaf; |
| 134 | /* dfi control registers */ |
| 135 | u32 dfitctrldelay; |
| 136 | u32 dfiodtcfg; |
| 137 | u32 dfiodtcfg1; |
| 138 | u32 dfiodtrankmap; |
| 139 | /* dfi write data registers */ |
| 140 | u32 dfitphywrdata; |
| 141 | u32 dfitphywrlat; |
| 142 | u32 reserved7[(0x260 - 0x258) / 4]; |
| 143 | u32 dfitrddataen; |
| 144 | u32 dfitphyrdlat; |
| 145 | u32 reserved8[(0x270 - 0x268) / 4]; |
| 146 | u32 dfitphyupdtype0; |
| 147 | u32 dfitphyupdtype1; |
| 148 | u32 dfitphyupdtype2; |
| 149 | u32 dfitphyupdtype3; |
| 150 | u32 dfitctrlupdmin; |
| 151 | u32 dfitctrlupdmax; |
| 152 | u32 dfitctrlupddly; |
| 153 | u32 reserved9; |
| 154 | u32 dfiupdcfg; |
| 155 | u32 dfitrefmski; |
| 156 | u32 dfitctrlupdi; |
| 157 | u32 reserved10[(0x2ac - 0x29c) / 4]; |
| 158 | u32 dfitrcfg0; |
| 159 | u32 dfitrstat0; |
| 160 | u32 dfitrwrlvlen; |
| 161 | u32 dfitrrdlvlen; |
| 162 | u32 dfitrrdlvlgateen; |
| 163 | u32 dfiststat0; |
| 164 | u32 dfistcfg0; |
| 165 | u32 dfistcfg1; |
| 166 | u32 reserved11; |
| 167 | u32 dfitdramclken; |
| 168 | u32 dfitdramclkdis; |
| 169 | u32 dfistcfg2; |
| 170 | u32 dfistparclr; |
| 171 | u32 dfistparlog; |
| 172 | u32 reserved12[(0x2f0 - 0x2e4) / 4]; |
| 173 | |
| 174 | u32 dfilpcfg0; |
| 175 | u32 reserved13[(0x300 - 0x2f4) / 4]; |
| 176 | u32 dfitrwrlvlresp0; |
| 177 | u32 dfitrwrlvlresp1; |
| 178 | u32 dfitrwrlvlresp2; |
| 179 | u32 dfitrrdlvlresp0; |
| 180 | u32 dfitrrdlvlresp1; |
| 181 | u32 dfitrrdlvlresp2; |
| 182 | u32 dfitrwrlvldelay0; |
| 183 | u32 dfitrwrlvldelay1; |
| 184 | u32 dfitrwrlvldelay2; |
| 185 | u32 dfitrrdlvldelay0; |
| 186 | u32 dfitrrdlvldelay1; |
| 187 | u32 dfitrrdlvldelay2; |
| 188 | u32 dfitrrdlvlgatedelay0; |
| 189 | u32 dfitrrdlvlgatedelay1; |
| 190 | u32 dfitrrdlvlgatedelay2; |
| 191 | u32 dfitrcmd; |
| 192 | u32 reserved14[(0x3f8 - 0x340) / 4]; |
| 193 | u32 ipvr; |
| 194 | u32 iptr; |
| 195 | }; |
| 196 | check_member(rk322x_ddr_pctl, iptr, 0x03fc); |
| 197 | |
| 198 | struct rk322x_ddr_phy { |
| 199 | u32 ddrphy_reg[0x100]; |
| 200 | }; |
| 201 | |
| 202 | struct rk322x_pctl_timing { |
| 203 | u32 togcnt1u; |
| 204 | u32 tinit; |
| 205 | u32 trsth; |
| 206 | u32 togcnt100n; |
| 207 | u32 trefi; |
| 208 | u32 tmrd; |
| 209 | u32 trfc; |
| 210 | u32 trp; |
| 211 | u32 trtw; |
| 212 | u32 tal; |
| 213 | u32 tcl; |
| 214 | u32 tcwl; |
| 215 | u32 tras; |
| 216 | u32 trc; |
| 217 | u32 trcd; |
| 218 | u32 trrd; |
| 219 | u32 trtp; |
| 220 | u32 twr; |
| 221 | u32 twtr; |
| 222 | u32 texsr; |
| 223 | u32 txp; |
| 224 | u32 txpdll; |
| 225 | u32 tzqcs; |
| 226 | u32 tzqcsi; |
| 227 | u32 tdqs; |
| 228 | u32 tcksre; |
| 229 | u32 tcksrx; |
| 230 | u32 tcke; |
| 231 | u32 tmod; |
| 232 | u32 trstl; |
| 233 | u32 tzqcl; |
| 234 | u32 tmrr; |
| 235 | u32 tckesr; |
| 236 | u32 tdpd; |
| 237 | u32 trefi_mem_ddr3; |
| 238 | }; |
| 239 | |
| 240 | struct rk322x_phy_timing { |
| 241 | u32 mr[4]; |
| 242 | u32 mr11; |
| 243 | u32 bl; |
| 244 | u32 cl_al; |
| 245 | }; |
| 246 | |
| 247 | struct rk322x_msch_timings { |
| 248 | u32 ddrtiming; |
| 249 | u32 ddrmode; |
| 250 | u32 readlatency; |
| 251 | u32 activate; |
| 252 | u32 devtodev; |
| 253 | }; |
| 254 | |
| 255 | struct rk322x_service_sys { |
| 256 | u32 id_coreid; |
| 257 | u32 id_revisionid; |
| 258 | u32 ddrconf; |
| 259 | u32 ddrtiming; |
| 260 | u32 ddrmode; |
| 261 | u32 readlatency; |
| 262 | u32 activate; |
| 263 | u32 devtodev; |
| 264 | }; |
| 265 | |
| 266 | struct rk322x_base_params { |
| 267 | struct rk322x_msch_timings noc_timing; |
| 268 | u32 ddrconfig; |
| 269 | u32 ddr_freq; |
| 270 | u32 dramtype; |
| 271 | /* |
| 272 | * unused for rk322x |
| 273 | */ |
| 274 | u32 stride; |
| 275 | u32 odt; |
| 276 | }; |
| 277 | |
| 278 | /* PCT_DFISTCFG0 */ |
| 279 | #define DFI_INIT_START BIT(0) |
| 280 | #define DFI_DATA_BYTE_DISABLE_EN BIT(2) |
| 281 | |
| 282 | /* PCT_DFISTCFG1 */ |
| 283 | #define DFI_DRAM_CLK_SR_EN BIT(0) |
| 284 | #define DFI_DRAM_CLK_DPD_EN BIT(1) |
| 285 | |
| 286 | /* PCT_DFISTCFG2 */ |
| 287 | #define DFI_PARITY_INTR_EN BIT(0) |
| 288 | #define DFI_PARITY_EN BIT(1) |
| 289 | |
| 290 | /* PCT_DFILPCFG0 */ |
| 291 | #define TLP_RESP_TIME_SHIFT 16 |
| 292 | #define LP_SR_EN BIT(8) |
| 293 | #define LP_PD_EN BIT(0) |
| 294 | |
| 295 | /* PCT_DFITCTRLDELAY */ |
| 296 | #define TCTRL_DELAY_TIME_SHIFT 0 |
| 297 | |
| 298 | /* PCT_DFITPHYWRDATA */ |
| 299 | #define TPHY_WRDATA_TIME_SHIFT 0 |
| 300 | |
| 301 | /* PCT_DFITPHYRDLAT */ |
| 302 | #define TPHY_RDLAT_TIME_SHIFT 0 |
| 303 | |
| 304 | /* PCT_DFITDRAMCLKDIS */ |
| 305 | #define TDRAM_CLK_DIS_TIME_SHIFT 0 |
| 306 | |
| 307 | /* PCT_DFITDRAMCLKEN */ |
| 308 | #define TDRAM_CLK_EN_TIME_SHIFT 0 |
| 309 | |
| 310 | /* PCTL_DFIODTCFG */ |
| 311 | #define RANK0_ODT_WRITE_SEL BIT(3) |
| 312 | #define RANK1_ODT_WRITE_SEL BIT(11) |
| 313 | |
| 314 | /* PCTL_DFIODTCFG1 */ |
| 315 | #define ODT_LEN_BL8_W_SHIFT 16 |
| 316 | |
| 317 | /* PUBL_ACDLLCR */ |
| 318 | #define ACDLLCR_DLLDIS BIT(31) |
| 319 | #define ACDLLCR_DLLSRST BIT(30) |
| 320 | |
| 321 | /* PUBL_DXDLLCR */ |
| 322 | #define DXDLLCR_DLLDIS BIT(31) |
| 323 | #define DXDLLCR_DLLSRST BIT(30) |
| 324 | |
| 325 | /* PUBL_DLLGCR */ |
| 326 | #define DLLGCR_SBIAS BIT(30) |
| 327 | |
| 328 | /* PUBL_DXGCR */ |
| 329 | #define DQSRTT BIT(9) |
| 330 | #define DQRTT BIT(10) |
| 331 | |
| 332 | /* PIR */ |
| 333 | #define PIR_INIT BIT(0) |
| 334 | #define PIR_DLLSRST BIT(1) |
| 335 | #define PIR_DLLLOCK BIT(2) |
| 336 | #define PIR_ZCAL BIT(3) |
| 337 | #define PIR_ITMSRST BIT(4) |
| 338 | #define PIR_DRAMRST BIT(5) |
| 339 | #define PIR_DRAMINIT BIT(6) |
| 340 | #define PIR_QSTRN BIT(7) |
| 341 | #define PIR_RVTRN BIT(8) |
| 342 | #define PIR_ICPC BIT(16) |
| 343 | #define PIR_DLLBYP BIT(17) |
| 344 | #define PIR_CTLDINIT BIT(18) |
| 345 | #define PIR_CLRSR BIT(28) |
| 346 | #define PIR_LOCKBYP BIT(29) |
| 347 | #define PIR_ZCALBYP BIT(30) |
| 348 | #define PIR_INITBYP BIT(31) |
| 349 | |
| 350 | /* PGCR */ |
| 351 | #define PGCR_DFTLMT_SHIFT 3 |
| 352 | #define PGCR_DFTCMP_SHIFT 2 |
| 353 | #define PGCR_DQSCFG_SHIFT 1 |
| 354 | #define PGCR_ITMDMD_SHIFT 0 |
| 355 | |
| 356 | /* PGSR */ |
| 357 | #define PGSR_IDONE BIT(0) |
| 358 | #define PGSR_DLDONE BIT(1) |
| 359 | #define PGSR_ZCDONE BIT(2) |
| 360 | #define PGSR_DIDONE BIT(3) |
| 361 | #define PGSR_DTDONE BIT(4) |
| 362 | #define PGSR_DTERR BIT(5) |
| 363 | #define PGSR_DTIERR BIT(6) |
| 364 | #define PGSR_DFTERR BIT(7) |
| 365 | #define PGSR_RVERR BIT(8) |
| 366 | #define PGSR_RVEIRR BIT(9) |
| 367 | |
| 368 | /* PTR0 */ |
| 369 | #define PRT_ITMSRST_SHIFT 18 |
| 370 | #define PRT_DLLLOCK_SHIFT 6 |
| 371 | #define PRT_DLLSRST_SHIFT 0 |
| 372 | |
| 373 | /* PTR1 */ |
| 374 | #define PRT_DINIT0_SHIFT 0 |
| 375 | #define PRT_DINIT1_SHIFT 19 |
| 376 | |
| 377 | /* PTR2 */ |
| 378 | #define PRT_DINIT2_SHIFT 0 |
| 379 | #define PRT_DINIT3_SHIFT 17 |
| 380 | |
| 381 | /* DCR */ |
| 382 | #define DDRMD_LPDDR 0 |
| 383 | #define DDRMD_DDR 1 |
| 384 | #define DDRMD_DDR2 2 |
| 385 | #define DDRMD_DDR3 3 |
| 386 | #define DDRMD_LPDDR2_LPDDR3 4 |
| 387 | #define DDRMD_MASK 7 |
| 388 | #define DDRMD_SHIFT 0 |
| 389 | #define PDQ_MASK 7 |
| 390 | #define PDQ_SHIFT 4 |
| 391 | |
| 392 | /* DXCCR */ |
| 393 | #define DQSNRES_MASK 0xf |
| 394 | #define DQSNRES_SHIFT 8 |
| 395 | #define DQSRES_MASK 0xf |
| 396 | #define DQSRES_SHIFT 4 |
| 397 | |
| 398 | /* DTPR */ |
| 399 | #define TDQSCKMAX_SHIFT 27 |
| 400 | #define TDQSCKMAX_MASK 7 |
| 401 | #define TDQSCK_SHIFT 24 |
| 402 | #define TDQSCK_MASK 7 |
| 403 | |
| 404 | /* DSGCR */ |
| 405 | #define DQSGX_SHIFT 5 |
| 406 | #define DQSGX_MASK 7 |
| 407 | #define DQSGE_SHIFT 8 |
| 408 | #define DQSGE_MASK 7 |
| 409 | |
| 410 | /* SCTL */ |
| 411 | #define INIT_STATE 0 |
| 412 | #define CFG_STATE 1 |
| 413 | #define GO_STATE 2 |
| 414 | #define SLEEP_STATE 3 |
| 415 | #define WAKEUP_STATE 4 |
| 416 | |
| 417 | /* STAT */ |
| 418 | #define LP_TRIG_SHIFT 4 |
| 419 | #define LP_TRIG_MASK 7 |
| 420 | #define PCTL_STAT_MASK 7 |
| 421 | #define INIT_MEM 0 |
| 422 | #define CONFIG 1 |
| 423 | #define CONFIG_REQ 2 |
| 424 | #define ACCESS 3 |
| 425 | #define ACCESS_REQ 4 |
| 426 | #define LOW_POWER 5 |
| 427 | #define LOW_POWER_ENTRY_REQ 6 |
| 428 | #define LOW_POWER_EXIT_REQ 7 |
| 429 | |
| 430 | /* ZQCR*/ |
| 431 | #define PD_OUTPUT_SHIFT 0 |
| 432 | #define PU_OUTPUT_SHIFT 5 |
| 433 | #define PD_ONDIE_SHIFT 10 |
| 434 | #define PU_ONDIE_SHIFT 15 |
| 435 | #define ZDEN_SHIFT 28 |
| 436 | |
| 437 | /* DDLGCR */ |
| 438 | #define SBIAS_BYPASS BIT(23) |
| 439 | |
| 440 | /* MCFG */ |
| 441 | #define MDDR_LPDDR2_CLK_STOP_IDLE_SHIFT 24 |
| 442 | #define PD_IDLE_SHIFT 8 |
| 443 | #define MDDR_EN (2 << 22) |
| 444 | #define LPDDR2_EN (3 << 22) |
| 445 | #define LPDDR3_EN (1 << 22) |
| 446 | #define DDR2_EN (0 << 5) |
| 447 | #define DDR3_EN (1 << 5) |
| 448 | #define LPDDR2_S2 (0 << 6) |
| 449 | #define LPDDR2_S4 (1 << 6) |
| 450 | #define MDDR_LPDDR2_BL_2 (0 << 20) |
| 451 | #define MDDR_LPDDR2_BL_4 (1 << 20) |
| 452 | #define MDDR_LPDDR2_BL_8 (2 << 20) |
| 453 | #define MDDR_LPDDR2_BL_16 (3 << 20) |
| 454 | #define DDR2_DDR3_BL_4 0 |
| 455 | #define DDR2_DDR3_BL_8 1 |
| 456 | #define TFAW_SHIFT 18 |
| 457 | #define PD_EXIT_SLOW (0 << 17) |
| 458 | #define PD_EXIT_FAST (1 << 17) |
| 459 | #define PD_TYPE_SHIFT 16 |
| 460 | #define BURSTLENGTH_SHIFT 20 |
| 461 | |
| 462 | /* POWCTL */ |
| 463 | #define POWER_UP_START BIT(0) |
| 464 | |
| 465 | /* POWSTAT */ |
| 466 | #define POWER_UP_DONE BIT(0) |
| 467 | |
| 468 | /* MCMD */ |
| 469 | enum { |
| 470 | DESELECT_CMD = 0, |
| 471 | PREA_CMD, |
| 472 | REF_CMD, |
| 473 | MRS_CMD, |
| 474 | ZQCS_CMD, |
| 475 | ZQCL_CMD, |
| 476 | RSTL_CMD, |
| 477 | MRR_CMD = 8, |
| 478 | DPDE_CMD, |
| 479 | }; |
| 480 | |
| 481 | #define BANK_ADDR_MASK 7 |
| 482 | #define BANK_ADDR_SHIFT 17 |
| 483 | #define CMD_ADDR_MASK 0x1fff |
| 484 | #define CMD_ADDR_SHIFT 4 |
| 485 | |
| 486 | #define LPDDR23_MA_SHIFT 4 |
| 487 | #define LPDDR23_MA_MASK 0xff |
| 488 | #define LPDDR23_OP_SHIFT 12 |
| 489 | #define LPDDR23_OP_MASK 0xff |
| 490 | |
| 491 | #define START_CMD (1u << 31) |
| 492 | |
| 493 | /* DDRPHY REG */ |
| 494 | enum { |
| 495 | /* DDRPHY_REG0 */ |
| 496 | SOFT_RESET_MASK = 3, |
| 497 | SOFT_DERESET_ANALOG = 1 << 2, |
| 498 | SOFT_DERESET_DIGITAL = 1 << 3, |
| 499 | SOFT_RESET_SHIFT = 2, |
| 500 | |
| 501 | /* DDRPHY REG1 */ |
| 502 | PHY_DDR3 = 0, |
| 503 | PHY_DDR2 = 1, |
| 504 | PHY_LPDDR3 = 2, |
| 505 | PHY_LPDDR2 = 3, |
| 506 | |
| 507 | PHT_BL_8 = 1 << 2, |
| 508 | PHY_BL_4 = 0 << 2, |
| 509 | |
| 510 | /* DDRPHY_REG2 */ |
| 511 | MEMORY_SELECT_DDR3 = 0 << 0, |
| 512 | MEMORY_SELECT_LPDDR3 = 2 << 0, |
| 513 | MEMORY_SELECT_LPDDR2 = 3 << 0, |
| 514 | DQS_SQU_CAL_SEL_CS0_CS1 = 0 << 4, |
| 515 | DQS_SQU_CAL_SEL_CS1 = 1 << 4, |
| 516 | DQS_SQU_CAL_SEL_CS0 = 2 << 4, |
| 517 | DQS_SQU_CAL_NORMAL_MODE = 0 << 1, |
| 518 | DQS_SQU_CAL_BYPASS_MODE = 1 << 1, |
| 519 | DQS_SQU_CAL_START = 1 << 0, |
| 520 | DQS_SQU_NO_CAL = 0 << 0, |
| 521 | }; |
| 522 | |
| 523 | /* CK pull up/down driver strength control */ |
| 524 | enum { |
| 525 | PHY_RON_RTT_DISABLE = 0, |
| 526 | PHY_RON_RTT_451OHM = 1, |
| 527 | PHY_RON_RTT_225OHM, |
| 528 | PHY_RON_RTT_150OHM, |
| 529 | PHY_RON_RTT_112OHM, |
| 530 | PHY_RON_RTT_90OHM, |
| 531 | PHY_RON_RTT_75OHM, |
| 532 | PHY_RON_RTT_64OHM = 7, |
| 533 | |
| 534 | PHY_RON_RTT_56OHM = 16, |
| 535 | PHY_RON_RTT_50OHM, |
| 536 | PHY_RON_RTT_45OHM, |
| 537 | PHY_RON_RTT_41OHM, |
| 538 | PHY_RON_RTT_37OHM, |
| 539 | PHY_RON_RTT_34OHM, |
| 540 | PHY_RON_RTT_33OHM, |
| 541 | PHY_RON_RTT_30OHM = 23, |
| 542 | |
| 543 | PHY_RON_RTT_28OHM = 24, |
| 544 | PHY_RON_RTT_26OHM, |
| 545 | PHY_RON_RTT_25OHM, |
| 546 | PHY_RON_RTT_23OHM, |
| 547 | PHY_RON_RTT_22OHM, |
| 548 | PHY_RON_RTT_21OHM, |
| 549 | PHY_RON_RTT_20OHM, |
| 550 | PHY_RON_RTT_19OHM = 31, |
| 551 | }; |
| 552 | |
| 553 | /* DQS squelch DLL delay */ |
| 554 | enum { |
| 555 | DQS_DLL_NO_DELAY = 0, |
| 556 | DQS_DLL_22P5_DELAY, |
| 557 | DQS_DLL_45_DELAY, |
| 558 | DQS_DLL_67P5_DELAY, |
| 559 | DQS_DLL_90_DELAY, |
| 560 | DQS_DLL_112P5_DELAY, |
| 561 | DQS_DLL_135_DELAY, |
| 562 | DQS_DLL_157P5_DELAY, |
| 563 | }; |
| 564 | |
| 565 | /* GRF_SOC_CON0 */ |
| 566 | #define GRF_DDR_16BIT_EN (((0x1 << 0) << 16) | (0x1 << 0)) |
| 567 | #define GRF_DDR_32BIT_EN (((0x1 << 0) << 16) | (0x0 << 0)) |
| 568 | #define GRF_MSCH_NOC_16BIT_EN (((0x1 << 7) << 16) | (0x1 << 7)) |
| 569 | #define GRF_MSCH_NOC_32BIT_EN (((0x1 << 7) << 16) | (0x0 << 7)) |
| 570 | |
| 571 | #define GRF_DDRPHY_BUFFEREN_CORE_EN (((0x1 << 8) << 16) | (0x0 << 8)) |
| 572 | #define GRF_DDRPHY_BUFFEREN_CORE_DIS (((0x1 << 8) << 16) | (0x1 << 8)) |
| 573 | |
| 574 | #define GRF_DDR3_EN (((0x1 << 6) << 16) | (0x1 << 6)) |
| 575 | #define GRF_LPDDR2_3_EN (((0x1 << 6) << 16) | (0x0 << 6)) |
| 576 | |
| 577 | #define PHY_DRV_ODT_SET(n) (((n) << 4) | (n)) |
| 578 | #define DDR3_DLL_RESET (1 << 8) |
| 579 | |
| 580 | #endif /* _ASM_ARCH_SDRAM_RK322X_H */ |