cvmx-helper-spi.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (C) 2020 Marvell International Ltd.
  4. *
  5. * Functions for SPI initialization, configuration,
  6. * and monitoring.
  7. */
  8. #ifndef __CVMX_HELPER_SPI_H__
  9. #define __CVMX_HELPER_SPI_H__
  10. #include "cvmx-helper.h"
  11. /**
  12. * @INTERNAL
  13. * Probe a SPI interface and determine the number of ports
  14. * connected to it. The SPI interface should still be down after
  15. * this call.
  16. *
  17. * @param interface Interface to probe
  18. *
  19. * Return: Number of ports on the interface. Zero to disable.
  20. */
  21. int __cvmx_helper_spi_probe(int interface);
  22. int __cvmx_helper_spi_enumerate(int interface);
  23. /**
  24. * @INTERNAL
  25. * Bringup and enable a SPI interface. After this call packet I/O
  26. * should be fully functional. This is called with IPD enabled but
  27. * PKO disabled.
  28. *
  29. * @param interface Interface to bring up
  30. *
  31. * Return: Zero on success, negative on failure
  32. */
  33. int __cvmx_helper_spi_enable(int interface);
  34. /**
  35. * @INTERNAL
  36. * Return the link state of an IPD/PKO port as returned by
  37. * auto negotiation. The result of this function may not match
  38. * Octeon's link config if auto negotiation has changed since
  39. * the last call to cvmx_helper_link_set().
  40. *
  41. * @param ipd_port IPD/PKO port to query
  42. *
  43. * Return: Link state
  44. */
  45. cvmx_helper_link_info_t __cvmx_helper_spi_link_get(int ipd_port);
  46. /**
  47. * @INTERNAL
  48. * Configure an IPD/PKO port for the specified link state. This
  49. * function does not influence auto negotiation at the PHY level.
  50. * The passed link state must always match the link state returned
  51. * by cvmx_helper_link_get(). It is normally best to use
  52. * cvmx_helper_link_autoconf() instead.
  53. *
  54. * @param ipd_port IPD/PKO port to configure
  55. * @param link_info The new link state
  56. *
  57. * Return: Zero on success, negative on failure
  58. */
  59. int __cvmx_helper_spi_link_set(int ipd_port, cvmx_helper_link_info_t link_info);
  60. /**
  61. * Sets the spi timeout in config data
  62. * @param timeout value
  63. */
  64. void cvmx_spi_config_set_timeout(int timeout);
  65. #endif