cvmx-helper-rgmii.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 RGMII/GMII/MII initialization, configuration, 48210284Sjmallett * and monitoring. 49210284Sjmallett * 50210284Sjmallett * <hr>$Revision: 41586 $<hr> 51210284Sjmallett */ 52210284Sjmallett#ifndef __CVMX_HELPER_RGMII_H__ 53210284Sjmallett#define __CVMX_HELPER_RGMII_H__ 54210284Sjmallett 55210284Sjmallett/** 56210284Sjmallett * @INTERNAL 57210284Sjmallett * Probe RGMII ports and determine the number present 58210284Sjmallett * 59210284Sjmallett * @param interface Interface to probe 60210284Sjmallett * 61210284Sjmallett * @return Number of RGMII/GMII/MII ports (0-4). 62210284Sjmallett */ 63210284Sjmallettextern int __cvmx_helper_rgmii_probe(int interface); 64210284Sjmallett 65210284Sjmallett/** 66210284Sjmallett * Put an RGMII interface in loopback mode. Internal packets sent 67210284Sjmallett * out will be received back again on the same port. Externally 68210284Sjmallett * received packets will echo back out. 69210284Sjmallett * 70210284Sjmallett * @param port IPD port number to loop. 71210284Sjmallett */ 72210284Sjmallettextern void cvmx_helper_rgmii_internal_loopback(int port); 73210284Sjmallett 74210284Sjmallett/** 75210284Sjmallett * @INTERNAL 76210284Sjmallett * Configure all of the ASX, GMX, and PKO regsiters required 77210284Sjmallett * to get RGMII to function on the supplied interface. 78210284Sjmallett * 79210284Sjmallett * @param interface PKO Interface to configure (0 or 1) 80210284Sjmallett * 81210284Sjmallett * @return Zero on success 82210284Sjmallett */ 83210284Sjmallettextern int __cvmx_helper_rgmii_enable(int interface); 84210284Sjmallett 85210284Sjmallett/** 86210284Sjmallett * @INTERNAL 87210284Sjmallett * Return the link state of an IPD/PKO port as returned by 88210284Sjmallett * auto negotiation. The result of this function may not match 89210284Sjmallett * Octeon's link config if auto negotiation has changed since 90210284Sjmallett * the last call to cvmx_helper_link_set(). 91210284Sjmallett * 92210284Sjmallett * @param ipd_port IPD/PKO port to query 93210284Sjmallett * 94210284Sjmallett * @return Link state 95210284Sjmallett */ 96210284Sjmallettextern cvmx_helper_link_info_t __cvmx_helper_rgmii_link_get(int ipd_port); 97210284Sjmallett 98210284Sjmallett/** 99210284Sjmallett * @INTERNAL 100210284Sjmallett * Configure an IPD/PKO port for the specified link state. This 101210284Sjmallett * function does not influence auto negotiation at the PHY level. 102210284Sjmallett * The passed link state must always match the link state returned 103210284Sjmallett * by cvmx_helper_link_get(). It is normally best to use 104210284Sjmallett * cvmx_helper_link_autoconf() instead. 105210284Sjmallett * 106210284Sjmallett * @param ipd_port IPD/PKO port to configure 107210284Sjmallett * @param link_info The new link state 108210284Sjmallett * 109210284Sjmallett * @return Zero on success, negative on failure 110210284Sjmallett */ 111210284Sjmallettextern int __cvmx_helper_rgmii_link_set(int ipd_port, cvmx_helper_link_info_t link_info); 112210284Sjmallett 113210284Sjmallett/** 114210284Sjmallett * @INTERNAL 115210284Sjmallett * Configure a port for internal and/or external loopback. Internal loopback 116210284Sjmallett * causes packets sent by the port to be received by Octeon. External loopback 117210284Sjmallett * causes packets received from the wire to sent out again. 118210284Sjmallett * 119210284Sjmallett * @param ipd_port IPD/PKO port to loopback. 120210284Sjmallett * @param enable_internal 121210284Sjmallett * Non zero if you want internal loopback 122210284Sjmallett * @param enable_external 123210284Sjmallett * Non zero if you want external loopback 124210284Sjmallett * 125210284Sjmallett * @return Zero on success, negative on failure. 126210284Sjmallett */ 127210284Sjmallettextern int __cvmx_helper_rgmii_configure_loopback(int ipd_port, int enable_internal, int enable_external); 128210284Sjmallett 129210284Sjmallett#endif 130