cvmx-helper-rgmii.h revision 210286
190792Sgshapiro/***********************license start*************** 2261370Sgshapiro * Copyright (c) 2003-2008 Cavium Networks (support@cavium.com). All rights 390792Sgshapiro * reserved. 490792Sgshapiro * 590792Sgshapiro * 690792Sgshapiro * Redistribution and use in source and binary forms, with or without 790792Sgshapiro * modification, are permitted provided that the following conditions are 890792Sgshapiro * met: 990792Sgshapiro * 1090792Sgshapiro * * Redistributions of source code must retain the above copyright 11266711Sgshapiro * notice, this list of conditions and the following disclaimer. 1290792Sgshapiro * 1390792Sgshapiro * * Redistributions in binary form must reproduce the above 1490792Sgshapiro * copyright notice, this list of conditions and the following 1590792Sgshapiro * disclaimer in the documentation and/or other materials provided 1690792Sgshapiro * with the distribution. 1790792Sgshapiro * 1890792Sgshapiro * * Neither the name of Cavium Networks nor the names of 1990792Sgshapiro * its contributors may be used to endorse or promote products 2090792Sgshapiro * derived from this software without specific prior written 2190792Sgshapiro * permission. 2290792Sgshapiro * 2390792Sgshapiro * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" 2490792Sgshapiro * AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS 2590792Sgshapiro * OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH 2690792Sgshapiro * RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY 2790792Sgshapiro * REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT 2890792Sgshapiro * DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES 2990792Sgshapiro * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR 3090792Sgshapiro * PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET 3190792Sgshapiro * POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT 3290792Sgshapiro * OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU. 3390792Sgshapiro * 3490792Sgshapiro * 3590792Sgshapiro * For any questions regarding licensing please contact marketing@caviumnetworks.com 3690792Sgshapiro * 3790792Sgshapiro ***********************license end**************************************/ 3890792Sgshapiro 3990792Sgshapiro 4090792Sgshapiro 4190792Sgshapiro 4290792Sgshapiro 4390792Sgshapiro 4490792Sgshapiro/** 4590792Sgshapiro * @file 4690792Sgshapiro * 4790792Sgshapiro * Functions for RGMII/GMII/MII initialization, configuration, 4890792Sgshapiro * and monitoring. 4990792Sgshapiro * 5090792Sgshapiro * <hr>$Revision: 41586 $<hr> 5190792Sgshapiro */ 5290792Sgshapiro#ifndef __CVMX_HELPER_RGMII_H__ 5390792Sgshapiro#define __CVMX_HELPER_RGMII_H__ 5490792Sgshapiro 5590792Sgshapiro/** 5690792Sgshapiro * @INTERNAL 5790792Sgshapiro * Probe RGMII ports and determine the number present 5890792Sgshapiro * 5990792Sgshapiro * @param interface Interface to probe 6090792Sgshapiro * 6190792Sgshapiro * @return Number of RGMII/GMII/MII ports (0-4). 6290792Sgshapiro */ 6390792Sgshapiroextern int __cvmx_helper_rgmii_probe(int interface); 6490792Sgshapiro 6590792Sgshapiro/** 6690792Sgshapiro * Put an RGMII interface in loopback mode. Internal packets sent 6790792Sgshapiro * out will be received back again on the same port. Externally 6890792Sgshapiro * received packets will echo back out. 6990792Sgshapiro * 7090792Sgshapiro * @param port IPD port number to loop. 7190792Sgshapiro */ 7290792Sgshapiroextern void cvmx_helper_rgmii_internal_loopback(int port); 7390792Sgshapiro 7490792Sgshapiro/** 7590792Sgshapiro * @INTERNAL 7690792Sgshapiro * Configure all of the ASX, GMX, and PKO regsiters required 7790792Sgshapiro * to get RGMII to function on the supplied interface. 7890792Sgshapiro * 7990792Sgshapiro * @param interface PKO Interface to configure (0 or 1) 8090792Sgshapiro * 8190792Sgshapiro * @return Zero on success 8290792Sgshapiro */ 8390792Sgshapiroextern int __cvmx_helper_rgmii_enable(int interface); 8490792Sgshapiro 8590792Sgshapiro/** 8690792Sgshapiro * @INTERNAL 8790792Sgshapiro * Return the link state of an IPD/PKO port as returned by 8890792Sgshapiro * auto negotiation. The result of this function may not match 8990792Sgshapiro * Octeon's link config if auto negotiation has changed since 9090792Sgshapiro * the last call to cvmx_helper_link_set(). 9190792Sgshapiro * 9290792Sgshapiro * @param ipd_port IPD/PKO port to query 9390792Sgshapiro * 9490792Sgshapiro * @return Link state 9590792Sgshapiro */ 9690792Sgshapiroextern cvmx_helper_link_info_t __cvmx_helper_rgmii_link_get(int ipd_port); 9790792Sgshapiro 9890792Sgshapiro/** 9990792Sgshapiro * @INTERNAL 10090792Sgshapiro * Configure an IPD/PKO port for the specified link state. This 10190792Sgshapiro * function does not influence auto negotiation at the PHY level. 10290792Sgshapiro * The passed link state must always match the link state returned 10390792Sgshapiro * by cvmx_helper_link_get(). It is normally best to use 10490792Sgshapiro * cvmx_helper_link_autoconf() instead. 10590792Sgshapiro * 10690792Sgshapiro * @param ipd_port IPD/PKO port to configure 10790792Sgshapiro * @param link_info The new link state 10890792Sgshapiro * 10990792Sgshapiro * @return Zero on success, negative on failure 11090792Sgshapiro */ 11190792Sgshapiroextern int __cvmx_helper_rgmii_link_set(int ipd_port, cvmx_helper_link_info_t link_info); 11290792Sgshapiro 11390792Sgshapiro/** 11490792Sgshapiro * @INTERNAL 11590792Sgshapiro * Configure a port for internal and/or external loopback. Internal loopback 11690792Sgshapiro * causes packets sent by the port to be received by Octeon. External loopback 11790792Sgshapiro * causes packets received from the wire to sent out again. 11890792Sgshapiro * 11990792Sgshapiro * @param ipd_port IPD/PKO port to loopback. 12090792Sgshapiro * @param enable_internal 12190792Sgshapiro * Non zero if you want internal loopback 12290792Sgshapiro * @param enable_external 12390792Sgshapiro * Non zero if you want external loopback 12490792Sgshapiro * 12590792Sgshapiro * @return Zero on success, negative on failure. 12690792Sgshapiro */ 12790792Sgshapiroextern int __cvmx_helper_rgmii_configure_loopback(int ipd_port, int enable_internal, int enable_external); 12890792Sgshapiro 12990792Sgshapiro#endif 13090792Sgshapiro