coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
sor.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 /*
4  * drivers/video/tegra/dc/sor.c
5  */
6 
7 #include <console/console.h>
8 #include <stdint.h>
9 #include <delay.h>
10 #include <soc/addressmap.h>
11 #include <device/device.h>
12 #include <boot/tables.h>
13 #include <soc/nvidia/tegra/dc.h>
14 #include <soc/nvidia/tegra/types.h>
15 #include <soc/sor.h>
17 #include <soc/clk_rst.h>
18 #include <soc/clock.h>
19 #include "chip.h"
20 #include <soc/display.h>
21 
22 #define DEBUG_SOR 0
23 
24 #define APBDEV_PMC_DPD_SAMPLE (0x20)
25 #define APBDEV_PMC_DPD_SAMPLE_ON_DISABLE (0)
26 #define APBDEV_PMC_DPD_SAMPLE_ON_ENABLE (1)
27 #define APBDEV_PMC_SEL_DPD_TIM (0x1c8)
28 #define APBDEV_PMC_SEL_DPD_TIM_SEL_DPD_TIM_DEFAULT (0x7f)
29 #define APBDEV_PMC_IO_DPD2_REQ (0x1c0)
30 #define APBDEV_PMC_IO_DPD2_REQ_LVDS_SHIFT (25)
31 #define APBDEV_PMC_IO_DPD2_REQ_LVDS_OFF (0 << 25)
32 #define APBDEV_PMC_IO_DPD2_REQ_LVDS_ON (1 << 25)
33 #define APBDEV_PMC_IO_DPD2_REQ_CODE_SHIFT (30)
34 #define APBDEV_PMC_IO_DPD2_REQ_CODE_DEFAULT_MASK (0x3 << 30)
35 #define APBDEV_PMC_IO_DPD2_REQ_CODE_IDLE (0 << 30)
36 #define APBDEV_PMC_IO_DPD2_REQ_CODE_DPD_OFF (1 << 30)
37 #define APBDEV_PMC_IO_DPD2_REQ_CODE_DPD_ON (2 << 30)
38 #define APBDEV_PMC_IO_DPD2_STATUS (0x1c4)
39 #define APBDEV_PMC_IO_DPD2_STATUS_LVDS_SHIFT (25)
40 #define APBDEV_PMC_IO_DPD2_STATUS_LVDS_OFF (0 << 25)
41 #define APBDEV_PMC_IO_DPD2_STATUS_LVDS_ON (1 << 25)
42 
43 #define DC_N_WINDOWS 5
44 
45 static inline u32 tegra_sor_readl(struct tegra_dc_sor_data *sor, u32 reg)
46 {
47  void *addr = sor->base + (u32) (reg << 2);
48  u32 reg_val = READL(addr);
49  return reg_val;
50 }
51 
52 static inline void tegra_sor_writel(struct tegra_dc_sor_data *sor,
53  u32 reg, u32 val)
54 {
55  void *addr = sor->base + (u32) (reg << 2);
56  WRITEL(val, addr);
57 }
58 
59 static inline void tegra_sor_write_field(struct tegra_dc_sor_data *sor,
60  u32 reg, u32 mask, u32 val)
61 {
62  u32 reg_val = tegra_sor_readl(sor, reg);
63  reg_val &= ~mask;
64  reg_val |= val;
65  tegra_sor_writel(sor, reg, reg_val);
66 }
67 
69 {
74 }
75 
77  u32 pe_reg, u32 vs_reg, u32 pc_reg, u8 pc_supported)
78 {
80  mask, pe_reg);
82  mask, vs_reg);
83  if (pc_supported) {
85  sor, NV_SOR_POSTCURSOR(sor->portnum),
86  mask, pc_reg);
87  }
88 }
89 
91  u32 reg, u32 mask, u32 exp_val, u32 poll_interval_us, u32 timeout_us)
92 {
93  u32 temp = timeout_us;
94  u32 reg_val = 0;
95 
96  do {
97  udelay(poll_interval_us);
98  reg_val = tegra_sor_readl(sor, reg);
99  if (timeout_us > poll_interval_us)
100  timeout_us -= poll_interval_us;
101  else
102  break;
103  } while ((reg_val & mask) != exp_val);
104 
105  if ((reg_val & mask) == exp_val)
106  return 0; /* success */
108  "sor_poll_register 0x%x: timeout, "
109  "(reg_val)0x%08x & (mask)0x%08x != (exp_val)0x%08x\n",
110  reg, reg_val, mask, exp_val);
111 
112  return temp;
113 }
114 
116 {
117  u32 reg_val;
118  u32 orig_val;
119 
120  orig_val = tegra_sor_readl(sor, NV_SOR_PWR);
121 
122  reg_val = pu_pd ? NV_SOR_PWR_NORMAL_STATE_PU :
123  NV_SOR_PWR_NORMAL_STATE_PD; /* normal state only */
124 
125  if (reg_val == orig_val)
126  return 0; /* No update needed */
127 
129  tegra_sor_writel(sor, NV_SOR_PWR, reg_val);
130 
131  /* Poll to confirm it is done */
135  100, TEGRA_SOR_TIMEOUT_MS * 1000)) {
137  "dc timeout waiting for SOR_PWR = NEW_DONE\n");
138  return -EFAULT;
139  }
140  return 0;
141 }
142 
144  u8 training_pattern, const struct tegra_dc_dp_link_config *link_cfg)
145 {
146  u32 reg_val;
147 
148  reg_val = tegra_sor_readl(sor, NV_SOR_DP_LINKCTL(sor->portnum));
149 
150  if (ena)
151  reg_val |= NV_SOR_DP_LINKCTL_ENABLE_YES;
152  else
153  reg_val &= NV_SOR_DP_LINKCTL_ENABLE_NO;
154 
155  reg_val &= ~NV_SOR_DP_LINKCTL_TUSIZE_MASK;
156  reg_val |= (link_cfg->tu_size << NV_SOR_DP_LINKCTL_TUSIZE_SHIFT);
157 
158  if (link_cfg->enhanced_framing)
160 
161  tegra_sor_writel(sor, NV_SOR_DP_LINKCTL(sor->portnum), reg_val);
162 
163  switch (training_pattern) {
164  case training_pattern_1:
165  tegra_sor_writel(sor, NV_SOR_DP_TPG, 0x41414141);
166  break;
167  case training_pattern_2:
168  case training_pattern_3:
169  reg_val = (link_cfg->link_bw == SOR_LINK_SPEED_G5_4) ?
170  0x43434343 : 0x42424242;
171  tegra_sor_writel(sor, NV_SOR_DP_TPG, reg_val);
172  break;
173  default:
174  tegra_sor_writel(sor, NV_SOR_DP_TPG, 0x50505050);
175  break;
176  }
177 }
178 
180  int pu, int is_lvds)
181 {
182  u32 reg_val;
183 
184  /* SOR lane sequencer */
185  if (pu)
189  else
193 
194  if (is_lvds)
195  reg_val |= 15 << NV_SOR_LANE_SEQ_CTL_DELAY_SHIFT;
196  else
197  reg_val |= 1 << NV_SOR_LANE_SEQ_CTL_DELAY_SHIFT;
198 
199  tegra_sor_writel(sor, NV_SOR_LANE_SEQ_CTL, reg_val);
200 
204  100, TEGRA_SOR_TIMEOUT_MS*1000)) {
206  "dp: timeout while waiting for SOR lane sequencer "
207  "to power down langes\n");
208  return -1;
209  }
210  return 0;
211 }
212 
214  u32 lane_count, int pu)
215 {
216  u32 reg_val;
217 
218  reg_val = tegra_sor_readl(sor, NV_SOR_DP_PADCTL(sor->portnum));
219 
220  if (pu) {
221  switch (lane_count) {
222  case 4:
223  reg_val |= (NV_SOR_DP_PADCTL_PD_TXD_3_NO |
225  fallthrough;
226  case 2:
227  reg_val |= NV_SOR_DP_PADCTL_PD_TXD_1_NO;
228  fallthrough;
229  case 1:
230  reg_val |= NV_SOR_DP_PADCTL_PD_TXD_0_NO;
231  break;
232  default:
234  "dp: invalid lane number %d\n", lane_count);
235  return -1;
236  }
237 
238  tegra_sor_writel(sor, NV_SOR_DP_PADCTL(sor->portnum), reg_val);
239  tegra_dc_sor_set_lane_count(sor, lane_count);
240  }
241  return tegra_dc_sor_enable_lane_sequencer(sor, pu, 0);
242 }
243 
245  int power_up)
246 {
247  u32 reg_val;
248 
249  reg_val = tegra_sor_readl(sor, NV_SOR_DP_PADCTL(sor->portnum));
250 
251  if (power_up)
253  else
255 
256  tegra_sor_writel(sor, NV_SOR_DP_PADCTL(sor->portnum), reg_val);
257 }
258 
259 static void tegra_dc_sor_config_pwm(struct tegra_dc_sor_data *sor, u32 pwm_div,
260  u32 pwm_dutycycle)
261 {
262  tegra_sor_writel(sor, NV_SOR_PWM_DIV, pwm_div);
264  (pwm_dutycycle & NV_SOR_PWM_CTL_DUTY_CYCLE_MASK) |
266 
270  100, TEGRA_SOR_TIMEOUT_MS * 1000)) {
272  "dp: timeout while waiting for SOR PWM setting\n");
273  }
274 }
275 
277  const struct tegra_dc_dp_link_config *link_cfg)
278 {
279  u32 reg_val;
280 
282 
284  reg_val = tegra_sor_readl(sor, NV_SOR_DP_CONFIG(sor->portnum));
286  reg_val |= link_cfg->watermark;
288  reg_val |= (link_cfg->active_count <<
291  reg_val |= (link_cfg->active_frac <<
293  if (link_cfg->activepolarity)
295  else
299 
300  tegra_sor_writel(sor, NV_SOR_DP_CONFIG(sor->portnum), reg_val);
301 
302  /* program h/vblank sym */
305 
308 }
309 
310 static inline void tegra_dc_sor_super_update(struct tegra_dc_sor_data *sor)
311 {
315 }
316 
317 static inline void tegra_dc_sor_update(struct tegra_dc_sor_data *sor)
318 {
322 }
323 
324 static void tegra_dc_sor_io_set_dpd(struct tegra_dc_sor_data *sor, int up)
325 {
326  u32 reg_val;
327  void *pmc_base = sor->pmc_base;
328 
329  if (up) {
331  pmc_base + APBDEV_PMC_DPD_SAMPLE);
332  WRITEL(10, pmc_base + APBDEV_PMC_SEL_DPD_TIM);
333  }
334 
335  reg_val = READL(pmc_base + APBDEV_PMC_IO_DPD2_REQ);
336  reg_val &= ~(APBDEV_PMC_IO_DPD2_REQ_LVDS_ON ||
338 
339  reg_val = up ? APBDEV_PMC_IO_DPD2_REQ_LVDS_ON |
343 
344  WRITEL(reg_val, pmc_base + APBDEV_PMC_IO_DPD2_REQ);
345 
346  /* Polling */
347  u32 temp = 10*1000;
348  do {
349  udelay(20);
350  reg_val = READL(pmc_base + APBDEV_PMC_IO_DPD2_STATUS);
351  if (temp > 20)
352  temp -= 20;
353  else
354  break;
355  } while ((reg_val & APBDEV_PMC_IO_DPD2_STATUS_LVDS_ON) != 0);
356 
357  if ((reg_val & APBDEV_PMC_IO_DPD2_STATUS_LVDS_ON) != 0)
359  "PMC_IO_DPD2 polling failed (0x%x)\n", reg_val);
360 
361  if (up)
363  pmc_base + APBDEV_PMC_DPD_SAMPLE);
364 }
365 
367 {
368  u32 reg_val;
369 
370  reg_val = tegra_sor_readl(sor, NV_SOR_DP_SPARE(sor->portnum));
371  if (is_int)
373  else
374  reg_val &= ~NV_SOR_DP_SPARE_PANEL_INTERNAL;
375 
378  tegra_sor_writel(sor, NV_SOR_DP_SPARE(sor->portnum), reg_val);
379 }
380 
382  u8 *lane_count)
383 {
384  u32 reg_val;
385 
386  reg_val = tegra_sor_readl(sor, NV_SOR_CLK_CNTRL);
387  *link_bw = (reg_val & NV_SOR_CLK_CNTRL_DP_LINK_SPEED_MASK)
389  reg_val = tegra_sor_readl(sor,
390  NV_SOR_DP_LINKCTL(sor->portnum));
391 
392  switch (reg_val & NV_SOR_DP_LINKCTL_LANECOUNT_MASK) {
394  *lane_count = 0;
395  break;
397  *lane_count = 1;
398  break;
400  *lane_count = 2;
401  break;
403  *lane_count = 4;
404  break;
405  default:
406  printk(BIOS_ERR, "Unknown lane count\n");
407  }
408 }
409 
411 {
415 }
416 
417 void tegra_dc_sor_set_lane_count(struct tegra_dc_sor_data *sor, u8 lane_count)
418 {
419  u32 reg_val;
420 
421  reg_val = tegra_sor_readl(sor, NV_SOR_DP_LINKCTL(sor->portnum));
423  switch (lane_count) {
424  case 0:
425  break;
426  case 1:
428  break;
429  case 2:
431  break;
432  case 4:
434  break;
435  default:
436  /* 0 should be handled earlier. */
437  printk(BIOS_ERR, "dp: Invalid lane count %d\n",
438  lane_count);
439  return;
440  }
441  tegra_sor_writel(sor, NV_SOR_DP_LINKCTL(sor->portnum), reg_val);
442 }
443 
445 {
446  sor_clock_start();
447 }
448 
449 /* The SOR power sequencer does not work for t1xx so SW has to
450  go through the power sequence manually */
451 /* Power up steps from spec: */
452 /* STEP PDPORT PDPLL PDBG PLLVCOD PLLCAPD E_DPD PDCAL */
453 /* 1 1 1 1 1 1 1 1 */
454 /* 2 1 1 1 1 1 0 1 */
455 /* 3 1 1 0 1 1 0 1 */
456 /* 4 1 0 0 0 0 0 1 */
457 /* 5 0 0 0 0 0 0 1 */
458 static void tegra_dc_sor_power_up(struct tegra_dc_sor_data *sor,
459  int is_lvds)
460 {
461  if (sor->power_is_up)
462  return;
463 
464  /* Set link bw */
468 
469  /* step 1 */
478  NV_SOR_PLL0_PWR_MASK | /* PDPLL */
479  NV_SOR_PLL0_VCOPD_MASK, /* PLLVCOPD */
485 
486  /* step 2 */
487  tegra_dc_sor_io_set_dpd(sor, 1);
488  udelay(15);
489 
490  /* step 3 */
494  udelay(25);
495 
496  /* step 4 */
498  NV_SOR_PLL0_PWR_MASK | /* PDPLL */
499  NV_SOR_PLL0_VCOPD_MASK, /* PLLVCOPD */
504  udelay(225);
505 
506  /* step 5 */
510 
511  sor->power_is_up = 1;
512 }
513 
514 #if DEBUG_SOR
515 static void dump_sor_reg(struct tegra_dc_sor_data *sor)
516 {
517 #define DUMP_REG(a) printk(BIOS_INFO, "%-32s %03x %08x\n", \
518  #a, a, tegra_sor_readl(sor, a));
519 
520  DUMP_REG(NV_SOR_SUPER_STATE0);
521  DUMP_REG(NV_SOR_SUPER_STATE1);
522  DUMP_REG(NV_SOR_STATE0);
523  DUMP_REG(NV_SOR_STATE1);
524  DUMP_REG(NV_HEAD_STATE0(0));
525  DUMP_REG(NV_HEAD_STATE0(1));
526  DUMP_REG(NV_HEAD_STATE1(0));
527  DUMP_REG(NV_HEAD_STATE1(1));
528  DUMP_REG(NV_HEAD_STATE2(0));
529  DUMP_REG(NV_HEAD_STATE2(1));
530  DUMP_REG(NV_HEAD_STATE3(0));
531  DUMP_REG(NV_HEAD_STATE3(1));
532  DUMP_REG(NV_HEAD_STATE4(0));
533  DUMP_REG(NV_HEAD_STATE4(1));
534  DUMP_REG(NV_HEAD_STATE5(0));
535  DUMP_REG(NV_HEAD_STATE5(1));
536  DUMP_REG(NV_SOR_CRC_CNTRL);
537  DUMP_REG(NV_SOR_CLK_CNTRL);
538  DUMP_REG(NV_SOR_CAP);
539  DUMP_REG(NV_SOR_PWR);
540  DUMP_REG(NV_SOR_TEST);
541  DUMP_REG(NV_SOR_PLL0);
542  DUMP_REG(NV_SOR_PLL1);
543  DUMP_REG(NV_SOR_PLL2);
544  DUMP_REG(NV_SOR_PLL3);
545  DUMP_REG(NV_SOR_CSTM);
546  DUMP_REG(NV_SOR_LVDS);
547  DUMP_REG(NV_SOR_CRCA);
548  DUMP_REG(NV_SOR_CRCB);
549  DUMP_REG(NV_SOR_SEQ_CTL);
550  DUMP_REG(NV_SOR_LANE_SEQ_CTL);
551  DUMP_REG(NV_SOR_SEQ_INST(0));
552  DUMP_REG(NV_SOR_SEQ_INST(1));
553  DUMP_REG(NV_SOR_SEQ_INST(2));
554  DUMP_REG(NV_SOR_SEQ_INST(3));
555  DUMP_REG(NV_SOR_SEQ_INST(4));
556  DUMP_REG(NV_SOR_SEQ_INST(5));
557  DUMP_REG(NV_SOR_SEQ_INST(6));
558  DUMP_REG(NV_SOR_SEQ_INST(7));
559  DUMP_REG(NV_SOR_SEQ_INST(8));
560  DUMP_REG(NV_SOR_PWM_DIV);
561  DUMP_REG(NV_SOR_PWM_CTL);
562  DUMP_REG(NV_SOR_MSCHECK);
563  DUMP_REG(NV_SOR_XBAR_CTRL);
564  DUMP_REG(NV_SOR_DP_LINKCTL(0));
565  DUMP_REG(NV_SOR_DP_LINKCTL(1));
566  DUMP_REG(NV_SOR_DC(0));
567  DUMP_REG(NV_SOR_DC(1));
568  DUMP_REG(NV_SOR_LANE_DRIVE_CURRENT(0));
569  DUMP_REG(NV_SOR_PR(0));
570  DUMP_REG(NV_SOR_LANE4_PREEMPHASIS(0));
571  DUMP_REG(NV_SOR_POSTCURSOR(0));
572  DUMP_REG(NV_SOR_DP_CONFIG(0));
573  DUMP_REG(NV_SOR_DP_CONFIG(1));
574  DUMP_REG(NV_SOR_DP_MN(0));
575  DUMP_REG(NV_SOR_DP_MN(1));
576  DUMP_REG(NV_SOR_DP_PADCTL(0));
577  DUMP_REG(NV_SOR_DP_PADCTL(1));
578  DUMP_REG(NV_SOR_DP_DEBUG(0));
579  DUMP_REG(NV_SOR_DP_DEBUG(1));
580  DUMP_REG(NV_SOR_DP_SPARE(0));
581  DUMP_REG(NV_SOR_DP_SPARE(1));
582  DUMP_REG(NV_SOR_DP_TPG);
583 }
584 #endif
585 
587  int is_lvds)
588 {
589  const struct tegra_dc *dc = sor->dc;
590  const struct tegra_dc_dp_data *dp = dc->out;
591  const struct tegra_dc_dp_link_config *link_cfg = &dp->link_cfg;
592  const struct soc_nvidia_tegra210_config *config = dc->config;
593 
594  const int head_num = 0;
595  u32 reg_val = NV_SOR_STATE1_ASY_OWNER_HEAD0 << head_num;
596  u32 vsync_end, hsync_end;
597  u32 vblank_end, hblank_end;
598  u32 vblank_start, hblank_start;
599 
600  reg_val |= is_lvds ? NV_SOR_STATE1_ASY_PROTOCOL_LVDS_CUSTOM :
604 
607  reg_val |= (link_cfg->bits_per_pixel > 18) ?
610 
611  tegra_sor_writel(sor, NV_SOR_STATE1, reg_val);
612 
613  /* Skipping programming NV_HEAD_STATE0, assuming:
614  interlacing: PROGRESSIVE, dynamic range: VESA, colorspace: RGB */
615 
616  tegra_sor_writel(sor, NV_HEAD_STATE1(head_num),
619 
620  vsync_end = config->vsync_width - 1;
621  hsync_end = config->hsync_width - 1;
622  tegra_sor_writel(sor, NV_HEAD_STATE2(head_num),
623  vsync_end << NV_HEAD_STATE2_VSYNC_END_SHIFT |
625 
626  vblank_end = vsync_end + config->vback_porch;
627  hblank_end = hsync_end + config->hback_porch;
628  tegra_sor_writel(sor, NV_HEAD_STATE3(head_num),
629  vblank_end << NV_HEAD_STATE3_VBLANK_END_SHIFT |
630  hblank_end << NV_HEAD_STATE3_HBLANK_END_SHIFT);
631 
632  vblank_start = vblank_end + config->yres;
633  hblank_start = hblank_end + config->xres;
634  tegra_sor_writel(sor, NV_HEAD_STATE4(head_num),
635  vblank_start << NV_HEAD_STATE4_VBLANK_START_SHIFT |
636  hblank_start << NV_HEAD_STATE4_HBLANK_START_SHIFT);
637 
638  /* TODO: adding interlace mode support */
639  tegra_sor_writel(sor, NV_HEAD_STATE5(head_num), 0x1);
640 
645  is_lvds ? NV_SOR_CSTM_LVDS_EN_ENABLE :
647 
648  tegra_dc_sor_config_pwm(sor, 1024, 1024);
649 }
650 
652 {
653  struct tegra_dc *dc = sor->dc;
654  struct display_controller *disp_ctrl = (void *)dc->base;
655 
656  u32 reg_val = READL(&disp_ctrl->cmd.state_access);
657 
658  WRITEL(reg_val | WRITE_MUX_ACTIVE, &disp_ctrl->cmd.state_access);
659  WRITEL(VSYNC_H_POSITION(1), &disp_ctrl->disp.disp_timing_opt);
660 
661  /* Enable DC now - otherwise pure text console may not show. */
663  WRITEL(reg_val, &disp_ctrl->cmd.state_access);
664 }
665 
667 {
668  const struct tegra_dc_dp_link_config *link_cfg = sor->link_cfg;
669 
673 
677  udelay(25);
678 
683  0xf << NV_SOR_PLL0_ICHPMP_SHFIT |
684  0x3 << NV_SOR_PLL0_VCOCAP_SHIFT |
696 
700  100, TEGRA_SOR_TIMEOUT_MS * 1000)) {
701  printk(BIOS_ERR, "DP failed to lock PLL\n");
702  return;
703  }
704 
709 
710  tegra_dc_sor_power_up(sor, 0);
711 
712  /* re-enable SOR clock */
713  tegra_sor_enable_edp_clock(sor); /* select pll_dp as clock source */
714 
715  /* Power up lanes */
716  tegra_dc_sor_power_dplanes(sor, link_cfg->lane_count, 1);
717 
718  tegra_dc_sor_set_dp_mode(sor, link_cfg);
719 
720 }
721 
723 {
724  u32 reg_val;
725  struct display_controller *disp_ctrl = (void *)sor->dc->base;
726 
729 
730  WRITEL(0x9f00, &disp_ctrl->cmd.state_ctrl);
731  WRITEL(0x9f, &disp_ctrl->cmd.state_ctrl);
732 
735  &disp_ctrl->cmd.disp_pow_ctrl);
736 
737  reg_val = tegra_sor_readl(sor, NV_SOR_TEST);
738  if (reg_val & NV_SOR_TEST_ATTACHED_TRUE)
739  return;
740 
743 
744  /*
745  * Enable display2sor clock at least 2 cycles before DC start,
746  * to clear sor internal valid signal.
747  */
748 
749  /* Stop dc for 3 cycles */
750  WRITEL(0, &disp_ctrl->disp.disp_win_opt);
751  WRITEL(GENERAL_ACT_REQ, &disp_ctrl->cmd.state_ctrl);
752  udelay(FRAME_IN_MS * 1000 * 3);
753 
754  /* Attach head */
755  tegra_dc_sor_update(sor);
763 
764  /* wait for another 5 cycles */
765  udelay(FRAME_IN_MS * 1000 * 5);
766 
767  /* Re-enable dc */
769  &disp_ctrl->cmd.state_access);
770  WRITEL(SOR_ENABLE, &disp_ctrl->disp.disp_win_opt);
771 
773  WRITEL(GENERAL_ACT_REQ, &disp_ctrl->cmd.state_ctrl);
774 
778  100, TEGRA_SOR_ATTACH_TIMEOUT_MS * 1000))
779  printk(BIOS_ERR, "dc timeout waiting for OPMOD = AWAKE\n");
780  else
781  printk(BIOS_INFO, "%s: sor is attached\n", __func__);
782 
783 #if DEBUG_SOR
784  dump_sor_reg(sor);
785 #endif
786 }
787 
789  const struct tegra_dc_dp_link_config *link_cfg)
790 {
792  link_cfg->drive_current);
794  link_cfg->preemphasis);
796  link_cfg->postcursor);
797  tegra_sor_writel(sor, NV_SOR_LVDS, 0);
798 
800  tegra_dc_sor_set_lane_count(sor, link_cfg->lane_count);
801 
807 
808  /* Precharge */
810  0xf0, 0xf0);
811  udelay(20);
812 
814  0xf0, 0x0);
815 }
816 
818 {
819  u32 drive_current = 0;
820  u32 pre_emphasis = 0;
821 
822  /* Set to a known-good pre-calibrated setting */
823  switch (sor->link_cfg->link_bw) {
825  case SOR_LINK_SPEED_G2_7:
826  drive_current = 0x13131313;
827  pre_emphasis = 0;
828  break;
829  case SOR_LINK_SPEED_G5_4:
830  printk(BIOS_WARNING, "T1xx does not support 5.4G link"
831  " clock.\n");
832  default:
833  printk(BIOS_WARNING, "Invalid sor link bandwidth: %d\n",
834  sor->link_cfg->link_bw);
835  return;
836  }
837 
839  drive_current);
840  tegra_sor_writel(sor, NV_SOR_PR(sor->portnum), pre_emphasis);
841 }
842 
844 {
845  u32 pad_ctrl = 0;
846  int err = 0;
847 
848  switch (sor->link_cfg->lane_count) {
849  case 4:
850  pad_ctrl = (NV_SOR_DP_PADCTL_PD_TXD_0_NO |
854  break;
855  case 2:
856  pad_ctrl = (NV_SOR_DP_PADCTL_PD_TXD_0_NO |
860  break;
861  case 1:
862  pad_ctrl = (NV_SOR_DP_PADCTL_PD_TXD_0_NO |
866  break;
867  default:
868  printk(BIOS_ERR, "Invalid sor lane count: %u\n",
869  sor->link_cfg->lane_count);
870  return;
871  }
872 
874  tegra_sor_writel(sor, NV_SOR_DP_PADCTL(sor->portnum), pad_ctrl);
875 
876  err = tegra_dc_sor_enable_lane_sequencer(sor, 0, 0);
877  if (err) {
879  "Wait for lane power down failed: %d\n", err);
880  return;
881  }
882 }
883 
885 {
886  const struct tegra_dc_dp_link_config *cfg = sor->link_cfg;
887  u32 val = 0;
888 
889  switch (cfg->lane_count) {
890  case 4:
893  fallthrough;
894  case 2:
896  fallthrough;
897  case 1:
899  break;
900  default:
902  "dp: invalid lane number %d\n", cfg->lane_count);
903  return;
904  }
905 
909  udelay(100);
912 }
913 
914 static u32 tegra_dc_poll_register(void *reg,
915  u32 mask, u32 exp_val, u32 poll_interval_us, u32 timeout_us)
916 {
917  u32 temp = timeout_us;
918  u32 reg_val = 0;
919 
920  do {
921  udelay(poll_interval_us);
922  reg_val = READL(reg);
923  if (timeout_us > poll_interval_us)
924  timeout_us -= poll_interval_us;
925  else
926  break;
927  } while ((reg_val & mask) != exp_val);
928 
929  if ((reg_val & mask) == exp_val)
930  return 0; /* success */
931 
932  return temp;
933 }
934 
935 static void tegra_dc_sor_general_act(struct display_controller *disp_ctrl)
936 {
937  WRITEL(GENERAL_ACT_REQ, &disp_ctrl->cmd.state_ctrl);
938 
939  if (tegra_dc_poll_register(&disp_ctrl->cmd.state_ctrl,
940  GENERAL_ACT_REQ, 0, 100,
943  "dc timeout waiting for DC to stop\n");
944 }
945 
946 static struct tegra_dc_mode min_mode = {
947  .h_ref_to_sync = 0,
948  .v_ref_to_sync = 1,
949  .h_sync_width = 1,
950  .v_sync_width = 1,
951  .h_back_porch = 20,
952  .v_back_porch = 0,
953  .h_active = 16,
954  .v_active = 16,
955  .h_front_porch = 1,
956  .v_front_porch = 2,
957 };
958 
959 /* Disable windows and set minimum raster timings */
960 static void
962  int *dc_reg_ctx)
963 {
964  int selected_windows, i;
965 
966  selected_windows = READL(&disp_ctrl->cmd.disp_win_header);
967 
968  /* Store and clear window options */
969  for (i = 0; i < DC_N_WINDOWS; ++i) {
970  WRITEL(WINDOW_A_SELECT << i, &disp_ctrl->cmd.disp_win_header);
971  dc_reg_ctx[i] = READL(&disp_ctrl->win.win_opt);
972  WRITEL(0, &disp_ctrl->win.win_opt);
973  WRITEL(WIN_A_ACT_REQ << i, &disp_ctrl->cmd.state_ctrl);
974  }
975 
976  WRITEL(selected_windows, &disp_ctrl->cmd.disp_win_header);
977 
978  /* Store current raster timings and set minimum timings */
979  dc_reg_ctx[i++] = READL(&disp_ctrl->disp.ref_to_sync);
981  &disp_ctrl->disp.ref_to_sync);
982 
983  dc_reg_ctx[i++] = READL(&disp_ctrl->disp.sync_width);
985  &disp_ctrl->disp.sync_width);
986 
987  dc_reg_ctx[i++] = READL(&disp_ctrl->disp.back_porch);
989  min_mode.v_back_porch << 16,
990  &disp_ctrl->disp.back_porch);
991 
992  dc_reg_ctx[i++] = READL(&disp_ctrl->disp.front_porch);
994  min_mode.v_front_porch << 16,
995  &disp_ctrl->disp.front_porch);
996 
997  dc_reg_ctx[i++] = READL(&disp_ctrl->disp.disp_active);
999  &disp_ctrl->disp.disp_active);
1000 
1001  WRITEL(GENERAL_ACT_REQ, &disp_ctrl->cmd.state_ctrl);
1002 }
1003 
1004 /* Restore previous windows status and raster timings */
1005 static void
1007  int *dc_reg_ctx)
1008 {
1009  int selected_windows, i;
1010 
1011  selected_windows = READL(&disp_ctrl->cmd.disp_win_header);
1012 
1013  for (i = 0; i < DC_N_WINDOWS; ++i) {
1014  WRITEL(WINDOW_A_SELECT << i, &disp_ctrl->cmd.disp_win_header);
1015  WRITEL(dc_reg_ctx[i], &disp_ctrl->win.win_opt);
1016  WRITEL(WIN_A_ACT_REQ << i, &disp_ctrl->cmd.state_ctrl);
1017  }
1018 
1019  WRITEL(selected_windows, &disp_ctrl->cmd.disp_win_header);
1020 
1021  WRITEL(dc_reg_ctx[i++], &disp_ctrl->disp.ref_to_sync);
1022  WRITEL(dc_reg_ctx[i++], &disp_ctrl->disp.sync_width);
1023  WRITEL(dc_reg_ctx[i++], &disp_ctrl->disp.back_porch);
1024  WRITEL(dc_reg_ctx[i++], &disp_ctrl->disp.front_porch);
1025  WRITEL(dc_reg_ctx[i++], &disp_ctrl->disp.disp_active);
1026 
1027  WRITEL(GENERAL_UPDATE, &disp_ctrl->cmd.state_ctrl);
1028 }
1029 
1030 static void tegra_dc_sor_enable_sor(struct tegra_dc_sor_data *sor, int enable)
1031 {
1032  struct display_controller *disp_ctrl = (void *)sor->dc->base;
1033  u32 reg_val = READL(&disp_ctrl->disp.disp_win_opt);
1034 
1035  reg_val = enable ? reg_val | SOR_ENABLE : reg_val & ~SOR_ENABLE;
1036  WRITEL(reg_val, &disp_ctrl->disp.disp_win_opt);
1037 }
1038 
1040 {
1041  struct display_controller *disp_ctrl = (void *)sor->dc->base;
1042  int dc_reg_ctx[DC_N_WINDOWS + 5];
1043  unsigned long dc_int_mask;
1044 
1045  /* Sleep mode */
1051 
1052  tegra_dc_sor_disable_win_short_raster(disp_ctrl, dc_reg_ctx);
1053 
1057  100, TEGRA_SOR_ATTACH_TIMEOUT_MS*1000)) {
1058  printk(BIOS_ERR,
1059  "dc timeout waiting for OPMOD = SLEEP\n");
1060  }
1061 
1066 
1067  /* Mask DC interrupts during the 2 dummy frames required for detach */
1068  dc_int_mask = READL(&disp_ctrl->cmd.int_mask);
1069  WRITEL(0, &disp_ctrl->cmd.int_mask);
1070 
1071  /* Stop DC->SOR path */
1072  tegra_dc_sor_enable_sor(sor, 0);
1073  tegra_dc_sor_general_act(disp_ctrl);
1074 
1075  /* Stop DC */
1076  WRITEL(DISP_CTRL_MODE_STOP, &disp_ctrl->cmd.disp_cmd);
1077  tegra_dc_sor_general_act(disp_ctrl);
1078 
1079  tegra_dc_sor_restore_win_and_raster(disp_ctrl, dc_reg_ctx);
1080 
1081  WRITEL(dc_int_mask, &disp_ctrl->cmd.int_mask);
1082 }
static u32 addr
Definition: cirrus.c:14
#define printk(level,...)
Definition: stdlib.h:16
#define PW2_ENABLE
Definition: dc.h:362
#define WINDOW_A_SELECT
Definition: dc.h:394
#define PW4_ENABLE
Definition: dc.h:364
#define PW1_ENABLE
Definition: dc.h:361
#define WIN_A_ACT_REQ
Definition: dc.h:378
#define PW3_ENABLE
Definition: dc.h:363
#define GENERAL_ACT_REQ
Definition: dc.h:377
#define DISP_CTRL_MODE_STOP
Definition: dc.h:353
#define READ_MUX_ACTIVE
Definition: dc.h:372
#define PM0_ENABLE
Definition: dc.h:365
#define DISP_CTRL_MODE_C_DISPLAY
Definition: dc.h:354
#define GENERAL_UPDATE
Definition: dc.h:384
#define PM1_ENABLE
Definition: dc.h:366
unsigned long READL(void *p)
Definition: display.c:24
#define PW0_ENABLE
Definition: dc.h:360
#define VSYNC_H_POSITION(x)
Definition: dc.h:408
#define SOR_ENABLE
Definition: dc.h:402
void WRITEL(unsigned long value, void *p)
Definition: display.c:41
#define EFAULT
Definition: errno.h:19
#define BIOS_INFO
BIOS_INFO - Expected events.
Definition: loglevel.h:113
#define BIOS_ERR
BIOS_ERR - System in incomplete state.
Definition: loglevel.h:72
#define BIOS_WARNING
BIOS_WARNING - Bad configuration.
Definition: loglevel.h:86
enum board_config config
Definition: memory.c:448
static const int mask[4]
Definition: gpio.c:308
void sor_clock_start(void)
Definition: clock.c:195
#define vtotal(mode)
Definition: display.h:19
#define htotal(mode)
Definition: display.h:15
#define hsync_end(mode)
Definition: display.h:12
#define FRAME_IN_MS
Definition: display.h:29
uint32_t u32
Definition: stdint.h:51
uint8_t u8
Definition: stdint.h:45
u32 disp_cmd
Definition: dc.h:49
u32 state_ctrl
Definition: dc.h:69
u32 int_mask
Definition: dc.h:57
u32 disp_win_header
Definition: dc.h:70
u32 state_access
Definition: dc.h:68
u32 disp_pow_ctrl
Definition: dc.h:55
u32 back_porch
Definition: dc.h:185
u32 disp_timing_opt
Definition: dc.h:182
u32 disp_win_opt
Definition: dc.h:180
u32 disp_active
Definition: dc.h:186
u32 front_porch
Definition: dc.h:187
u32 ref_to_sync
Definition: dc.h:183
u32 sync_width
Definition: dc.h:184
u32 win_opt
Definition: dc.h:281
struct dc_cmd_reg cmd
Definition: dc.h:332
struct dc_disp_reg disp
Definition: dc.h:338
struct dc_win_reg win
Definition: dc.h:344
struct tegra_dc * dc
Definition: displayport.h:321
struct tegra_dc_dp_link_config link_cfg
Definition: displayport.h:324
int h_sync_width
Definition: dc.h:486
int h_ref_to_sync
Definition: dc.h:484
int h_back_porch
Definition: dc.h:488
int v_front_porch
Definition: dc.h:493
int v_sync_width
Definition: dc.h:487
int v_ref_to_sync
Definition: dc.h:485
int h_active
Definition: dc.h:490
int v_active
Definition: dc.h:491
int h_front_porch
Definition: dc.h:492
int v_back_porch
Definition: dc.h:489
void * base
Definition: sor.h:881
struct tegra_dc * dc
Definition: sor.h:880
struct tegra_dc_dp_link_config * link_cfg
Definition: sor.h:884
int power_is_up
Definition: sor.h:885
void * pmc_base
Definition: sor.h:882
Definition: dc.h:475
void * base
Definition: dc.h:478
void * config
Definition: dc.h:476
void * out
Definition: dc.h:477
u8 val
Definition: sys.c:300
#define NV_SOR_PLL2
Definition: sor.h:256
#define NV_SOR_POSTCURSOR(i)
Definition: sor.h:646
#define NV_SOR_DP_AUDIO_VBLANK_SYMBOLS_MASK
Definition: sor.h:742
#define NV_SOR_DP_AUDIO_VBLANK_SYMBOLS
Definition: sor.h:741
#define NV_SOR_LANE_SEQ_CTL_SETTING_MASK
Definition: sor.h:404
#define NV_SOR_LANE_DRIVE_CURRENT(i)
Definition: sor.h:595
#define NV_SOR_DP_MN(i)
Definition: sor.h:666
#define NV_SOR_PWR_SETTING_NEW_DONE
Definition: sor.h:148
#define NV_SOR_PWM_CTL_SETTING_NEW_TRIGGER
Definition: sor.h:511
#define NV_SOR_CAP
Definition: sor.h:136
#define NV_SOR_PWR_SETTING_NEW_DEFAULT_MASK
Definition: sor.h:147
#define NV_SOR_SUPER_STATE1_ASY_ORMODE_SAFE
Definition: sor.h:18
#define NV_SOR_PLL2_AUX8_SEQ_PLLCAPPD_ENFORCE_MASK
Definition: sor.h:277
#define NV_SOR_PWM_CTL_DUTY_CYCLE_MASK
Definition: sor.h:516
#define NV_SOR_PLL1_TMDS_TERM_ENABLE
Definition: sor.h:251
#define NV_SOR_DP_CONFIG_ACTIVESYM_CNTL_ENABLE
Definition: sor.h:656
#define NV_HEAD_STATE1(i)
Definition: sor.h:97
#define NV_SOR_DP_CONFIG(i)
Definition: sor.h:647
#define NV_SOR_CLK_CNTRL_DP_LINK_SPEED_MASK
Definition: sor.h:132
#define NV_SOR_DP_PADCTL_PD_TXD_1_YES
Definition: sor.h:718
#define NV_SOR_TEST_ACT_HEAD_OPMODE_AWAKE
Definition: sor.h:215
#define NV_SOR_CLK_CNTRL_DP_LINK_SPEED_G1_62
Definition: sor.h:133
#define NV_HEAD_STATE1_HTOTAL_SHIFT
Definition: sor.h:100
#define NV_SOR_STATE1_ASY_CRCMODE_COMPLETE_RASTER
Definition: sor.h:66
#define NV_SOR_PWR_SETTING_NEW_TRIGGER
Definition: sor.h:150
#define NV_SOR_DP_LINKCTL(i)
Definition: sor.h:522
#define NV_SOR_DP_LINKCTL_ENHANCEDFRAME_ENABLE
Definition: sor.h:537
#define NV_SOR_LANE_SEQ_CTL_SEQUENCE_DOWN
Definition: sor.h:413
#define NV_SOR_TEST
Definition: sor.h:175
#define NV_SOR_CLK_CNTRL_DP_CLK_SEL_SINGLE_DPCLK
Definition: sor.h:129
#define NV_SOR_PLL0_VCOPD_ASSERT
Definition: sor.h:244
#define NV_SOR_PLL2_AUX1_SEQ_MASK
Definition: sor.h:261
#define NV_HEAD_STATE4_VBLANK_START_SHIFT
Definition: sor.h:113
#define NV_SOR_PLL2_AUX6_BANDGAP_POWERDOWN_ENABLE
Definition: sor.h:271
#define NV_SOR_DP_CONFIG_ACTIVESYM_POLARITY_POSITIVE
Definition: sor.h:659
#define NV_SOR_STATE1_ASY_SUBOWNER_NONE
Definition: sor.h:70
#define NV_SOR_DP_PADCTL(i)
Definition: sor.h:676
#define NV_SOR_PLL0_VCOPD_MASK
Definition: sor.h:242
#define NV_SOR_PLL2_AUX2_OVERRIDE_POWERDOWN
Definition: sor.h:266
#define NV_SOR_DP_TPG
Definition: sor.h:746
#define NV_SOR_LANE_SEQ_CTL_SETTING_NEW_TRIGGER
Definition: sor.h:407
#define NV_SOR_PWM_CTL
Definition: sor.h:507
#define NV_SOR_DP_LINKCTL_TUSIZE_SHIFT
Definition: sor.h:541
#define NV_SOR_DP_LINKCTL_LANECOUNT_TWO
Definition: sor.h:533
#define NV_SOR_DP_SPARE_SOR_CLK_SEL_MACRO_SORCLK
Definition: sor.h:730
#define NV_SOR_PWM_CTL_SETTING_NEW_DONE
Definition: sor.h:509
#define NV_SOR_STATE1
Definition: sor.h:28
#define NV_SOR_XBAR_CTRL
Definition: sor.h:521
#define NV_SOR_PLL1_TERM_COMPOUT_HIGH
Definition: sor.h:255
#define NV_SOR_PLL1
Definition: sor.h:252
#define NV_SOR_PR(i)
Definition: sor.h:596
#define NV_SOR_PLL2_AUX6_BANDGAP_POWERDOWN_MASK
Definition: sor.h:269
#define NV_SOR_LANE_SEQ_CTL_NEW_POWER_STATE_PD
Definition: sor.h:416
#define NV_SOR_DP_PADCTL_PD_TXD_0_NO
Definition: sor.h:716
#define NV_SOR_DP_CONFIG_RD_RESET_VAL_NEGATIVE
Definition: sor.h:650
#define NV_HEAD_STATE0(i)
Definition: sor.h:79
#define NV_SOR_CSTM
Definition: sor.h:288
#define NV_SOR_DP_PADCTL_TX_PU_MASK
Definition: sor.h:688
#define NV_SOR_SUPER_STATE1_ATTACHED_NO
Definition: sor.h:15
#define NV_SOR_SEQ_INST(i)
Definition: sor.h:449
#define NV_HEAD_STATE3_HBLANK_END_SHIFT
Definition: sor.h:110
#define NV_SOR_STATE1_ASY_OWNER_HEAD0
Definition: sor.h:77
#define NV_SOR_DP_CONFIG_ACTIVESYM_COUNT_MASK
Definition: sor.h:663
#define NV_SOR_DP_PADCTL_PAD_CAL_PD_POWERUP
Definition: sor.h:683
#define NV_SOR_PLL2_AUX9_LVDSEN_OVERRIDE
Definition: sor.h:282
#define NV_SOR_DP_PADCTL_PAD_CAL_PD_POWERDOWN
Definition: sor.h:684
#define NV_SOR_PWR
Definition: sor.h:145
#define NV_SOR_LANE_SEQ_CTL
Definition: sor.h:402
#define NV_SOR_LANE4_PREEMPHASIS(i)
Definition: sor.h:645
#define NV_SOR_DP_PADCTL_PD_TXD_1_NO
Definition: sor.h:719
#define NV_SOR_LANE_SEQ_CTL_NEW_POWER_STATE_PU
Definition: sor.h:415
#define NV_SOR_STATE1_ASY_VSYNCPOL_NEGATIVE_TRUE
Definition: sor.h:52
#define NV_SOR_DP_PADCTL_TX_PU_DISABLE
Definition: sor.h:686
#define NV_HEAD_STATE2(i)
Definition: sor.h:102
#define NV_HEAD_STATE2_HSYNC_END_SHIFT
Definition: sor.h:105
#define NV_HEAD_STATE4(i)
Definition: sor.h:112
#define NV_HEAD_STATE1_VTOTAL_SHIFT
Definition: sor.h:98
#define NV_SOR_PLL2_AUX7_PORT_POWERDOWN_ENABLE
Definition: sor.h:275
#define NV_SOR_PLL0_PWR_OFF
Definition: sor.h:248
#define NV_SOR_STATE1_ASY_PROTOCOL_LVDS_CUSTOM
Definition: sor.h:59
#define NV_HEAD_STATE4_HBLANK_START_SHIFT
Definition: sor.h:115
#define NV_SOR_PWR_NORMAL_STATE_PD
Definition: sor.h:173
#define NV_SOR_SUPER_STATE1_ASY_ORMODE_NORMAL
Definition: sor.h:19
#define NV_SOR_CSTM_ROTCLK_SHIFT
Definition: sor.h:291
#define NV_SOR_PLL0_VCOCAP_SHIFT
Definition: sor.h:225
#define NV_SOR_DP_PADCTL_PD_TXD_2_NO
Definition: sor.h:722
#define NV_SOR_PLL2_AUX7_PORT_POWERDOWN_DISABLE
Definition: sor.h:274
#define NV_SOR_CRCA
Definition: sor.h:377
#define NV_SOR_DP_DEBUG(i)
Definition: sor.h:723
#define NV_SOR_PWM_DIV
Definition: sor.h:505
#define NV_SOR_DP_LINKCTL_TUSIZE_MASK
Definition: sor.h:542
#define NV_SOR_PLL2_AUX8_SEQ_PLLCAPPD_ENFORCE_DISABLE
Definition: sor.h:278
#define NV_SOR_DP_LINKCTL_LANECOUNT_ZERO
Definition: sor.h:531
#define NV_SOR_PLL0
Definition: sor.h:222
#define NV_SOR_STATE0
Definition: sor.h:25
#define NV_SOR_SUPER_STATE1
Definition: sor.h:13
#define NV_SOR_DP_PADCTL_TX_PU_VALUE_DEFAULT_MASK
Definition: sor.h:698
#define NV_SOR_CSTM_LVDS_EN_ENABLE
Definition: sor.h:295
#define NV_SOR_PLL0_VCOPD_RESCIND
Definition: sor.h:243
#define TEGRA_SOR_TIMEOUT_MS
Definition: sor.h:888
#define NV_SOR_DP_SPARE_PANEL_INTERNAL
Definition: sor.h:733
#define TEGRA_SOR_ATTACH_TIMEOUT_MS
Definition: sor.h:889
#define NV_SOR_DP_CONFIG_ACTIVESYM_FRAC_SHIFT
Definition: sor.h:660
#define NV_SOR_PLL2_AUX2_MASK
Definition: sor.h:265
#define NV_SOR_CSTM_LVDS_EN_DISABLE
Definition: sor.h:294
#define NV_SOR_DP_AUDIO_HBLANK_SYMBOLS_MASK
Definition: sor.h:739
#define NV_SOR_SEQ_CTL
Definition: sor.h:383
@ training_pattern_2
Definition: sor.h:825
@ training_pattern_1
Definition: sor.h:824
@ training_pattern_none
Definition: sor.h:827
@ training_pattern_3
Definition: sor.h:826
#define NV_SOR_DP_CONFIG_ACTIVESYM_FRAC_MASK
Definition: sor.h:661
#define NV_SOR_PLL3_PLLVDD_MODE_V3_3
Definition: sor.h:287
#define NV_SOR_CRCB
Definition: sor.h:381
#define NV_SOR_SUPER_STATE0
Definition: sor.h:10
#define NV_SOR_CRC_CNTRL
Definition: sor.h:118
#define SOR_LINK_SPEED_G1_62
Definition: sor.h:835
#define NV_SOR_TEST_ACT_HEAD_OPMODE_SLEEP
Definition: sor.h:213
#define NV_SOR_PWR_NORMAL_STATE_PU
Definition: sor.h:174
#define SOR_LINK_SPEED_G5_4
Definition: sor.h:837
#define NV_SOR_PLL2_AUX1_SEQ_PLLCAPPD_OVERRIDE
Definition: sor.h:263
#define NV_SOR_PLL3_PLLVDD_MODE_MASK
Definition: sor.h:285
#define NV_HEAD_STATE2_VSYNC_END_SHIFT
Definition: sor.h:103
#define NV_SOR_PLL2_AUX6_BANDGAP_POWERDOWN_DISABLE
Definition: sor.h:270
#define NV_SOR_DP_LINKCTL_LANECOUNT_FOUR
Definition: sor.h:534
#define NV_SOR_PLL2_AUX8_SEQ_PLLCAPPD_ENFORCE_ENABLE
Definition: sor.h:279
#define NV_SOR_DP_PADCTL_PD_TXD_3_NO
Definition: sor.h:713
#define NV_SOR_DP_SPARE(i)
Definition: sor.h:724
#define NV_SOR_STATE1_ASY_PIXELDEPTH_BPP_18_444
Definition: sor.h:32
#define NV_SOR_DP_AUDIO_HBLANK_SYMBOLS
Definition: sor.h:738
#define NV_SOR_LVDS
Definition: sor.h:302
#define NV_SOR_DP_LINKCTL_LANECOUNT_MASK
Definition: sor.h:530
#define NV_SOR_SUPER_STATE1_ATTACHED_YES
Definition: sor.h:16
#define NV_SOR_TEST_ACT_HEAD_OPMODE_DEFAULT_MASK
Definition: sor.h:212
#define NV_SOR_DP_CONFIG_ACTIVESYM_COUNT_SHIFT
Definition: sor.h:662
#define NV_SOR_STATE1_ASY_PIXELDEPTH_BPP_24_444
Definition: sor.h:35
#define NV_SOR_DP_CONFIG_WATERMARK_MASK
Definition: sor.h:665
#define NV_SOR_PWM_CTL_SETTING_NEW_SHIFT
Definition: sor.h:508
#define SOR_LINK_SPEED_G2_7
Definition: sor.h:836
#define NV_SOR_DP_LINKCTL_LANECOUNT_ONE
Definition: sor.h:532
#define NV_SOR_PLL0_PLLREG_LEVEL_V45
Definition: sor.h:232
#define NV_HEAD_STATE5(i)
Definition: sor.h:117
#define NV_SOR_DP_LINKCTL_ENABLE_YES
Definition: sor.h:545
#define NV_SOR_PLL0_PWR_MASK
Definition: sor.h:246
#define NV_SOR_CSTM_ROTCLK_DEFAULT_MASK
Definition: sor.h:292
#define NV_SOR_STATE1_ASY_HSYNCPOL_NEGATIVE_TRUE
Definition: sor.h:56
#define NV_SOR_DP_PADCTL_TX_PU_ENABLE
Definition: sor.h:687
#define NV_SOR_CLK_CNTRL_DP_CLK_SEL_MASK
Definition: sor.h:126
#define NV_SOR_DP_PADCTL_PD_TXD_2_YES
Definition: sor.h:721
#define NV_SOR_CLK_CNTRL_DP_LINK_SPEED_SHIFT
Definition: sor.h:131
#define NV_SOR_DP_PADCTL_COMODE_TXD_0_DP_TXD_2_SHIFT
Definition: sor.h:708
#define NV_SOR_LANE_SEQ_CTL_SEQUENCE_UP
Definition: sor.h:412
#define NV_SOR_TEST_ATTACHED_TRUE
Definition: sor.h:210
#define NV_SOR_PLL0_ICHPMP_SHFIT
Definition: sor.h:223
#define NV_HEAD_STATE3_VBLANK_END_SHIFT
Definition: sor.h:108
#define NV_SOR_DC(i)
Definition: sor.h:546
#define NV_SOR_SUPER_STATE1_ASY_HEAD_OP_SLEEP
Definition: sor.h:22
#define NV_SOR_DP_SPARE_SEQ_ENABLE_YES
Definition: sor.h:736
#define NV_SOR_MSCHECK
Definition: sor.h:517
#define NV_SOR_PLL0_RESISTORSEL_EXT
Definition: sor.h:240
#define NV_SOR_CLK_CNTRL_DP_LINK_SPEED_LVDS
Definition: sor.h:135
#define NV_SOR_PLL0_PWR_ON
Definition: sor.h:247
#define NV_SOR_DP_PADCTL_PD_TXD_3_YES
Definition: sor.h:712
#define NV_SOR_STATE1_ASY_PROTOCOL_DP_A
Definition: sor.h:60
#define NV_SOR_LANE_SEQ_CTL_SETTING_NEW_DONE
Definition: sor.h:405
#define NV_SOR_PLL3
Definition: sor.h:283
#define NV_SOR_CLK_CNTRL
Definition: sor.h:124
#define NV_SOR_PLL2_AUX7_PORT_POWERDOWN_MASK
Definition: sor.h:273
#define NV_SOR_DP_LINKCTL_ENABLE_NO
Definition: sor.h:544
#define NV_SOR_DP_PADCTL_TX_PU_VALUE_SHIFT
Definition: sor.h:697
#define NV_SOR_SUPER_STATE1_ASY_HEAD_OP_AWAKE
Definition: sor.h:24
#define NV_SOR_LANE_SEQ_CTL_DELAY_SHIFT
Definition: sor.h:417
#define NV_HEAD_STATE3(i)
Definition: sor.h:107
void tegra_dc_sor_set_lane_count(struct tegra_dc_sor_data *sor, u8 lane_count)
Definition: sor.c:418
void tegra_dc_sor_attach(struct tegra_dc_sor_data *sor)
Definition: sor.c:728
void tegra_dc_sor_read_link_config(struct tegra_dc_sor_data *sor, u8 *link_bw, u8 *lane_count)
Definition: sor.c:382
void tegra_dc_sor_set_dp_linkctl(struct tegra_dc_sor_data *sor, int ena, u8 training_pattern, const struct tegra_dc_dp_link_config *link_cfg)
Definition: sor.c:141
void tegra_dc_sor_set_voltage_swing(struct tegra_dc_sor_data *sor)
Definition: sor.c:818
void tegra_dc_sor_set_internal_panel(struct tegra_dc_sor_data *sor, int is_int)
Definition: sor.c:367
void tegra_dp_disable_tx_pu(struct tegra_dc_sor_data *sor)
Definition: sor.c:66
void tegra_dc_sor_set_link_bandwidth(struct tegra_dc_sor_data *sor, u8 link_bw)
Definition: sor.c:411
int tegra_dc_sor_set_power_state(struct tegra_dc_sor_data *sor, int pu_pd)
Definition: sor.c:113
void tegra_dc_sor_set_lane_parm(struct tegra_dc_sor_data *sor, const struct tegra_dc_dp_link_config *link_cfg)
Definition: sor.c:789
void tegra_sor_precharge_lanes(struct tegra_dc_sor_data *sor)
Definition: sor.c:885
void tegra_dc_sor_enable_dp(struct tegra_dc_sor_data *sor)
Definition: sor.c:672
void tegra_dc_sor_set_panel_power(struct tegra_dc_sor_data *sor, int power_up)
Definition: sor.c:242
void tegra_dc_sor_power_down_unused_lanes(struct tegra_dc_sor_data *sor)
Definition: sor.c:844
void tegra_dp_set_pe_vs_pc(struct tegra_dc_sor_data *sor, u32 mask, u32 pe_reg, u32 vs_reg, u32 pc_reg, u8 pc_supported)
Definition: sor.c:74
@ WRITE_MUX_ACTIVE
Definition: emc.h:50
#define TEGRA_DC_POLL_TIMEOUT_MS
Definition: sor.h:890
#define APBDEV_PMC_IO_DPD2_REQ_CODE_DEFAULT_MASK
Definition: sor.c:34
#define APBDEV_PMC_IO_DPD2_REQ_LVDS_ON
Definition: sor.c:32
static void tegra_dc_sor_io_set_dpd(struct tegra_dc_sor_data *sor, int up)
Definition: sor.c:324
static void tegra_dc_sor_config_panel(struct tegra_dc_sor_data *sor, int is_lvds)
Definition: sor.c:586
static void tegra_dc_sor_disable_win_short_raster(struct display_controller *disp_ctrl, int *dc_reg_ctx)
Definition: sor.c:961
static int tegra_dc_sor_power_dplanes(struct tegra_dc_sor_data *sor, u32 lane_count, int pu)
Definition: sor.c:213
static int tegra_dc_sor_enable_lane_sequencer(struct tegra_dc_sor_data *sor, int pu, int is_lvds)
Definition: sor.c:179
static u32 tegra_dc_sor_poll_register(struct tegra_dc_sor_data *sor, u32 reg, u32 mask, u32 exp_val, u32 poll_interval_us, u32 timeout_us)
Definition: sor.c:90
#define APBDEV_PMC_IO_DPD2_REQ
Definition: sor.c:29
static void tegra_dc_sor_super_update(struct tegra_dc_sor_data *sor)
Definition: sor.c:310
#define APBDEV_PMC_IO_DPD2_REQ_CODE_DPD_ON
Definition: sor.c:37
static void tegra_dc_sor_power_up(struct tegra_dc_sor_data *sor, int is_lvds)
Definition: sor.c:458
#define APBDEV_PMC_IO_DPD2_STATUS_LVDS_ON
Definition: sor.c:41
static void tegra_dc_sor_enable_sor(struct tegra_dc_sor_data *sor, int enable)
Definition: sor.c:1030
static void tegra_dc_sor_enable_dc(struct tegra_dc_sor_data *sor)
Definition: sor.c:651
static void tegra_sor_enable_edp_clock(struct tegra_dc_sor_data *sor)
Definition: sor.c:444
static u32 tegra_sor_readl(struct tegra_dc_sor_data *sor, u32 reg)
Definition: sor.c:45
static void tegra_sor_write_field(struct tegra_dc_sor_data *sor, u32 reg, u32 mask, u32 val)
Definition: sor.c:59
#define APBDEV_PMC_IO_DPD2_REQ_CODE_DPD_OFF
Definition: sor.c:36
static void tegra_sor_writel(struct tegra_dc_sor_data *sor, u32 reg, u32 val)
Definition: sor.c:52
#define DC_N_WINDOWS
Definition: sor.c:43
#define APBDEV_PMC_SEL_DPD_TIM
Definition: sor.c:27
static void tegra_dc_sor_general_act(struct display_controller *disp_ctrl)
Definition: sor.c:935
static u32 tegra_dc_poll_register(void *reg, u32 mask, u32 exp_val, u32 poll_interval_us, u32 timeout_us)
Definition: sor.c:914
#define APBDEV_PMC_IO_DPD2_REQ_LVDS_OFF
Definition: sor.c:31
static void tegra_dc_sor_set_dp_mode(struct tegra_dc_sor_data *sor, const struct tegra_dc_dp_link_config *link_cfg)
Definition: sor.c:276
#define APBDEV_PMC_DPD_SAMPLE_ON_ENABLE
Definition: sor.c:26
#define APBDEV_PMC_IO_DPD2_STATUS
Definition: sor.c:38
static void tegra_dc_sor_update(struct tegra_dc_sor_data *sor)
Definition: sor.c:317
static void tegra_dc_sor_config_pwm(struct tegra_dc_sor_data *sor, u32 pwm_div, u32 pwm_dutycycle)
Definition: sor.c:259
#define APBDEV_PMC_DPD_SAMPLE
Definition: sor.c:24
static void tegra_dc_sor_restore_win_and_raster(struct display_controller *disp_ctrl, int *dc_reg_ctx)
Definition: sor.c:1006
void tegra_dc_detach(struct tegra_dc_sor_data *sor)
Definition: sor.c:1039
static struct tegra_dc_mode min_mode
Definition: sor.c:946
#define APBDEV_PMC_DPD_SAMPLE_ON_DISABLE
Definition: sor.c:25
void udelay(uint32_t us)
Definition: udelay.c:15