1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (C) 2020 Marvell International Ltd.
4  *
5  * Functions for SRIO initialization, configuration,
6  * and monitoring.
7  */
8 
9 #ifndef __CVMX_HELPER_SRIO_H__
10 #define __CVMX_HELPER_SRIO_H__
11 
12 /**
13  * @INTERNAL
14  * Convert interface number to sRIO link number
15  * per SoC model.
16  *
17  * @param xiface Interface to convert
18  *
19  * @return Srio link number
20  */
21 int __cvmx_helper_srio_port(int xiface);
22 
23 /**
24  * @INTERNAL
25  * Probe a SRIO interface and determine the number of ports
26  * connected to it. The SRIO interface should still be down after
27  * this call.
28  *
29  * @param xiface Interface to probe
30  *
31  * @return Number of ports on the interface. Zero to disable.
32  */
33 int __cvmx_helper_srio_probe(int xiface);
34 
35 /**
36  * @INTERNAL
37  * Bringup and enable a SRIO interface. After this call packet
38  * I/O should be fully functional. This is called with IPD
39  * enabled but PKO disabled.
40  *
41  * @param xiface Interface to bring up
42  *
43  * @return Zero on success, negative on failure
44  */
45 int __cvmx_helper_srio_enable(int xiface);
46 
47 /**
48  * @INTERNAL
49  * Return the link state of an IPD/PKO port as returned by SRIO link status.
50  *
51  * @param ipd_port IPD/PKO port to query
52  *
53  * @return Link state
54  */
55 cvmx_helper_link_info_t __cvmx_helper_srio_link_get(int ipd_port);
56 
57 /**
58  * @INTERNAL
59  * Configure an IPD/PKO port for the specified link state. This
60  * function does not influence auto negotiation at the PHY level.
61  * The passed link state must always match the link state returned
62  * by cvmx_helper_link_get(). It is normally best to use
63  * cvmx_helper_link_autoconf() instead.
64  *
65  * @param ipd_port  IPD/PKO port to configure
66  * @param link_info The new link state
67  *
68  * @return Zero on success, negative on failure
69  */
70 int __cvmx_helper_srio_link_set(int ipd_port, cvmx_helper_link_info_t link_info);
71 
72 #endif
73