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  * Functions for SPI initialization, configuration,
0030  * and monitoring.
0031  */
0032 #ifndef __CVMX_HELPER_SPI_H__
0033 #define __CVMX_HELPER_SPI_H__
0034 
0035 /**
0036  * Probe a SPI interface and determine the number of ports
0037  * connected to it. The SPI interface should still be down after
0038  * this call.
0039  *
0040  * @interface: Interface to probe
0041  *
0042  * Returns Number of ports on the interface. Zero to disable.
0043  */
0044 extern int __cvmx_helper_spi_probe(int interface);
0045 extern int __cvmx_helper_spi_enumerate(int interface);
0046 
0047 /**
0048  * Bringup and enable a SPI interface. After this call packet I/O
0049  * should be fully functional. This is called with IPD enabled but
0050  * PKO disabled.
0051  *
0052  * @interface: Interface to bring up
0053  *
0054  * Returns Zero on success, negative on failure
0055  */
0056 extern int __cvmx_helper_spi_enable(int interface);
0057 
0058 /**
0059  * Return the link state of an IPD/PKO port as returned by
0060  * auto negotiation. The result of this function may not match
0061  * Octeon's link config if auto negotiation has changed since
0062  * the last call to cvmx_helper_link_set().
0063  *
0064  * @ipd_port: IPD/PKO port to query
0065  *
0066  * Returns Link state
0067  */
0068 extern union cvmx_helper_link_info __cvmx_helper_spi_link_get(int ipd_port);
0069 
0070 /**
0071  * Configure an IPD/PKO port for the specified link state. This
0072  * function does not influence auto negotiation at the PHY level.
0073  * The passed link state must always match the link state returned
0074  * by cvmx_helper_link_get().
0075  *
0076  * @ipd_port:  IPD/PKO port to configure
0077  * @link_info: The new link state
0078  *
0079  * Returns Zero on success, negative on failure
0080  */
0081 extern int __cvmx_helper_spi_link_set(int ipd_port,
0082                       union cvmx_helper_link_info link_info);
0083 
0084 #endif