cvmx-helper-sgmii.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (C) 2020 Marvell International Ltd.
  4. *
  5. * Functions for SGMII initialization, configuration,
  6. * and monitoring.
  7. */
  8. #ifndef __CVMX_HELPER_SGMII_H__
  9. #define __CVMX_HELPER_SGMII_H__
  10. /**
  11. * @INTERNAL
  12. * Probe a SGMII interface and determine the number of ports
  13. * connected to it. The SGMII interface should still be down after
  14. * 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_sgmii_probe(int xiface);
  21. int __cvmx_helper_sgmii_enumerate(int xiface);
  22. /**
  23. * @INTERNAL
  24. * Bringup and enable a SGMII 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_sgmii_enable(int xiface);
  33. /**
  34. * @INTERNAL
  35. * Return the link state of an IPD/PKO port as returned by
  36. * auto negotiation. The result of this function may not match
  37. * Octeon's link config if auto negotiation has changed since
  38. * the last call to cvmx_helper_link_set().
  39. *
  40. * @param ipd_port IPD/PKO port to query
  41. *
  42. * Return: Link state
  43. */
  44. cvmx_helper_link_info_t __cvmx_helper_sgmii_link_get(int ipd_port);
  45. /**
  46. * @INTERNAL
  47. * Configure an IPD/PKO port for the specified link state. This
  48. * function does not influence auto negotiation at the PHY level.
  49. * The passed link state must always match the link state returned
  50. * by cvmx_helper_link_get(). It is normally best to use
  51. * cvmx_helper_link_autoconf() instead.
  52. *
  53. * @param ipd_port IPD/PKO port to configure
  54. * @param link_info The new link state
  55. *
  56. * Return: Zero on success, negative on failure
  57. */
  58. int __cvmx_helper_sgmii_link_set(int ipd_port, cvmx_helper_link_info_t link_info);
  59. /**
  60. * @INTERNAL
  61. * Configure a port for internal and/or external loopback. Internal loopback
  62. * causes packets sent by the port to be received by Octeon. External loopback
  63. * causes packets received from the wire to sent out again.
  64. *
  65. * @param ipd_port IPD/PKO port to loopback.
  66. * @param enable_internal
  67. * Non zero if you want internal loopback
  68. * @param enable_external
  69. * Non zero if you want external loopback
  70. *
  71. * Return: Zero on success, negative on failure.
  72. */
  73. int __cvmx_helper_sgmii_configure_loopback(int ipd_port, int enable_internal, int enable_external);
  74. #endif