cvmx-helper-xaui.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (C) 2020 Marvell International Ltd.
  4. *
  5. * Functions for XAUI initialization, configuration,
  6. * and monitoring.
  7. */
  8. #ifndef __CVMX_HELPER_XAUI_H__
  9. #define __CVMX_HELPER_XAUI_H__
  10. /**
  11. * @INTERNAL
  12. * Probe a XAUI interface and determine the number of ports
  13. * connected to it. The XAUI interface should still be down
  14. * after this call.
  15. *
  16. * @param xiface Interface to probe
  17. *
  18. * Return: Number of ports on the interface. Zero to disable.
  19. */
  20. int __cvmx_helper_xaui_probe(int xiface);
  21. int __cvmx_helper_xaui_enumerate(int xiface);
  22. /**
  23. * @INTERNAL
  24. * Bringup and enable a XAUI interface. After this call packet
  25. * I/O should be fully functional. This is called with IPD
  26. * enabled but PKO disabled.
  27. *
  28. * @param xiface Interface to bring up
  29. *
  30. * Return: Zero on success, negative on failure
  31. */
  32. int __cvmx_helper_xaui_enable(int xiface);
  33. /**
  34. * Retrain XAUI interface.
  35. *
  36. * GMX is disabled as part of retraining.
  37. * While GMX is disabled, new received packets are dropped.
  38. * If GMX was in the middle of recieving a packet when disabled,
  39. * that packet will be received before GMX idles.
  40. * Transmitted packets are buffered normally, but not sent.
  41. * If GMX was in the middle of transmitting a packet when disabled,
  42. * that packet will be transmitted before GMX idles.
  43. *
  44. * @param interface Interface to retrain
  45. *
  46. * Return: Zero on success, negative on failure
  47. */
  48. int cvmx_helper_xaui_link_retrain(int interface);
  49. /**
  50. * Reinitialize XAUI interface. Does a probe without changing the hardware
  51. * state.
  52. *
  53. * @param interface Interface to reinitialize
  54. *
  55. * Return: 0 on success, negative on failure
  56. */
  57. int cvmx_helper_xaui_link_reinit(int interface);
  58. /**
  59. * @INTERNAL
  60. * Return the link state of an IPD/PKO port as returned by
  61. * auto negotiation. The result of this function may not match
  62. * Octeon's link config if auto negotiation has changed since
  63. * the last call to cvmx_helper_link_set().
  64. *
  65. * @param ipd_port IPD/PKO port to query
  66. *
  67. * Return: Link state
  68. */
  69. cvmx_helper_link_info_t __cvmx_helper_xaui_link_get(int ipd_port);
  70. /**
  71. * @INTERNAL
  72. * Configure an IPD/PKO port for the specified link state. This
  73. * function does not influence auto negotiation at the PHY level.
  74. * The passed link state must always match the link state returned
  75. * by cvmx_helper_link_get(). It is normally best to use
  76. * cvmx_helper_link_autoconf() instead.
  77. *
  78. * @param ipd_port IPD/PKO port to configure
  79. * @param link_info The new link state
  80. *
  81. * Return: Zero on success, negative on failure
  82. */
  83. int __cvmx_helper_xaui_link_set(int ipd_port, cvmx_helper_link_info_t link_info);
  84. /**
  85. * @INTERNAL
  86. * Configure a port for internal and/or external loopback. Internal loopback
  87. * causes packets sent by the port to be received by Octeon. External loopback
  88. * causes packets received from the wire to sent out again.
  89. *
  90. * @param ipd_port IPD/PKO port to loopback.
  91. * @param enable_internal
  92. * Non zero if you want internal loopback
  93. * @param enable_external
  94. * Non zero if you want external loopback
  95. *
  96. * Return: Zero on success, negative on failure.
  97. */
  98. int __cvmx_helper_xaui_configure_loopback(int ipd_port, int enable_internal, int enable_external);
  99. #endif