blob: 2d9b0bea42bb89670e9cd2da4783380caf746eb1 [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 XAUI initialization, configuration,
6 * and monitoring.
7 */
8
9#ifndef __CVMX_HELPER_XAUI_H__
10#define __CVMX_HELPER_XAUI_H__
11
12/**
13 * @INTERNAL
14 * Probe a XAUI interface and determine the number of ports
15 * connected to it. The XAUI interface should still be down
16 * after this call.
17 *
18 * @param xiface Interface to probe
19 *
Heinrich Schuchardt47b4c022022-01-19 18:05:50 +010020 * Return: Number of ports on the interface. Zero to disable.
Aaron Williams3bda89d2020-12-11 17:05:24 +010021 */
22int __cvmx_helper_xaui_probe(int xiface);
23int __cvmx_helper_xaui_enumerate(int xiface);
24
25/**
26 * @INTERNAL
27 * Bringup and enable a XAUI interface. After this call packet
28 * I/O should be fully functional. This is called with IPD
29 * enabled but PKO disabled.
30 *
31 * @param xiface Interface to bring up
32 *
Heinrich Schuchardt47b4c022022-01-19 18:05:50 +010033 * Return: Zero on success, negative on failure
Aaron Williams3bda89d2020-12-11 17:05:24 +010034 */
35int __cvmx_helper_xaui_enable(int xiface);
36
37/**
38 * Retrain XAUI interface.
39 *
40 * GMX is disabled as part of retraining.
41 * While GMX is disabled, new received packets are dropped.
42 * If GMX was in the middle of recieving a packet when disabled,
43 * that packet will be received before GMX idles.
44 * Transmitted packets are buffered normally, but not sent.
45 * If GMX was in the middle of transmitting a packet when disabled,
46 * that packet will be transmitted before GMX idles.
47 *
48 * @param interface Interface to retrain
49 *
Heinrich Schuchardt47b4c022022-01-19 18:05:50 +010050 * Return: Zero on success, negative on failure
Aaron Williams3bda89d2020-12-11 17:05:24 +010051 */
52int cvmx_helper_xaui_link_retrain(int interface);
53
54/**
55 * Reinitialize XAUI interface. Does a probe without changing the hardware
56 * state.
57 *
58 * @param interface Interface to reinitialize
59 *
Heinrich Schuchardt47b4c022022-01-19 18:05:50 +010060 * Return: 0 on success, negative on failure
Aaron Williams3bda89d2020-12-11 17:05:24 +010061 */
62int cvmx_helper_xaui_link_reinit(int interface);
63
64/**
65 * @INTERNAL
66 * Return the link state of an IPD/PKO port as returned by
67 * auto negotiation. The result of this function may not match
68 * Octeon's link config if auto negotiation has changed since
69 * the last call to cvmx_helper_link_set().
70 *
71 * @param ipd_port IPD/PKO port to query
72 *
Heinrich Schuchardt47b4c022022-01-19 18:05:50 +010073 * Return: Link state
Aaron Williams3bda89d2020-12-11 17:05:24 +010074 */
75cvmx_helper_link_info_t __cvmx_helper_xaui_link_get(int ipd_port);
76
77/**
78 * @INTERNAL
79 * Configure an IPD/PKO port for the specified link state. This
80 * function does not influence auto negotiation at the PHY level.
81 * The passed link state must always match the link state returned
82 * by cvmx_helper_link_get(). It is normally best to use
83 * cvmx_helper_link_autoconf() instead.
84 *
85 * @param ipd_port IPD/PKO port to configure
86 * @param link_info The new link state
87 *
Heinrich Schuchardt47b4c022022-01-19 18:05:50 +010088 * Return: Zero on success, negative on failure
Aaron Williams3bda89d2020-12-11 17:05:24 +010089 */
90int __cvmx_helper_xaui_link_set(int ipd_port, cvmx_helper_link_info_t link_info);
91
92/**
93 * @INTERNAL
94 * Configure a port for internal and/or external loopback. Internal loopback
95 * causes packets sent by the port to be received by Octeon. External loopback
96 * causes packets received from the wire to sent out again.
97 *
98 * @param ipd_port IPD/PKO port to loopback.
99 * @param enable_internal
100 * Non zero if you want internal loopback
101 * @param enable_external
102 * Non zero if you want external loopback
103 *
Heinrich Schuchardt47b4c022022-01-19 18:05:50 +0100104 * Return: Zero on success, negative on failure.
Aaron Williams3bda89d2020-12-11 17:05:24 +0100105 */
106int __cvmx_helper_xaui_configure_loopback(int ipd_port, int enable_internal, int enable_external);
107
108#endif