1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (C) 2020 Marvell International Ltd.
5 * Functions for RGMII/GMII/MII initialization, configuration,
9 #ifndef __CVMX_HELPER_RGMII_H__
10 #define __CVMX_HELPER_RGMII_H__
14 * Probe RGMII ports and determine the number present
16 * @param xiface Interface to probe
18 * Return: Number of RGMII/GMII/MII ports (0-4).
20 int __cvmx_helper_rgmii_probe(int xiface);
23 * Put an RGMII interface in loopback mode. Internal packets sent
24 * out will be received back again on the same port. Externally
25 * received packets will echo back out.
27 * @param port IPD port number to loop.
29 void cvmx_helper_rgmii_internal_loopback(int port);
33 * Configure all of the ASX, GMX, and PKO regsiters required
34 * to get RGMII to function on the supplied interface.
36 * @param xiface PKO Interface to configure (0 or 1)
38 * Return: Zero on success
40 int __cvmx_helper_rgmii_enable(int xiface);
44 * Return the link state of an IPD/PKO port as returned by
45 * auto negotiation. The result of this function may not match
46 * Octeon's link config if auto negotiation has changed since
47 * the last call to cvmx_helper_link_set().
49 * @param ipd_port IPD/PKO port to query
53 cvmx_helper_link_info_t __cvmx_helper_gmii_link_get(int ipd_port);
57 * Return the link state of an IPD/PKO port as returned by
58 * auto negotiation. The result of this function may not match
59 * Octeon's link config if auto negotiation has changed since
60 * the last call to cvmx_helper_link_set().
62 * @param ipd_port IPD/PKO port to query
66 cvmx_helper_link_info_t __cvmx_helper_rgmii_link_get(int ipd_port);
70 * Configure an IPD/PKO port for the specified link state. This
71 * function does not influence auto negotiation at the PHY level.
72 * The passed link state must always match the link state returned
73 * by cvmx_helper_link_get(). It is normally best to use
74 * cvmx_helper_link_autoconf() instead.
76 * @param ipd_port IPD/PKO port to configure
77 * @param link_info The new link state
79 * Return: Zero on success, negative on failure
81 int __cvmx_helper_rgmii_link_set(int ipd_port, cvmx_helper_link_info_t link_info);
85 * Configure a port for internal and/or external loopback. Internal loopback
86 * causes packets sent by the port to be received by Octeon. External loopback
87 * causes packets received from the wire to sent out again.
89 * @param ipd_port IPD/PKO port to loopback.
90 * @param enable_internal
91 * Non zero if you want internal loopback
92 * @param enable_external
93 * Non zero if you want external loopback
95 * Return: Zero on success, negative on failure.
97 int __cvmx_helper_rgmii_configure_loopback(int ipd_port, int enable_internal, int enable_external);