coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
dramc_pi_basic_api.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <device/mmio.h>
4 #include <delay.h>
5 #include <soc/emi.h>
6 #include <soc/spm.h>
7 #include <soc/dramc_register.h>
8 #include <soc/dramc_pi_api.h>
9 
11 {
12  if (freq == LP4X_DDR1600 || freq == LP4X_DDR2400)
13  return FSP_0;
14  else
15  return FSP_1;
16 }
17 
18 static void dramc_sw_imp_cal_vref_sel(u8 term_option, u8 impcal_stage)
19 {
20  u8 vref_sel = 0;
21 
22  if (term_option == ODT_ON)
23  vref_sel = IMP_LP4X_TERM_VREF_SEL;
24  else {
25  switch (impcal_stage) {
26  case IMPCAL_STAGE_DRVP:
28  break;
29  case IMPCAL_STAGE_DRVN:
31  break;
32  default:
34  break;
35  }
36  }
37 
38  clrsetbits32(&ch[0].phy.shu[0].ca_cmd[11], 0x3f << 8, vref_sel << 8);
39 }
40 
41 void dramc_sw_impedance_cal(const struct sdram_params *params, u8 term,
42  struct dram_impedance *impedance)
43 {
44  u32 broadcast_bak, impcal_bak, imp_cal_result;
45  u32 DRVP_result = 0xff, ODTN_result = 0xff, DRVN_result = 0x9;
46 
47  broadcast_bak = dramc_get_broadcast();
49 
50  for (u8 chn = 0; chn < CHANNEL_MAX; chn++) {
51  clrbits32(&ch[chn].phy.misc_spm_ctrl1, 0xf << 0);
52  write32(&ch[chn].phy.misc_spm_ctrl2, 0x0);
53  write32(&ch[chn].phy.misc_spm_ctrl0, 0x0);
54  clrbits32(&ch[chn].ao.impcal, 0x1 << 31);
55  }
56 
57  impcal_bak = read32(&ch[0].ao.impcal);
59  clrbits32(&ch[0].phy.misc_imp_ctrl1, 0x1 << 6);
60  clrsetbits32(&ch[0].ao.impcal, 0x1 << 21, 0x3 << 24);
61  clrsetbits32(&ch[0].phy.misc_imp_ctrl0, 0x7 << 4, 0x3 << 4);
62  udelay(1);
63 
64  dramc_dbg("impedance: K DRVP\n");
65  setbits32(&ch[0].ao.impcal, 0x1 << 23);
66  setbits32(&ch[0].ao.impcal, 0x1 << 22);
67  clrbits32(&ch[0].ao.impcal, 0x1 << 21);
68  clrbits32(&ch[0].ao.shu[0].impcal1, 0x1f << 4 | 0x1f << 11);
69  clrsetbits32(&ch[0].phy.shu[0].ca_cmd[11], 0xff << 0, 0x3);
70 
71  for (u8 impx_drv = 0; impx_drv < 32; impx_drv++) {
72  impx_drv = (impx_drv == 16) ? 29 : impx_drv;
73 
74  clrsetbits32(&ch[0].ao.shu[0].impcal1,
75  0x1f << 4, impx_drv << 4);
76  udelay(1);
77  imp_cal_result = (read32(&ch[0].phy_nao.misc_phy_rgs_cmd) >>
78  24) & 0x1;
79  dramc_dbg("1. OCD DRVP=%d CALOUT=%d\n",
80  impx_drv, imp_cal_result);
81 
82  if (imp_cal_result == 1 && DRVP_result == 0xff) {
83  DRVP_result = impx_drv;
84  dramc_dbg("1. OCD DRVP calibration OK! DRVP=%d\n",
85  DRVP_result);
86  break;
87  }
88  }
89 
90  dramc_dbg("impedance: K ODTN\n");
92  clrbits32(&ch[0].ao.impcal, 0x1 << 22);
93  if (term == ODT_ON)
94  setbits32(&ch[0].ao.impcal, 0x1 << 21);
95  clrsetbits32(&ch[0].ao.shu[0].impcal1, 0x1f << 4 | 0x1f << 11,
96  DRVP_result << 4);
97  clrsetbits32(&ch[0].phy.shu[0].ca_cmd[11], 0xff << 0, 0x3);
98 
99  for (u8 impx_drv = 0; impx_drv < 32; impx_drv++) {
100  impx_drv = (impx_drv == 16) ? 29 : impx_drv;
101 
102  clrsetbits32(&ch[0].ao.shu[0].impcal1,
103  0x1f << 11, impx_drv << 11);
104  udelay(1);
105  imp_cal_result = (read32(&ch[0].phy_nao.misc_phy_rgs_cmd) >>
106  24) & 0x1;
107  dramc_dbg("3. OCD ODTN=%d CALOUT=%d\n",
108  impx_drv, imp_cal_result);
109 
110  if (imp_cal_result == 0 && ODTN_result == 0xff) {
111  ODTN_result = impx_drv;
112  dramc_dbg("3. OCD ODTN calibration OK! ODTN=%d\n",
113  ODTN_result);
114  break;
115  }
116  }
117 
118  write32(&ch[0].ao.impcal, impcal_bak);
119 
120  dramc_dbg("impedance: term=%d, DRVP=%d, DRVN=%d, ODTN=%d\n",
121  term, DRVP_result, DRVN_result, ODTN_result);
122  u32 *imp = impedance->data[term];
123  if (term == ODT_OFF) {
124  imp[0] = DRVP_result;
125  imp[1] = ODTN_result;
126  imp[2] = 0;
127  imp[3] = 15;
128  } else {
129  imp[0] = (DRVP_result <= 3) ? (DRVP_result * 3) : DRVP_result;
130  imp[1] = (DRVN_result <= 3) ? (DRVN_result * 3) : DRVN_result;
131  imp[2] = 0;
132  imp[3] = (ODTN_result <= 3) ? (ODTN_result * 3) : ODTN_result;
133  }
135 
136  dramc_set_broadcast(broadcast_bak);
137 }
138 
140  const struct dram_impedance *impedance)
141 {
142  u8 ca_term = ODT_OFF, dq_term = ODT_ON;
143  u32 sw_impedance[2][4] = {0};
144 
145  if (get_freq_fsq(freq_group) == FSP_0)
146  dq_term = ODT_OFF;
147 
148  for (u8 term = 0; term < 2; term++)
149  for (u8 i = 0; i < 4; i++)
150  sw_impedance[term][i] = impedance->data[term][i];
151 
152  sw_impedance[ODT_OFF][2] = sw_impedance[ODT_ON][2];
153  sw_impedance[ODT_OFF][3] = sw_impedance[ODT_ON][3];
154 
155  /* DQ */
156  clrsetbits32(&ch[0].ao.shu[0].drving[0], (0x1f << 5) | (0x1f << 0),
157  (sw_impedance[dq_term][0] << 5) |
158  (sw_impedance[dq_term][1] << 0));
159  clrsetbits32(&ch[0].ao.shu[0].drving[1],
160  (0x1f << 25) | (0x1f << 20) | (1 << 31),
161  (sw_impedance[dq_term][0] << 25) |
162  (sw_impedance[dq_term][1] << 20) | (!dq_term << 31));
163  clrsetbits32(&ch[0].ao.shu[0].drving[2], (0x1f << 5) | (0x1f << 0),
164  (sw_impedance[dq_term][2] << 5) |
165  (sw_impedance[dq_term][3] << 0));
166  clrsetbits32(&ch[0].ao.shu[0].drving[3], (0x1f << 25) | (0x1f << 20),
167  (sw_impedance[dq_term][2] << 25) |
168  (sw_impedance[dq_term][3] << 20));
169 
170  /* DQS */
171  for (u8 i = 0; i <= 2; i += 2) {
172  clrsetbits32(&ch[0].ao.shu[0].drving[i],
173  (0x1f << 25) | (0x1f << 20),
174  (sw_impedance[dq_term][i] << 25) |
175  (sw_impedance[dq_term][i + 1] << 20));
176  clrsetbits32(&ch[0].ao.shu[0].drving[i],
177  (0x1f << 15) | (0x1f << 10),
178  (sw_impedance[dq_term][i] << 15) |
179  (sw_impedance[dq_term][i + 1] << 10));
180  }
181 
182  /* CMD & CLK */
183  for (u8 i = 1; i <= 3; i += 2) {
184  clrsetbits32(&ch[0].ao.shu[0].drving[i],
185  (0x1f << 15) | (0x1f << 10),
186  (sw_impedance[ca_term][i - 1] << 15) |
187  (sw_impedance[ca_term][i] << 10));
188  clrsetbits32(&ch[0].ao.shu[0].drving[i],
189  (0x1f << 5) | (0x1f << 0),
190  (sw_impedance[ca_term][i - 1] << 5) |
191  (sw_impedance[ca_term][i] << 0));
192  }
193 
194  clrsetbits32(&ch[0].phy.shu[0].ca_cmd[11], 0x1f << 17,
195  sw_impedance[ca_term][0] << 17);
196  clrsetbits32(&ch[0].phy.shu[0].ca_cmd[11], 0x1f << 22,
197  sw_impedance[ca_term][1] << 22);
198 
199  SET32_BITFIELDS(&ch[0].phy.shu[0].ca_cmd[3],
200  SHU1_CA_CMD3_RG_TX_ARCMD_PU_PRE, 1);
201  SET32_BITFIELDS(&ch[0].phy.shu[0].ca_cmd[0],
202  SHU1_CA_CMD0_RG_TX_ARCLK_DRVN_PRE, 0);
203 
205  clrsetbits32(&ch[0].phy.shu[0].ca_dll[1], 0x1f << 16, 0x9 << 16);
206  clrsetbits32(&ch[1].phy.shu[0].ca_dll[1], 0x1f << 16, 0x9 << 16);
208 }
209 
211 {
212  u8 shu_lev = (read32(&ch[0].ao.shustatus) >> 1) & 0x3;
213 
215  (0xffff << 16) | (0x1 << 0),
216  (0xb16 << 16) | (0x1 << 0));
217 
218  /* Set SPM pinmux */
219  clrbits32(&mtk_spm->pcm_pwr_io_en, (0xff << 0) | (0xff << 16));
222 
223  setbits32(&mtk_spm->spm_power_on_val0, (0x1 << 8) | (0xf << 12));
224  setbits32(&mtk_spm->spm_s1_mode_ch, 0x3 << 0);
225 
226  shu_lev = (shu_lev == 1) ? 2 : 1;
227  clrsetbits32(&mtk_spm->spm_power_on_val0, 0x3 << 28, shu_lev << 28);
229  0x3 << 2, shu_lev << 2);
230 
231  udelay(1);
232  for (size_t chn = CHANNEL_A; chn < CHANNEL_MAX; chn++) {
233  clrbits32(&ch[chn].phy.pll1, 0x1 << 31);
234  clrbits32(&ch[chn].phy.pll2, 0x1 << 31);
235  }
236 }
237 
239 {
240  /* Enable RX_FIFO macro DIV4 clock CG */
241  write32(&ch[chn].phy.misc_cg_ctrl1, 0xffffffff);
242 
243  /* DVS mode to RG mode */
244  for (size_t r = 0; r < 2; r++)
245  for (size_t b = 0; b < 2; b++)
246  clrbits32(&ch[chn].phy.r[r].b[b].rxdvs[2], 3 << 30);
247 
248  clrsetbits32(&ch[chn].phy.b0_rxdvs[0], 0x1 << 19, 0x1 << 9);
249  clrsetbits32(&ch[chn].phy.b1_rxdvs[0], 0x1 << 19, 0x1 << 9);
250 
251  for (size_t r = 0; r < 2; r++)
252  for (size_t b = 0; b < 2; b++) {
253  clrbits32(&ch[chn].phy.r[r].b[b].rxdvs[2], 1 << 29);
254  clrsetbits32(&ch[chn].phy.r[r].b[b].rxdvs[7],
255  (0x3f << 0) | (0x3f << 8) |
256  (0x7f << 16) | (0x7f << 24),
257  (0x0 << 0) | (0x3f << 8) |
258  (0x0 << 16) | (0x7f << 24));
259  clrsetbits32(&ch[chn].phy.r[r].b[b].rxdvs[1],
260  (0xffff << 16) | (0xffff << 0),
261  (0x2 << 16) | (0x2 << 0));
262 
263  /* DQ/DQS Rx DLY adjustment for tracking mode */
264  clrbits32(&ch[chn].phy.r[r].b[b].rxdvs[2],
265  (0x3 << 26) | (0x3 << 24) |
266  (0x3 << 18) | (0x3 << 16));
267  }
268 
269  /* Rx DLY tracking setting (Static) */
270  clrsetbits32(&ch[chn].phy.b0_rxdvs[0],
271  (0x1 << 29) | (0xf << 4) | (0x1 << 0),
272  (0x1 << 29) | (0x0 << 4) | (0x1 << 0));
273  clrsetbits32(&ch[chn].phy.b1_rxdvs[0],
274  (0x1 << 29) | (0xf << 4) | (0x1 << 0),
275  (0x1 << 29) | (0x0 << 4) | (0x1 << 0));
276 
277  for (u8 b = 0; b < 2; b++)
278  clrsetbits32(&ch[chn].phy.b[b].dq[9],
279  (0x7 << 28) | (0x7 << 24),
280  (0x1 << 28) | (0x0 << 24));
281  clrbits32(&ch[chn].phy.ca_cmd[10], (0x7 << 28) | (0x7 << 24));
282  for (u8 b = 0; b < 2; b++)
283  setbits32(&ch[chn].phy.b[b].dq[5], 0x1 << 31);
284 
285  setbits32(&ch[chn].phy.b0_rxdvs[0], (0x1 << 28) | (0x1 << 31));
286  setbits32(&ch[chn].phy.b1_rxdvs[0], (0x1 << 28) | (0x1 << 31));
287  for (u8 rank = RANK_0; rank < RANK_MAX; rank++)
288  for (u8 b = 0; b < 2; b++)
289  clrsetbits32(&ch[chn].phy.r[rank].b[b].rxdvs[2],
290  (0x3 << 30) | (0x1 << 28) | (0x1 << 23),
291  (0x2 << 30) | (0x1 << 28) | (0x1 << 23));
292 
293 }
294 
296 {
297  clrsetbits32(&ch[chn].ao.stbcal,
298  (0x1 << 21) | (0x3 << 15) | (0x1f << 8) | (0x1 << 4),
299  (0x3 << 26) | (0x1 << 0));
300  clrsetbits32(&ch[chn].ao.stbcal1,
301  (0xffff << 16) | (0x1 << 8) | (0x1 << 6),
302  (0x1 << 16) | (0x1 << 8) | (0x1 << 6));
303 
304  clrsetbits32(&ch[chn].phy.misc_ctrl0,
305  (0x1 << 24) | (0x1f << 11) | (0xf << 0),
306  (0x1 << 24) | (0x0 << 11) | (0x0 << 0));
307 
308  clrbits32(&ch[chn].phy.b[0].dq[6], 0x1 << 31);
309  clrbits32(&ch[chn].phy.b[1].dq[6], 0x1 << 31);
310  clrbits32(&ch[chn].phy.ca_cmd[6], 0x1 << 31);
311 }
312 
313 static void dramc_hw_gating_init(u8 chn)
314 {
315  clrbits32(&ch[chn].ao.stbcal,
316  (0x7 << 22) | (0x3 << 14) | (0x1 << 19) | (0x1 << 21));
317  setbits32(&ch[chn].ao.stbcal, (0x1 << 20) | (0x3 << 28));
318  setbits32(&ch[chn].phy.misc_ctrl1, 0x1 << 24);
319 
321 }
322 
324 {
325  setbits32(&ch[0].phy.misc_ctrl0, 0x1 << 10);
326  for (size_t chn = 0; chn < CHANNEL_MAX; chn++) {
327  setbits32(&ch[chn].ao.impcal, (0x1 << 31) | (0x1 << 29) |
328  (0x1 << 26) | (0x1 << 17) | (0x7 << 11));
329  clrbits32(&ch[chn].ao.impcal, 0x1 << 30);
330  setbits32(&ch[chn].phy.misc_ctrl0, 0x1 << 18);
331  setbits32(&ch[chn].ao.impcal, 0x1 << 19);
332  }
333  setbits32(&ch[0].ao.impcal, 0x1 << 14);
334  for (size_t chn = 0; chn < CHANNEL_MAX; chn++)
335  setbits32(&ch[chn].ao.refctrl0, (0x1 << 2) | (0x1 << 3));
336 }
337 
339 {
340  for (u8 b = 0; b < 2; b++) {
341  clrbits32(&ch[chn].phy.b[b].dll_fine_tune[2], 0x3fffff << 10);
342  write32(&ch[chn].phy.b[b].dll_fine_tune[3], 0x2e800);
343  }
344  clrsetbits32(&ch[chn].phy.ca_dll_fine_tune[2],
345  0x3fffff << 10, 0x2 << 10);
346  write32(&ch[chn].phy.ca_dll_fine_tune[3],
347  (chn == CHANNEL_A) ? 0xba000 : 0x3a000);
348 }
349 
351 {
352  setbits32(&ch[chn].ao.dummy_rd, rk_num << 16);
353 
354  for (size_t r = 0; r < 2; r++)
355  for (size_t i = 0; i < 4; i++)
356  write32(&ch[chn].ao.rk[r].dummy_rd_wdata[i],
357  0xaaaa5555);
358 
359  clrsetbits32(&ch[chn].ao.test2_4, 0x7 << 28, 0x4 << 28);
360  for (size_t r = 0; r < 2; r++) {
361  clrsetbits32(&ch[chn].ao.rk[r].dummy_rd_adr,
362  (0x1ffff << 0) | (0x7ff << 17) | (0xf << 28),
363  (0xffff << 0) | (0x3f0 << 17));
364  clrbits32(&ch[chn].ao.rk[r].dummy_rd_bk, 0x7 << 0);
365  }
366 
367  clrbits32(&ch[chn].ao.dummy_rd, 0x1 << 25 | 0x1 << 20);
368 }
369 
371 {
372  clrsetbits32(&ch[chn].ao.rkcfg, (0x1 << 15) | (0x1 << 12), 0x1 << 2);
373  clrsetbits32(&ch[chn].ao.ckectrl,
374  (0x1 << 1) | (0xf << 8) | (0x7 << 13),
375  (0x4 << 8) | (0x2 << 13));
376 
377  for (u8 shu = 0; shu < DRAM_DFS_SHUFFLE_MAX; shu++)
378  setbits32(&ch[chn].ao.shu[shu].conf[2],
379  (0x1 << 29) | (0x1 << 31));
380  clrbits32(&ch[chn].ao.dramctrl, 0x1 << 9);
381 }
382 
383 static void dramc_pa_improve(u8 chn)
384 {
385  clrbits32(&ch[chn].ao.clkar, 0xffff);
386  clrbits32(&ch[chn].ao.srefctrl, 0xf << 12);
387  clrbits32(&ch[chn].ao.zqcs, 0x1 << 19);
388  clrbits32(&ch[chn].ao.pre_tdqsck[0], 0x1 << 17);
389  clrbits32(&ch[chn].ao.zqcs, 0x1 << 19);
390  clrbits32(&ch[chn].ao.pre_tdqsck[0], 0x1 << 17);
391 
392  for (u8 shu = 0; shu < DRAM_DFS_SHUFFLE_MAX; shu++)
393  clrbits32(&ch[chn].ao.shu[shu].odtctrl, 0x3 << 2);
394 }
395 
396 static void dramc_enable_dramc_dcm(void)
397 {
398  for (size_t chn = 0; chn < CHANNEL_MAX; chn++) {
399  clrsetbits32(&ch[chn].ao.dramc_pd_ctrl,
400  (0x7 << 0) | (0x1 << 26) | (0x1 << 30) | (0x1 << 31),
401  (0x7 << 0) | (0x1 << 30) | (0x1 << 31));
402  setbits32(&ch[chn].ao.clkar, 0x1 << 31);
403  }
404 }
405 
407 {
408  for (u8 chn = 0; chn < CHANNEL_MAX; chn++)
409  clrbits32(&ch[chn].ao.refctrl0, 0x1 << 29);
410 
412  setbits32(&mtk_spm->spm_power_on_val0, 0x1 << 25);
413 
414  for (u8 chn = 0; chn < CHANNEL_MAX; chn++) {
415  dramc_hw_dqsosc(chn, rk_num);
416 
417  /* RX_TRACKING: ON */
419 
420  /* HW_GATING: ON */
422  dramc_hw_gating_onoff(chn, true);
423 
424  /* HW_GATING DBG: OFF */
425  clrbits32(&ch[chn].ao.stbcal2,
426  (0x3 << 4) | (0x3 << 8) | (0x1 << 28));
427 
428  /* DUMMY_READ_FOR_TRACKING: ON */
430 
431  /* ZQCS_ENABLE_LP4: ON */
432  clrbits32(&ch[chn].ao.spcmdctrl, 0x1 << 30);
433 
434  /* LOWPOWER_GOLDEN_SETTINGS(DCM): ON */
436  dramc_enable_phy_dcm(chn, true);
437 
438  /* DUMMY_READ_FOR_DQS_GATING_RETRY: OFF */
439  for (size_t shu = 0; shu < DRAM_DFS_SHUFFLE_MAX; shu++)
440  clrbits32(&ch[chn].ao.shu[shu].dqsg_retry,
441  (0x1 << 1) | (0x3 << 13));
442  }
443 
444  /* SPM_CONTROL_AFTERK: ON */
445  write32(&ch[0].phy.misc_spm_ctrl0, 0xfbffefff);
446  write32(&ch[1].phy.misc_spm_ctrl0, 0xfbffefff);
447  write32(&ch[0].phy.misc_spm_ctrl2, 0xffffffef);
448  write32(&ch[1].phy.misc_spm_ctrl2, 0x7fffffef);
449 
450  /* IMPEDANCE_TRACKING: ON */
452 
453  for (size_t chn = 0; chn < CHANNEL_MAX; chn++) {
454  /* TEMP_SENSOR: ON */
455  clrbits32(&ch[chn].ao.spcmdctrl, 0x3 << 28);
456  setbits32(&ch[chn].ao.hw_mrr_fun, (0x1 << 0) | (0x1 << 11));
457 
458  /* PER_BANK_REFRESH: ON */
459  clrbits32(&ch[chn].ao.refctrl0, 0x1 << 18);
460 
461  /* HW_SAVE_FOR_SR: ON */
462  clrbits32(&ch[chn].ao.rstmask, (0x1 << 25) | (0x1 << 28));
463  setbits32(&ch[chn].ao.refctrl1, 0x1 << 0);
464  clrsetbits32(&ch[chn].ao.srefctrl, 0x1 << 20, 0x1 << 22);
465 
466  /* SET_CKE_2_RANK_INDEPENDENT_RUN_TIME: ON */
468 
469  /* CLK_FREE_FUN_FOR_DRAMC_PSEL: ON */
470  clrbits32(&ch[chn].ao.refctrl1, (0x1 << 6) | (0x3 << 2));
471  clrbits32(&ch[chn].ao.clkar, 0x1 << 19);
472 
473  /* PA_IMPROVEMENT_FOR_DRAMC_ACTIVE_POWER: ON */
474  dramc_pa_improve(chn);
475 
476  /* DRAM DRS DISABLE */
477  clrsetbits32(&ch[chn].ao.drsctrl,
478  (0x1 << 0) | (0x1 << 2) | (0x1 << 4) | (0x1 << 5) | (0x1 << 6) |
479  (0xf << 8) | (0x7f << 12) | (0x1 << 19) | (0x1 << 21),
480  (0x1 << 0) | (0x0 << 2) | (0x0 << 4) | (0x1 << 5) | (0x0 << 6) |
481  (0x8 << 8) | (0x3 << 12) | (0x1 << 19) | (0x0 << 21));
482  setbits32(&ch[chn].ao.dummy_rd, 0x3 << 26);
483  }
485 
486  enable_emi_dcm();
488 }
static void write32(void *addr, uint32_t val)
Definition: mmio.h:40
static uint32_t read32(const void *addr)
Definition: mmio.h:22
static struct sdram_info params
Definition: sdram_configs.c:83
#define dramc_dbg(_x_...)
Definition: dramc_common.h:11
@ RANK_0
@ RANK_MAX
@ ODT_ON
@ ODT_OFF
@ DRAM_DFS_SHUFFLE_MAX
@ CHANNEL_MAX
#define setbits32(addr, set)
Definition: mmio.h:21
#define SET32_BITFIELDS(addr,...)
Definition: mmio.h:201
#define clrsetbits32(addr, clear, set)
Definition: mmio.h:16
#define clrbits32(addr, clear)
Definition: mmio.h:26
void dramc_runtime_config(u32 channel, const struct mt8173_sdram_params *sdram_params)
static struct dramc_channel const ch[2]
@ CHANNEL_A
Definition: dramc_soc.h:7
static struct mtk_spm_regs *const mtk_spm
Definition: spm.h:154
static void dramc_pa_improve(u8 chn)
static void dramc_hw_dqs_gating_tracking(u8 chn)
static void dramc_sw_imp_cal_vref_sel(u8 term_option, u8 impcal_stage)
static void dramc_set_CKE_2_rank_independent(u8 chn)
static void dramc_phy_low_power_enable(u8 chn)
static void dramc_rx_input_delay_tracking(u8 chn)
void dramc_sw_impedance_cal(const struct sdram_params *params, u8 term, struct dram_impedance *impedance)
static void transfer_pll_to_spm_control(void)
static void dramc_impedance_tracking_enable(void)
static void dramc_hw_gating_init(u8 chn)
static void dramc_dummy_read_for_tracking_enable(u8 chn, u32 rk_num)
static void dramc_enable_dramc_dcm(void)
void dramc_sw_impedance_save_reg(u8 freq_group, const struct dram_impedance *impedance)
u8 get_freq_fsq(u8 freq)
void dramc_hw_dqsosc(u8 chn, u32 rk_num)
void dramc_dqs_precalculation_preset(void)
void dramc_hw_gating_onoff(u8 chn, bool on)
void dramc_enable_phy_dcm(u8 chn, bool en)
void enable_emi_dcm(void)
Definition: emi.c:469
u32 dramc_get_broadcast(void)
Definition: emi.c:64
void dramc_set_broadcast(u32 onoff)
Definition: emi.c:59
#define IMP_DRVN_LP4X_UNTERM_VREF_SEL
Definition: dramc_pi_api.h:19
#define IMP_DRVP_LP4X_UNTERM_VREF_SEL
Definition: dramc_pi_api.h:18
#define IMP_LP4X_TERM_VREF_SEL
Definition: dramc_pi_api.h:17
#define DRAMC_BROADCAST_OFF
Definition: dramc_pi_api.h:14
@ IMPCAL_STAGE_TRACKING
Definition: dramc_pi_api.h:52
@ IMPCAL_STAGE_DRVP
Definition: dramc_pi_api.h:50
@ IMPCAL_STAGE_DRVN
Definition: dramc_pi_api.h:51
#define DRAMC_BROADCAST_ON
Definition: dramc_pi_api.h:13
#define IMP_TRACK_LP4X_UNTERM_VREF_SEL
Definition: dramc_pi_api.h:20
@ LP4X_DDR2400
Definition: emi.h:68
@ LP4X_DDR1600
Definition: emi.h:67
uint32_t u32
Definition: stdint.h:51
uint8_t u8
Definition: stdint.h:45
u32 data[ODT_MAX][4]
Definition: emi.h:75
Definition: dw_i2c.c:39
u32 pcm_pwr_io_en
Definition: spm.h:82
u32 dramc_dpy_clk_sw_con_sel
Definition: spm.h:326
u32 spm_power_on_val0
Definition: spm.h:133
u32 spm_s1_mode_ch
Definition: spm.h:328
u32 dramc_dpy_clk_sw_con2
Definition: spm.h:331
u32 poweron_config_set
Definition: spm.h:24
u32 dramc_dpy_clk_sw_con_sel2
Definition: spm.h:330
Defines the SDRAM parameter structure.
Definition: emi.h:15
void udelay(uint32_t us)
Definition: udelay.c:15