162306a36Sopenharmony_ci/***********************license start*************** 262306a36Sopenharmony_ci * Author: Cavium Networks 362306a36Sopenharmony_ci * 462306a36Sopenharmony_ci * Contact: support@caviumnetworks.com 562306a36Sopenharmony_ci * This file is part of the OCTEON SDK 662306a36Sopenharmony_ci * 762306a36Sopenharmony_ci * Copyright (c) 2003-2008 Cavium Networks 862306a36Sopenharmony_ci * 962306a36Sopenharmony_ci * This file is free software; you can redistribute it and/or modify 1062306a36Sopenharmony_ci * it under the terms of the GNU General Public License, Version 2, as 1162306a36Sopenharmony_ci * published by the Free Software Foundation. 1262306a36Sopenharmony_ci * 1362306a36Sopenharmony_ci * This file is distributed in the hope that it will be useful, but 1462306a36Sopenharmony_ci * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty 1562306a36Sopenharmony_ci * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or 1662306a36Sopenharmony_ci * NONINFRINGEMENT. See the GNU General Public License for more 1762306a36Sopenharmony_ci * details. 1862306a36Sopenharmony_ci * 1962306a36Sopenharmony_ci * You should have received a copy of the GNU General Public License 2062306a36Sopenharmony_ci * along with this file; if not, write to the Free Software 2162306a36Sopenharmony_ci * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 2262306a36Sopenharmony_ci * or visit http://www.gnu.org/licenses/. 2362306a36Sopenharmony_ci * 2462306a36Sopenharmony_ci * This file may also be available under a different license from Cavium. 2562306a36Sopenharmony_ci * Contact Cavium Networks for more information 2662306a36Sopenharmony_ci ***********************license end**************************************/ 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_ci/** 2962306a36Sopenharmony_ci * @file 3062306a36Sopenharmony_ci * 3162306a36Sopenharmony_ci * Functions for RGMII/GMII/MII initialization, configuration, 3262306a36Sopenharmony_ci * and monitoring. 3362306a36Sopenharmony_ci * 3462306a36Sopenharmony_ci */ 3562306a36Sopenharmony_ci#ifndef __CVMX_HELPER_RGMII_H__ 3662306a36Sopenharmony_ci#define __CVMX_HELPER_RGMII_H__ 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_ci/** 3962306a36Sopenharmony_ci * Probe RGMII ports and determine the number present 4062306a36Sopenharmony_ci * 4162306a36Sopenharmony_ci * @interface: Interface to probe 4262306a36Sopenharmony_ci * 4362306a36Sopenharmony_ci * Returns Number of RGMII/GMII/MII ports (0-4). 4462306a36Sopenharmony_ci */ 4562306a36Sopenharmony_ciextern int __cvmx_helper_rgmii_probe(int interface); 4662306a36Sopenharmony_ci#define __cvmx_helper_rgmii_enumerate __cvmx_helper_rgmii_probe 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_ci/** 4962306a36Sopenharmony_ci * Put an RGMII interface in loopback mode. Internal packets sent 5062306a36Sopenharmony_ci * out will be received back again on the same port. Externally 5162306a36Sopenharmony_ci * received packets will echo back out. 5262306a36Sopenharmony_ci * 5362306a36Sopenharmony_ci * @port: IPD port number to loop. 5462306a36Sopenharmony_ci */ 5562306a36Sopenharmony_ciextern void cvmx_helper_rgmii_internal_loopback(int port); 5662306a36Sopenharmony_ci 5762306a36Sopenharmony_ci/** 5862306a36Sopenharmony_ci * Configure all of the ASX, GMX, and PKO registers required 5962306a36Sopenharmony_ci * to get RGMII to function on the supplied interface. 6062306a36Sopenharmony_ci * 6162306a36Sopenharmony_ci * @interface: PKO Interface to configure (0 or 1) 6262306a36Sopenharmony_ci * 6362306a36Sopenharmony_ci * Returns Zero on success 6462306a36Sopenharmony_ci */ 6562306a36Sopenharmony_ciextern int __cvmx_helper_rgmii_enable(int interface); 6662306a36Sopenharmony_ci 6762306a36Sopenharmony_ci/** 6862306a36Sopenharmony_ci * Return the link state of an IPD/PKO port as returned by 6962306a36Sopenharmony_ci * auto negotiation. The result of this function may not match 7062306a36Sopenharmony_ci * Octeon's link config if auto negotiation has changed since 7162306a36Sopenharmony_ci * the last call to cvmx_helper_link_set(). 7262306a36Sopenharmony_ci * 7362306a36Sopenharmony_ci * @ipd_port: IPD/PKO port to query 7462306a36Sopenharmony_ci * 7562306a36Sopenharmony_ci * Returns Link state 7662306a36Sopenharmony_ci */ 7762306a36Sopenharmony_ciextern union cvmx_helper_link_info __cvmx_helper_rgmii_link_get(int ipd_port); 7862306a36Sopenharmony_ci 7962306a36Sopenharmony_ci/** 8062306a36Sopenharmony_ci * Configure an IPD/PKO port for the specified link state. This 8162306a36Sopenharmony_ci * function does not influence auto negotiation at the PHY level. 8262306a36Sopenharmony_ci * The passed link state must always match the link state returned 8362306a36Sopenharmony_ci * by cvmx_helper_link_get(). 8462306a36Sopenharmony_ci * 8562306a36Sopenharmony_ci * @ipd_port: IPD/PKO port to configure 8662306a36Sopenharmony_ci * @link_info: The new link state 8762306a36Sopenharmony_ci * 8862306a36Sopenharmony_ci * Returns Zero on success, negative on failure 8962306a36Sopenharmony_ci */ 9062306a36Sopenharmony_ciextern int __cvmx_helper_rgmii_link_set(int ipd_port, 9162306a36Sopenharmony_ci union cvmx_helper_link_info link_info); 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_ci#endif 94