cvmx-helper-spi.h revision 215990
1210284Sjmallett/***********************license start***************
2215990Sjmallett * Copyright (c) 2003-2010  Cavium Networks (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
18215990Sjmallett *   * Neither the name of Cavium Networks 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"
29215990Sjmallett * AND WITH ALL FAULTS AND CAVIUM  NETWORKS 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 *
52215990Sjmallett * <hr>$Revision: 49448 $<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);
68210284Sjmallett
69210284Sjmallett/**
70210284Sjmallett * @INTERNAL
71210284Sjmallett * Bringup and enable a SPI interface. After this call packet I/O
72210284Sjmallett * should be fully functional. This is called with IPD enabled but
73210284Sjmallett * PKO disabled.
74210284Sjmallett *
75210284Sjmallett * @param interface Interface to bring up
76210284Sjmallett *
77210284Sjmallett * @return Zero on success, negative on failure
78210284Sjmallett */
79210284Sjmallettextern int __cvmx_helper_spi_enable(int interface);
80210284Sjmallett
81210284Sjmallett/**
82210284Sjmallett * @INTERNAL
83210284Sjmallett * Return the link state of an IPD/PKO port as returned by
84210284Sjmallett * auto negotiation. The result of this function may not match
85210284Sjmallett * Octeon's link config if auto negotiation has changed since
86210284Sjmallett * the last call to cvmx_helper_link_set().
87210284Sjmallett *
88210284Sjmallett * @param ipd_port IPD/PKO port to query
89210284Sjmallett *
90210284Sjmallett * @return Link state
91210284Sjmallett */
92210284Sjmallettextern cvmx_helper_link_info_t __cvmx_helper_spi_link_get(int ipd_port);
93210284Sjmallett
94210284Sjmallett/**
95210284Sjmallett * @INTERNAL
96210284Sjmallett * Configure an IPD/PKO port for the specified link state. This
97210284Sjmallett * function does not influence auto negotiation at the PHY level.
98210284Sjmallett * The passed link state must always match the link state returned
99210284Sjmallett * by cvmx_helper_link_get(). It is normally best to use
100210284Sjmallett * cvmx_helper_link_autoconf() instead.
101210284Sjmallett *
102210284Sjmallett * @param ipd_port  IPD/PKO port to configure
103210284Sjmallett * @param link_info The new link state
104210284Sjmallett *
105210284Sjmallett * @return Zero on success, negative on failure
106210284Sjmallett */
107210284Sjmallettextern int __cvmx_helper_spi_link_set(int ipd_port, cvmx_helper_link_info_t link_info);
108210284Sjmallett
109210284Sjmallett#endif
110