dp_pll_14nm.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef __MDSS_DP_PLL_14NM_H
  6. #define __MDSS_DP_PLL_14NM_H
  7. #define DP_PHY_REVISION_ID0 0x0000
  8. #define DP_PHY_REVISION_ID1 0x0004
  9. #define DP_PHY_REVISION_ID2 0x0008
  10. #define DP_PHY_REVISION_ID3 0x000C
  11. #define DP_PHY_CFG 0x0010
  12. #define DP_PHY_CFG_1 0x0014
  13. #define DP_PHY_PD_CTL 0x0018
  14. #define DP_PHY_MODE 0x001C
  15. #define DP_PHY_AUX_CFG0 0x0020
  16. #define DP_PHY_AUX_CFG1 0x0024
  17. #define DP_PHY_AUX_CFG2 0x0028
  18. #define DP_PHY_AUX_CFG3 0x002C
  19. #define DP_PHY_AUX_CFG4 0x0030
  20. #define DP_PHY_AUX_CFG5 0x0034
  21. #define DP_PHY_AUX_CFG6 0x0038
  22. #define DP_PHY_AUX_CFG7 0x003C
  23. #define DP_PHY_AUX_CFG8 0x0040
  24. #define DP_PHY_AUX_CFG9 0x0044
  25. #define DP_PHY_AUX_INTERRUPT_MASK 0x0048
  26. #define DP_PHY_AUX_INTERRUPT_CLEAR 0x004C
  27. #define DP_PHY_AUX_BIST_CFG 0x0050
  28. #define DP_PHY_VCO_DIV 0x0068
  29. #define DP_PHY_TX0_TX1_LANE_CTL 0x006C
  30. #define DP_PHY_TX2_TX3_LANE_CTL 0x0088
  31. #define DP_PHY_SPARE0 0x00AC
  32. #define DP_PHY_STATUS 0x00C0
  33. /* Tx registers */
  34. #define QSERDES_TX0_OFFSET 0x0400
  35. #define QSERDES_TX1_OFFSET 0x0800
  36. #define TXn_BIST_MODE_LANENO 0x0000
  37. #define TXn_CLKBUF_ENABLE 0x0008
  38. #define TXn_TX_EMP_POST1_LVL 0x000C
  39. #define TXn_TX_DRV_LVL 0x001C
  40. #define TXn_RESET_TSYNC_EN 0x0024
  41. #define TXn_PRE_STALL_LDO_BOOST_EN 0x0028
  42. #define TXn_TX_BAND 0x002C
  43. #define TXn_SLEW_CNTL 0x0030
  44. #define TXn_INTERFACE_SELECT 0x0034
  45. #define TXn_RES_CODE_LANE_TX 0x003C
  46. #define TXn_RES_CODE_LANE_RX 0x0040
  47. #define TXn_RES_CODE_LANE_OFFSET_TX 0x0044
  48. #define TXn_RES_CODE_LANE_OFFSET_RX 0x0048
  49. #define TXn_DEBUG_BUS_SEL 0x0058
  50. #define TXn_TRANSCEIVER_BIAS_EN 0x005C
  51. #define TXn_HIGHZ_DRVR_EN 0x0060
  52. #define TXn_TX_POL_INV 0x0064
  53. #define TXn_PARRATE_REC_DETECT_IDLE_EN 0x0068
  54. #define TXn_LANE_MODE_1 0x008C
  55. #define TXn_TRAN_DRVR_EMP_EN 0x00C0
  56. #define TXn_TX_INTERFACE_MODE 0x00C4
  57. #define TXn_VMODE_CTRL1 0x00F0
  58. /* PLL register offset */
  59. #define QSERDES_COM_ATB_SEL1 0x0000
  60. #define QSERDES_COM_ATB_SEL2 0x0004
  61. #define QSERDES_COM_FREQ_UPDATE 0x0008
  62. #define QSERDES_COM_BG_TIMER 0x000C
  63. #define QSERDES_COM_SSC_EN_CENTER 0x0010
  64. #define QSERDES_COM_SSC_ADJ_PER1 0x0014
  65. #define QSERDES_COM_SSC_ADJ_PER2 0x0018
  66. #define QSERDES_COM_SSC_PER1 0x001C
  67. #define QSERDES_COM_SSC_PER2 0x0020
  68. #define QSERDES_COM_SSC_STEP_SIZE1 0x0024
  69. #define QSERDES_COM_SSC_STEP_SIZE2 0x0028
  70. #define QSERDES_COM_POST_DIV 0x002C
  71. #define QSERDES_COM_POST_DIV_MUX 0x0030
  72. #define QSERDES_COM_BIAS_EN_CLKBUFLR_EN 0x0034
  73. #define QSERDES_COM_CLK_ENABLE1 0x0038
  74. #define QSERDES_COM_SYS_CLK_CTRL 0x003C
  75. #define QSERDES_COM_SYSCLK_BUF_ENABLE 0x0040
  76. #define QSERDES_COM_PLL_EN 0x0044
  77. #define QSERDES_COM_PLL_IVCO 0x0048
  78. #define QSERDES_COM_LOCK_CMP1_MODE0 0x004C
  79. #define QSERDES_COM_LOCK_CMP2_MODE0 0x0050
  80. #define QSERDES_COM_LOCK_CMP3_MODE0 0x0054
  81. #define QSERDES_COM_CP_CTRL_MODE0 0x0078
  82. #define QSERDES_COM_CP_CTRL_MODE1 0x007C
  83. #define QSERDES_COM_PLL_RCTRL_MODE0 0x0084
  84. #define QSERDES_COM_PLL_CCTRL_MODE0 0x0090
  85. #define QSERDES_COM_PLL_CNTRL 0x009C
  86. #define QSERDES_COM_SYSCLK_EN_SEL 0x00AC
  87. #define QSERDES_COM_CML_SYSCLK_SEL 0x00B0
  88. #define QSERDES_COM_RESETSM_CNTRL 0x00B4
  89. #define QSERDES_COM_RESETSM_CNTRL2 0x00B8
  90. #define QSERDES_COM_LOCK_CMP_EN 0x00C8
  91. #define QSERDES_COM_LOCK_CMP_CFG 0x00CC
  92. #define QSERDES_COM_DEC_START_MODE0 0x00D0
  93. #define QSERDES_COM_DEC_START_MODE1 0x00D4
  94. #define QSERDES_COM_DIV_FRAC_START1_MODE0 0x00DC
  95. #define QSERDES_COM_DIV_FRAC_START2_MODE0 0x00E0
  96. #define QSERDES_COM_DIV_FRAC_START3_MODE0 0x00E4
  97. #define QSERDES_COM_INTEGLOOP_GAIN0_MODE0 0x0108
  98. #define QSERDES_COM_INTEGLOOP_GAIN1_MODE0 0x010C
  99. #define QSERDES_COM_VCO_TUNE_CTRL 0x0124
  100. #define QSERDES_COM_VCO_TUNE_MAP 0x0128
  101. #define QSERDES_COM_VCO_TUNE1_MODE0 0x012C
  102. #define QSERDES_COM_VCO_TUNE2_MODE0 0x0130
  103. #define QSERDES_COM_CMN_STATUS 0x015C
  104. #define QSERDES_COM_RESET_SM_STATUS 0x0160
  105. #define QSERDES_COM_BG_CTRL 0x0170
  106. #define QSERDES_COM_CLK_SELECT 0x0174
  107. #define QSERDES_COM_HSCLK_SEL 0x0178
  108. #define QSERDES_COM_CORECLK_DIV 0x0184
  109. #define QSERDES_COM_SW_RESET 0x0188
  110. #define QSERDES_COM_CORE_CLK_EN 0x018C
  111. #define QSERDES_COM_C_READY_STATUS 0x0190
  112. #define QSERDES_COM_CMN_CONFIG 0x0194
  113. #define QSERDES_COM_SVS_MODE_CLK_SEL 0x019C
  114. #define DP_PLL_POLL_SLEEP_US 500
  115. #define DP_PLL_POLL_TIMEOUT_US 10000
  116. #define DP_PHY_POLL_SLEEP_US 500
  117. #define DP_PHY_POLL_TIMEOUT_US 10000
  118. #define DP_VCO_RATE_8100MHZDIV1000 8100000UL
  119. #define DP_VCO_RATE_10800MHZDIV1000 10800000UL
  120. #define DP_VCO_HSCLK_RATE_1620MHZDIV1000 1620000UL
  121. #define DP_VCO_HSCLK_RATE_2700MHZDIV1000 2700000UL
  122. #define DP_VCO_HSCLK_RATE_5400MHZDIV1000 5400000UL
  123. struct dp_pll_db {
  124. struct mdss_pll_resources *pll;
  125. /* lane and orientation settings */
  126. u8 lane_cnt;
  127. u8 orientation;
  128. /* COM PHY settings */
  129. u32 hsclk_sel;
  130. u32 dec_start_mode0;
  131. u32 div_frac_start1_mode0;
  132. u32 div_frac_start2_mode0;
  133. u32 div_frac_start3_mode0;
  134. u32 lock_cmp1_mode0;
  135. u32 lock_cmp2_mode0;
  136. u32 lock_cmp3_mode0;
  137. /* PHY vco divider */
  138. u32 phy_vco_div;
  139. /* TX settings */
  140. u32 lane_mode_1;
  141. };
  142. int dp_vco_set_rate_14nm(struct clk_hw *hw, unsigned long rate,
  143. unsigned long parent_rate);
  144. unsigned long dp_vco_recalc_rate_14nm(struct clk_hw *hw,
  145. unsigned long parent_rate);
  146. long dp_vco_round_rate_14nm(struct clk_hw *hw, unsigned long rate,
  147. unsigned long *parent_rate);
  148. int dp_vco_prepare_14nm(struct clk_hw *hw);
  149. void dp_vco_unprepare_14nm(struct clk_hw *hw);
  150. int dp_mux_set_parent_14nm(void *context,
  151. unsigned int reg, unsigned int val);
  152. int dp_mux_get_parent_14nm(void *context,
  153. unsigned int reg, unsigned int *val);
  154. #endif /* __MDSS_DP_PLL_14NM_H */