Back to home page

OSCL-LXR

 
 

    


0001 /***********************license start***************
0002  * Author: Cavium Networks
0003  *
0004  * Contact: support@caviumnetworks.com
0005  * This file is part of the OCTEON SDK
0006  *
0007  * Copyright (c) 2003-2008 Cavium Networks
0008  *
0009  * This file is free software; you can redistribute it and/or modify
0010  * it under the terms of the GNU General Public License, Version 2, as
0011  * published by the Free Software Foundation.
0012  *
0013  * This file is distributed in the hope that it will be useful, but
0014  * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
0015  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
0016  * NONINFRINGEMENT.  See the GNU General Public License for more
0017  * details.
0018  *
0019  * You should have received a copy of the GNU General Public License
0020  * along with this file; if not, write to the Free Software
0021  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
0022  * or visit http://www.gnu.org/licenses/.
0023  *
0024  * This file may also be available under a different license from Cavium.
0025  * Contact Cavium Networks for more information
0026  ***********************license end**************************************/
0027 
0028 /**
0029  * @file
0030  *
0031  * Functions for RGMII/GMII/MII initialization, configuration,
0032  * and monitoring.
0033  *
0034  */
0035 #ifndef __CVMX_HELPER_RGMII_H__
0036 #define __CVMX_HELPER_RGMII_H__
0037 
0038 /**
0039  * Probe RGMII ports and determine the number present
0040  *
0041  * @interface: Interface to probe
0042  *
0043  * Returns Number of RGMII/GMII/MII ports (0-4).
0044  */
0045 extern int __cvmx_helper_rgmii_probe(int interface);
0046 #define __cvmx_helper_rgmii_enumerate __cvmx_helper_rgmii_probe
0047 
0048 /**
0049  * Put an RGMII interface in loopback mode. Internal packets sent
0050  * out will be received back again on the same port. Externally
0051  * received packets will echo back out.
0052  *
0053  * @port:   IPD port number to loop.
0054  */
0055 extern void cvmx_helper_rgmii_internal_loopback(int port);
0056 
0057 /**
0058  * Configure all of the ASX, GMX, and PKO registers required
0059  * to get RGMII to function on the supplied interface.
0060  *
0061  * @interface: PKO Interface to configure (0 or 1)
0062  *
0063  * Returns Zero on success
0064  */
0065 extern int __cvmx_helper_rgmii_enable(int interface);
0066 
0067 /**
0068  * Return the link state of an IPD/PKO port as returned by
0069  * auto negotiation. The result of this function may not match
0070  * Octeon's link config if auto negotiation has changed since
0071  * the last call to cvmx_helper_link_set().
0072  *
0073  * @ipd_port: IPD/PKO port to query
0074  *
0075  * Returns Link state
0076  */
0077 extern union cvmx_helper_link_info __cvmx_helper_rgmii_link_get(int ipd_port);
0078 
0079 /**
0080  * Configure an IPD/PKO port for the specified link state. This
0081  * function does not influence auto negotiation at the PHY level.
0082  * The passed link state must always match the link state returned
0083  * by cvmx_helper_link_get().
0084  *
0085  * @ipd_port:  IPD/PKO port to configure
0086  * @link_info: The new link state
0087  *
0088  * Returns Zero on success, negative on failure
0089  */
0090 extern int __cvmx_helper_rgmii_link_set(int ipd_port,
0091                     union cvmx_helper_link_info link_info);
0092 
0093 #endif