18c2ecf20Sopenharmony_ci/***********************license start***************
28c2ecf20Sopenharmony_ci * Author: Cavium Networks
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Contact: support@caviumnetworks.com
58c2ecf20Sopenharmony_ci * This file is part of the OCTEON SDK
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Copyright (c) 2003-2008 Cavium Networks
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci * This file is free software; you can redistribute it and/or modify
108c2ecf20Sopenharmony_ci * it under the terms of the GNU General Public License, Version 2, as
118c2ecf20Sopenharmony_ci * published by the Free Software Foundation.
128c2ecf20Sopenharmony_ci *
138c2ecf20Sopenharmony_ci * This file is distributed in the hope that it will be useful, but
148c2ecf20Sopenharmony_ci * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
158c2ecf20Sopenharmony_ci * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
168c2ecf20Sopenharmony_ci * NONINFRINGEMENT.  See the GNU General Public License for more
178c2ecf20Sopenharmony_ci * details.
188c2ecf20Sopenharmony_ci *
198c2ecf20Sopenharmony_ci * You should have received a copy of the GNU General Public License
208c2ecf20Sopenharmony_ci * along with this file; if not, write to the Free Software
218c2ecf20Sopenharmony_ci * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
228c2ecf20Sopenharmony_ci * or visit http://www.gnu.org/licenses/.
238c2ecf20Sopenharmony_ci *
248c2ecf20Sopenharmony_ci * This file may also be available under a different license from Cavium.
258c2ecf20Sopenharmony_ci * Contact Cavium Networks for more information
268c2ecf20Sopenharmony_ci ***********************license end**************************************/
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci/**
298c2ecf20Sopenharmony_ci * @file
308c2ecf20Sopenharmony_ci *
318c2ecf20Sopenharmony_ci * Functions for RGMII/GMII/MII initialization, configuration,
328c2ecf20Sopenharmony_ci * and monitoring.
338c2ecf20Sopenharmony_ci *
348c2ecf20Sopenharmony_ci */
358c2ecf20Sopenharmony_ci#ifndef __CVMX_HELPER_RGMII_H__
368c2ecf20Sopenharmony_ci#define __CVMX_HELPER_RGMII_H__
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci/**
398c2ecf20Sopenharmony_ci * Probe RGMII ports and determine the number present
408c2ecf20Sopenharmony_ci *
418c2ecf20Sopenharmony_ci * @interface: Interface to probe
428c2ecf20Sopenharmony_ci *
438c2ecf20Sopenharmony_ci * Returns Number of RGMII/GMII/MII ports (0-4).
448c2ecf20Sopenharmony_ci */
458c2ecf20Sopenharmony_ciextern int __cvmx_helper_rgmii_probe(int interface);
468c2ecf20Sopenharmony_ci#define __cvmx_helper_rgmii_enumerate __cvmx_helper_rgmii_probe
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci/**
498c2ecf20Sopenharmony_ci * Put an RGMII interface in loopback mode. Internal packets sent
508c2ecf20Sopenharmony_ci * out will be received back again on the same port. Externally
518c2ecf20Sopenharmony_ci * received packets will echo back out.
528c2ecf20Sopenharmony_ci *
538c2ecf20Sopenharmony_ci * @port:   IPD port number to loop.
548c2ecf20Sopenharmony_ci */
558c2ecf20Sopenharmony_ciextern void cvmx_helper_rgmii_internal_loopback(int port);
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci/**
588c2ecf20Sopenharmony_ci * Configure all of the ASX, GMX, and PKO registers required
598c2ecf20Sopenharmony_ci * to get RGMII to function on the supplied interface.
608c2ecf20Sopenharmony_ci *
618c2ecf20Sopenharmony_ci * @interface: PKO Interface to configure (0 or 1)
628c2ecf20Sopenharmony_ci *
638c2ecf20Sopenharmony_ci * Returns Zero on success
648c2ecf20Sopenharmony_ci */
658c2ecf20Sopenharmony_ciextern int __cvmx_helper_rgmii_enable(int interface);
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci/**
688c2ecf20Sopenharmony_ci * Return the link state of an IPD/PKO port as returned by
698c2ecf20Sopenharmony_ci * auto negotiation. The result of this function may not match
708c2ecf20Sopenharmony_ci * Octeon's link config if auto negotiation has changed since
718c2ecf20Sopenharmony_ci * the last call to cvmx_helper_link_set().
728c2ecf20Sopenharmony_ci *
738c2ecf20Sopenharmony_ci * @ipd_port: IPD/PKO port to query
748c2ecf20Sopenharmony_ci *
758c2ecf20Sopenharmony_ci * Returns Link state
768c2ecf20Sopenharmony_ci */
778c2ecf20Sopenharmony_ciextern union cvmx_helper_link_info __cvmx_helper_rgmii_link_get(int ipd_port);
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci/**
808c2ecf20Sopenharmony_ci * Configure an IPD/PKO port for the specified link state. This
818c2ecf20Sopenharmony_ci * function does not influence auto negotiation at the PHY level.
828c2ecf20Sopenharmony_ci * The passed link state must always match the link state returned
838c2ecf20Sopenharmony_ci * by cvmx_helper_link_get().
848c2ecf20Sopenharmony_ci *
858c2ecf20Sopenharmony_ci * @ipd_port:  IPD/PKO port to configure
868c2ecf20Sopenharmony_ci * @link_info: The new link state
878c2ecf20Sopenharmony_ci *
888c2ecf20Sopenharmony_ci * Returns Zero on success, negative on failure
898c2ecf20Sopenharmony_ci */
908c2ecf20Sopenharmony_ciextern int __cvmx_helper_rgmii_link_set(int ipd_port,
918c2ecf20Sopenharmony_ci					union cvmx_helper_link_info link_info);
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci#endif
94