octeon_qlm.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (C) 2020 Marvell International Ltd.
  4. */
  5. #ifndef __OCTEON_QLM_H__
  6. #define __OCTEON_QLM_H__
  7. /* Reference clock selector values for ref_clk_sel */
  8. #define OCTEON_QLM_REF_CLK_100MHZ 0 /** 100 MHz */
  9. #define OCTEON_QLM_REF_CLK_125MHZ 1 /** 125 MHz */
  10. #define OCTEON_QLM_REF_CLK_156MHZ 2 /** 156.25 MHz */
  11. #define OCTEON_QLM_REF_CLK_161MHZ 3 /** 161.1328125 MHz */
  12. /**
  13. * Configure qlm/dlm speed and mode.
  14. * @param qlm The QLM or DLM to configure
  15. * @param speed The speed the QLM needs to be configured in Mhz.
  16. * @param mode The QLM to be configured as SGMII/XAUI/PCIe.
  17. * @param rc Only used for PCIe, rc = 1 for root complex mode, 0 for EP
  18. * mode.
  19. * @param pcie_mode Only used when qlm/dlm are in pcie mode.
  20. * @param ref_clk_sel Reference clock to use for 70XX where:
  21. * 0: 100MHz
  22. * 1: 125MHz
  23. * 2: 156.25MHz
  24. * 3: 161.1328125MHz (CN73XX and CN78XX only)
  25. * @param ref_clk_input This selects which reference clock input to use. For
  26. * cn70xx:
  27. * 0: DLMC_REF_CLK0
  28. * 1: DLMC_REF_CLK1
  29. * 2: DLM0_REF_CLK
  30. * cn61xx: (not used)
  31. * cn78xx/cn76xx/cn73xx:
  32. * 0: Internal clock (QLM[0-7]_REF_CLK)
  33. * 1: QLMC_REF_CLK0
  34. * 2: QLMC_REF_CLK1
  35. *
  36. * Return: Return 0 on success or -1.
  37. *
  38. * @note When the 161MHz clock is used it can only be used for
  39. * XLAUI mode with a 6316 speed or XFI mode with a 103125 speed.
  40. * This rate is also only supported for CN73XX and CN78XX.
  41. */
  42. int octeon_configure_qlm(int qlm, int speed, int mode, int rc, int pcie_mode, int ref_clk_sel,
  43. int ref_clk_input);
  44. int octeon_configure_qlm_cn78xx(int node, int qlm, int speed, int mode, int rc, int pcie_mode,
  45. int ref_clk_sel, int ref_clk_input);
  46. /**
  47. * Some QLM speeds need to override the default tuning parameters
  48. *
  49. * @param node Node to configure
  50. * @param qlm QLM to configure
  51. * @param baud_mhz Desired speed in MHz
  52. * @param lane Lane the apply the tuning parameters
  53. * @param tx_swing Voltage swing. The higher the value the lower the voltage,
  54. * the default value is 7.
  55. * @param tx_pre pre-cursor pre-emphasis
  56. * @param tx_post post-cursor pre-emphasis.
  57. * @param tx_gain Transmit gain. Range 0-7
  58. * @param tx_vboost Transmit voltage boost. Range 0-1
  59. */
  60. void octeon_qlm_tune_per_lane_v3(int node, int qlm, int baud_mhz, int lane, int tx_swing,
  61. int tx_pre, int tx_post, int tx_gain, int tx_vboost);
  62. /**
  63. * Some QLM speeds need to override the default tuning parameters
  64. *
  65. * @param node Node to configure
  66. * @param qlm QLM to configure
  67. * @param baud_mhz Desired speed in MHz
  68. * @param tx_swing Voltage swing. The higher the value the lower the voltage,
  69. * the default value is 7.
  70. * @param tx_premptap bits [0:3] pre-cursor pre-emphasis, bits[4:8] post-cursor
  71. * pre-emphasis.
  72. * @param tx_gain Transmit gain. Range 0-7
  73. * @param tx_vboost Transmit voltage boost. Range 0-1
  74. */
  75. void octeon_qlm_tune_v3(int node, int qlm, int baud_mhz, int tx_swing, int tx_premptap, int tx_gain,
  76. int tx_vboost);
  77. /**
  78. * Disables DFE for the specified QLM lane(s).
  79. * This function should only be called for low-loss channels.
  80. *
  81. * @param node Node to configure
  82. * @param qlm QLM to configure
  83. * @param lane Lane to configure, or -1 all lanes
  84. * @param baud_mhz The speed the QLM needs to be configured in Mhz.
  85. * @param mode The QLM to be configured as SGMII/XAUI/PCIe.
  86. */
  87. void octeon_qlm_dfe_disable(int node, int qlm, int lane, int baud_mhz, int mode);
  88. /**
  89. * Some QLMs need to override the default pre-ctle for low loss channels.
  90. *
  91. * @param node Node to configure
  92. * @param qlm QLM to configure
  93. * @param pre_ctle pre-ctle settings for low loss channels
  94. */
  95. void octeon_qlm_set_channel_v3(int node, int qlm, int pre_ctle);
  96. void octeon_init_qlm(int node);
  97. int octeon_mcu_probe(int node);
  98. #endif /* __OCTEON_QLM_H__ */