blob: 1adc6f70666b46fd72caecf5e932149955c8ec24 [file] [log] [blame]
Aaron Williams3bda89d2020-12-11 17:05:24 +01001/* 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
9#ifndef __CVMX_HELPER_SPI_H__
10#define __CVMX_HELPER_SPI_H__
11
12#include "cvmx-helper.h"
13
14/**
15 * @INTERNAL
16 * Probe a SPI interface and determine the number of ports
17 * connected to it. The SPI interface should still be down after
18 * this call.
19 *
20 * @param interface Interface to probe
21 *
Heinrich Schuchardt47b4c022022-01-19 18:05:50 +010022 * Return: Number of ports on the interface. Zero to disable.
Aaron Williams3bda89d2020-12-11 17:05:24 +010023 */
24int __cvmx_helper_spi_probe(int interface);
25int __cvmx_helper_spi_enumerate(int interface);
26
27/**
28 * @INTERNAL
29 * Bringup and enable a SPI interface. After this call packet I/O
30 * should be fully functional. This is called with IPD enabled but
31 * PKO disabled.
32 *
33 * @param interface Interface to bring up
34 *
Heinrich Schuchardt47b4c022022-01-19 18:05:50 +010035 * Return: Zero on success, negative on failure
Aaron Williams3bda89d2020-12-11 17:05:24 +010036 */
37int __cvmx_helper_spi_enable(int interface);
38
39/**
40 * @INTERNAL
41 * Return the link state of an IPD/PKO port as returned by
42 * auto negotiation. The result of this function may not match
43 * Octeon's link config if auto negotiation has changed since
44 * the last call to cvmx_helper_link_set().
45 *
46 * @param ipd_port IPD/PKO port to query
47 *
Heinrich Schuchardt47b4c022022-01-19 18:05:50 +010048 * Return: Link state
Aaron Williams3bda89d2020-12-11 17:05:24 +010049 */
50cvmx_helper_link_info_t __cvmx_helper_spi_link_get(int ipd_port);
51
52/**
53 * @INTERNAL
54 * Configure an IPD/PKO port for the specified link state. This
55 * function does not influence auto negotiation at the PHY level.
56 * The passed link state must always match the link state returned
57 * by cvmx_helper_link_get(). It is normally best to use
58 * cvmx_helper_link_autoconf() instead.
59 *
60 * @param ipd_port IPD/PKO port to configure
61 * @param link_info The new link state
62 *
Heinrich Schuchardt47b4c022022-01-19 18:05:50 +010063 * Return: Zero on success, negative on failure
Aaron Williams3bda89d2020-12-11 17:05:24 +010064 */
65int __cvmx_helper_spi_link_set(int ipd_port, cvmx_helper_link_info_t link_info);
66
67/**
68 * Sets the spi timeout in config data
69 * @param timeout value
70 */
71void cvmx_spi_config_set_timeout(int timeout);
72
73#endif