cvmx-helper-sgmii.h revision 210284
1210284Sjmallett/***********************license start***************
2210284Sjmallett *  Copyright (c) 2003-2008 Cavium Networks (support@cavium.com). All rights
3210284Sjmallett *  reserved.
4210284Sjmallett *
5210284Sjmallett *
6210284Sjmallett *  Redistribution and use in source and binary forms, with or without
7210284Sjmallett *  modification, are permitted provided that the following conditions are
8210284Sjmallett *  met:
9210284Sjmallett *
10210284Sjmallett *      * Redistributions of source code must retain the above copyright
11210284Sjmallett *        notice, this list of conditions and the following disclaimer.
12210284Sjmallett *
13210284Sjmallett *      * Redistributions in binary form must reproduce the above
14210284Sjmallett *        copyright notice, this list of conditions and the following
15210284Sjmallett *        disclaimer in the documentation and/or other materials provided
16210284Sjmallett *        with the distribution.
17210284Sjmallett *
18210284Sjmallett *      * Neither the name of Cavium Networks nor the names of
19210284Sjmallett *        its contributors may be used to endorse or promote products
20210284Sjmallett *        derived from this software without specific prior written
21210284Sjmallett *        permission.
22210284Sjmallett *
23210284Sjmallett *  TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
24210284Sjmallett *  AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS
25210284Sjmallett *  OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
26210284Sjmallett *  RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
27210284Sjmallett *  REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
28210284Sjmallett *  DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES
29210284Sjmallett *  OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR
30210284Sjmallett *  PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET
31210284Sjmallett *  POSSESSION OR CORRESPONDENCE TO DESCRIPTION.  THE ENTIRE RISK ARISING OUT
32210284Sjmallett *  OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
33210284Sjmallett *
34210284Sjmallett *
35210284Sjmallett *  For any questions regarding licensing please contact marketing@caviumnetworks.com
36210284Sjmallett *
37210284Sjmallett ***********************license end**************************************/
38210284Sjmallett
39210284Sjmallett
40210284Sjmallett
41210284Sjmallett
42210284Sjmallett
43210284Sjmallett
44210284Sjmallett/**
45210284Sjmallett * @file
46210284Sjmallett *
47210284Sjmallett * Functions for SGMII initialization, configuration,
48210284Sjmallett * and monitoring.
49210284Sjmallett *
50210284Sjmallett * <hr>$Revision: 41586 $<hr>
51210284Sjmallett */
52210284Sjmallett#ifndef __CVMX_HELPER_SGMII_H__
53210284Sjmallett#define __CVMX_HELPER_SGMII_H__
54210284Sjmallett
55210284Sjmallett/**
56210284Sjmallett * @INTERNAL
57210284Sjmallett * Probe a SGMII interface and determine the number of ports
58210284Sjmallett * connected to it. The SGMII interface should still be down after
59210284Sjmallett * this call.
60210284Sjmallett *
61210284Sjmallett * @param interface Interface to probe
62210284Sjmallett *
63210284Sjmallett * @return Number of ports on the interface. Zero to disable.
64210284Sjmallett */
65210284Sjmallettextern int __cvmx_helper_sgmii_probe(int interface);
66210284Sjmallett
67210284Sjmallett/**
68210284Sjmallett * @INTERNAL
69210284Sjmallett * Bringup and enable a SGMII interface. After this call packet
70210284Sjmallett * I/O should be fully functional. This is called with IPD
71210284Sjmallett * enabled but PKO disabled.
72210284Sjmallett *
73210284Sjmallett * @param interface Interface to bring up
74210284Sjmallett *
75210284Sjmallett * @return Zero on success, negative on failure
76210284Sjmallett */
77210284Sjmallettextern int __cvmx_helper_sgmii_enable(int interface);
78210284Sjmallett
79210284Sjmallett/**
80210284Sjmallett * @INTERNAL
81210284Sjmallett * Return the link state of an IPD/PKO port as returned by
82210284Sjmallett * auto negotiation. The result of this function may not match
83210284Sjmallett * Octeon's link config if auto negotiation has changed since
84210284Sjmallett * the last call to cvmx_helper_link_set().
85210284Sjmallett *
86210284Sjmallett * @param ipd_port IPD/PKO port to query
87210284Sjmallett *
88210284Sjmallett * @return Link state
89210284Sjmallett */
90210284Sjmallettextern cvmx_helper_link_info_t __cvmx_helper_sgmii_link_get(int ipd_port);
91210284Sjmallett
92210284Sjmallett/**
93210284Sjmallett * @INTERNAL
94210284Sjmallett * Configure an IPD/PKO port for the specified link state. This
95210284Sjmallett * function does not influence auto negotiation at the PHY level.
96210284Sjmallett * The passed link state must always match the link state returned
97210284Sjmallett * by cvmx_helper_link_get(). It is normally best to use
98210284Sjmallett * cvmx_helper_link_autoconf() instead.
99210284Sjmallett *
100210284Sjmallett * @param ipd_port  IPD/PKO port to configure
101210284Sjmallett * @param link_info The new link state
102210284Sjmallett *
103210284Sjmallett * @return Zero on success, negative on failure
104210284Sjmallett */
105210284Sjmallettextern int __cvmx_helper_sgmii_link_set(int ipd_port, cvmx_helper_link_info_t link_info);
106210284Sjmallett
107210284Sjmallett/**
108210284Sjmallett * @INTERNAL
109210284Sjmallett * Configure a port for internal and/or external loopback. Internal loopback
110210284Sjmallett * causes packets sent by the port to be received by Octeon. External loopback
111210284Sjmallett * causes packets received from the wire to sent out again.
112210284Sjmallett *
113210284Sjmallett * @param ipd_port IPD/PKO port to loopback.
114210284Sjmallett * @param enable_internal
115210284Sjmallett *                 Non zero if you want internal loopback
116210284Sjmallett * @param enable_external
117210284Sjmallett *                 Non zero if you want external loopback
118210284Sjmallett *
119210284Sjmallett * @return Zero on success, negative on failure.
120210284Sjmallett */
121210284Sjmallettextern int __cvmx_helper_sgmii_configure_loopback(int ipd_port, int enable_internal, int enable_external);
122210284Sjmallett
123210284Sjmallett#endif
124