1210284Sjmallett/***********************license start*************** 2232812Sjmallett * Copyright (c) 2003-2010 Cavium Inc. (support@cavium.com). All rights 3215990Sjmallett * reserved. 4210284Sjmallett * 5210284Sjmallett * 6215990Sjmallett * Redistribution and use in source and binary forms, with or without 7215990Sjmallett * modification, are permitted provided that the following conditions are 8215990Sjmallett * met: 9210284Sjmallett * 10215990Sjmallett * * Redistributions of source code must retain the above copyright 11215990Sjmallett * notice, this list of conditions and the following disclaimer. 12210284Sjmallett * 13215990Sjmallett * * Redistributions in binary form must reproduce the above 14215990Sjmallett * copyright notice, this list of conditions and the following 15215990Sjmallett * disclaimer in the documentation and/or other materials provided 16215990Sjmallett * with the distribution. 17215990Sjmallett 18232812Sjmallett * * Neither the name of Cavium Inc. nor the names of 19215990Sjmallett * its contributors may be used to endorse or promote products 20215990Sjmallett * derived from this software without specific prior written 21215990Sjmallett * permission. 22215990Sjmallett 23215990Sjmallett * This Software, including technical data, may be subject to U.S. export control 24215990Sjmallett * laws, including the U.S. Export Administration Act and its associated 25215990Sjmallett * regulations, and may be subject to export or import regulations in other 26215990Sjmallett * countries. 27215990Sjmallett 28215990Sjmallett * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" 29232812Sjmallett * AND WITH ALL FAULTS AND CAVIUM INC. MAKES NO PROMISES, REPRESENTATIONS OR 30215990Sjmallett * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO 31215990Sjmallett * THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR 32215990Sjmallett * DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM 33215990Sjmallett * SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE, 34215990Sjmallett * MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF 35215990Sjmallett * VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR 36215990Sjmallett * CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR 37215990Sjmallett * PERFORMANCE OF THE SOFTWARE LIES WITH YOU. 38210284Sjmallett ***********************license end**************************************/ 39210284Sjmallett 40210284Sjmallett 41210284Sjmallett 42210284Sjmallett 43210284Sjmallett 44210284Sjmallett 45215990Sjmallett 46210284Sjmallett/** 47210284Sjmallett * @file 48210284Sjmallett * 49210284Sjmallett * Functions for SPI initialization, configuration, 50210284Sjmallett * and monitoring. 51210284Sjmallett * 52232812Sjmallett * <hr>$Revision: 70030 $<hr> 53210284Sjmallett */ 54210284Sjmallett#ifndef __CVMX_HELPER_SPI_H__ 55210284Sjmallett#define __CVMX_HELPER_SPI_H__ 56210284Sjmallett 57210284Sjmallett/** 58210284Sjmallett * @INTERNAL 59210284Sjmallett * Probe a SPI interface and determine the number of ports 60210284Sjmallett * connected to it. The SPI interface should still be down after 61210284Sjmallett * this call. 62210284Sjmallett * 63210284Sjmallett * @param interface Interface to probe 64210284Sjmallett * 65210284Sjmallett * @return Number of ports on the interface. Zero to disable. 66210284Sjmallett */ 67210284Sjmallettextern int __cvmx_helper_spi_probe(int interface); 68232812Sjmallettextern int __cvmx_helper_spi_enumerate(int interface); 69210284Sjmallett 70210284Sjmallett/** 71210284Sjmallett * @INTERNAL 72210284Sjmallett * Bringup and enable a SPI interface. After this call packet I/O 73210284Sjmallett * should be fully functional. This is called with IPD enabled but 74210284Sjmallett * PKO disabled. 75210284Sjmallett * 76210284Sjmallett * @param interface Interface to bring up 77210284Sjmallett * 78210284Sjmallett * @return Zero on success, negative on failure 79210284Sjmallett */ 80210284Sjmallettextern int __cvmx_helper_spi_enable(int interface); 81210284Sjmallett 82210284Sjmallett/** 83210284Sjmallett * @INTERNAL 84210284Sjmallett * Return the link state of an IPD/PKO port as returned by 85210284Sjmallett * auto negotiation. The result of this function may not match 86210284Sjmallett * Octeon's link config if auto negotiation has changed since 87210284Sjmallett * the last call to cvmx_helper_link_set(). 88210284Sjmallett * 89210284Sjmallett * @param ipd_port IPD/PKO port to query 90210284Sjmallett * 91210284Sjmallett * @return Link state 92210284Sjmallett */ 93210284Sjmallettextern cvmx_helper_link_info_t __cvmx_helper_spi_link_get(int ipd_port); 94210284Sjmallett 95210284Sjmallett/** 96210284Sjmallett * @INTERNAL 97210284Sjmallett * Configure an IPD/PKO port for the specified link state. This 98210284Sjmallett * function does not influence auto negotiation at the PHY level. 99210284Sjmallett * The passed link state must always match the link state returned 100210284Sjmallett * by cvmx_helper_link_get(). It is normally best to use 101210284Sjmallett * cvmx_helper_link_autoconf() instead. 102210284Sjmallett * 103210284Sjmallett * @param ipd_port IPD/PKO port to configure 104210284Sjmallett * @param link_info The new link state 105210284Sjmallett * 106210284Sjmallett * @return Zero on success, negative on failure 107210284Sjmallett */ 108210284Sjmallettextern int __cvmx_helper_spi_link_set(int ipd_port, cvmx_helper_link_info_t link_info); 109210284Sjmallett 110210284Sjmallett#endif 111