xref: /OK3568_Linux_fs/kernel/arch/mips/include/asm/octeon/cvmx-helper-rgmii.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /***********************license start***************
2*4882a593Smuzhiyun  * Author: Cavium Networks
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * Contact: support@caviumnetworks.com
5*4882a593Smuzhiyun  * This file is part of the OCTEON SDK
6*4882a593Smuzhiyun  *
7*4882a593Smuzhiyun  * Copyright (c) 2003-2008 Cavium Networks
8*4882a593Smuzhiyun  *
9*4882a593Smuzhiyun  * This file is free software; you can redistribute it and/or modify
10*4882a593Smuzhiyun  * it under the terms of the GNU General Public License, Version 2, as
11*4882a593Smuzhiyun  * published by the Free Software Foundation.
12*4882a593Smuzhiyun  *
13*4882a593Smuzhiyun  * This file is distributed in the hope that it will be useful, but
14*4882a593Smuzhiyun  * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15*4882a593Smuzhiyun  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16*4882a593Smuzhiyun  * NONINFRINGEMENT.  See the GNU General Public License for more
17*4882a593Smuzhiyun  * details.
18*4882a593Smuzhiyun  *
19*4882a593Smuzhiyun  * You should have received a copy of the GNU General Public License
20*4882a593Smuzhiyun  * along with this file; if not, write to the Free Software
21*4882a593Smuzhiyun  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22*4882a593Smuzhiyun  * or visit http://www.gnu.org/licenses/.
23*4882a593Smuzhiyun  *
24*4882a593Smuzhiyun  * This file may also be available under a different license from Cavium.
25*4882a593Smuzhiyun  * Contact Cavium Networks for more information
26*4882a593Smuzhiyun  ***********************license end**************************************/
27*4882a593Smuzhiyun 
28*4882a593Smuzhiyun /**
29*4882a593Smuzhiyun  * @file
30*4882a593Smuzhiyun  *
31*4882a593Smuzhiyun  * Functions for RGMII/GMII/MII initialization, configuration,
32*4882a593Smuzhiyun  * and monitoring.
33*4882a593Smuzhiyun  *
34*4882a593Smuzhiyun  */
35*4882a593Smuzhiyun #ifndef __CVMX_HELPER_RGMII_H__
36*4882a593Smuzhiyun #define __CVMX_HELPER_RGMII_H__
37*4882a593Smuzhiyun 
38*4882a593Smuzhiyun /**
39*4882a593Smuzhiyun  * Probe RGMII ports and determine the number present
40*4882a593Smuzhiyun  *
41*4882a593Smuzhiyun  * @interface: Interface to probe
42*4882a593Smuzhiyun  *
43*4882a593Smuzhiyun  * Returns Number of RGMII/GMII/MII ports (0-4).
44*4882a593Smuzhiyun  */
45*4882a593Smuzhiyun extern int __cvmx_helper_rgmii_probe(int interface);
46*4882a593Smuzhiyun #define __cvmx_helper_rgmii_enumerate __cvmx_helper_rgmii_probe
47*4882a593Smuzhiyun 
48*4882a593Smuzhiyun /**
49*4882a593Smuzhiyun  * Put an RGMII interface in loopback mode. Internal packets sent
50*4882a593Smuzhiyun  * out will be received back again on the same port. Externally
51*4882a593Smuzhiyun  * received packets will echo back out.
52*4882a593Smuzhiyun  *
53*4882a593Smuzhiyun  * @port:   IPD port number to loop.
54*4882a593Smuzhiyun  */
55*4882a593Smuzhiyun extern void cvmx_helper_rgmii_internal_loopback(int port);
56*4882a593Smuzhiyun 
57*4882a593Smuzhiyun /**
58*4882a593Smuzhiyun  * Configure all of the ASX, GMX, and PKO registers required
59*4882a593Smuzhiyun  * to get RGMII to function on the supplied interface.
60*4882a593Smuzhiyun  *
61*4882a593Smuzhiyun  * @interface: PKO Interface to configure (0 or 1)
62*4882a593Smuzhiyun  *
63*4882a593Smuzhiyun  * Returns Zero on success
64*4882a593Smuzhiyun  */
65*4882a593Smuzhiyun extern int __cvmx_helper_rgmii_enable(int interface);
66*4882a593Smuzhiyun 
67*4882a593Smuzhiyun /**
68*4882a593Smuzhiyun  * Return the link state of an IPD/PKO port as returned by
69*4882a593Smuzhiyun  * auto negotiation. The result of this function may not match
70*4882a593Smuzhiyun  * Octeon's link config if auto negotiation has changed since
71*4882a593Smuzhiyun  * the last call to cvmx_helper_link_set().
72*4882a593Smuzhiyun  *
73*4882a593Smuzhiyun  * @ipd_port: IPD/PKO port to query
74*4882a593Smuzhiyun  *
75*4882a593Smuzhiyun  * Returns Link state
76*4882a593Smuzhiyun  */
77*4882a593Smuzhiyun extern union cvmx_helper_link_info __cvmx_helper_rgmii_link_get(int ipd_port);
78*4882a593Smuzhiyun 
79*4882a593Smuzhiyun /**
80*4882a593Smuzhiyun  * Configure an IPD/PKO port for the specified link state. This
81*4882a593Smuzhiyun  * function does not influence auto negotiation at the PHY level.
82*4882a593Smuzhiyun  * The passed link state must always match the link state returned
83*4882a593Smuzhiyun  * by cvmx_helper_link_get().
84*4882a593Smuzhiyun  *
85*4882a593Smuzhiyun  * @ipd_port:  IPD/PKO port to configure
86*4882a593Smuzhiyun  * @link_info: The new link state
87*4882a593Smuzhiyun  *
88*4882a593Smuzhiyun  * Returns Zero on success, negative on failure
89*4882a593Smuzhiyun  */
90*4882a593Smuzhiyun extern int __cvmx_helper_rgmii_link_set(int ipd_port,
91*4882a593Smuzhiyun 					union cvmx_helper_link_info link_info);
92*4882a593Smuzhiyun 
93*4882a593Smuzhiyun #endif
94