Linux Kernel
3.7.1
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
arch
mips
include
asm
octeon
cvmx-spi.h
Go to the documentation of this file.
1
/***********************license start***************
2
* Author: Cavium Networks
3
*
4
* Contact:
[email protected]
5
* This file is part of the OCTEON SDK
6
*
7
* Copyright (c) 2003-2008 Cavium Networks
8
*
9
* This file is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License, Version 2, as
11
* published by the Free Software Foundation.
12
*
13
* This file is distributed in the hope that it will be useful, but
14
* AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16
* NONINFRINGEMENT. See the GNU General Public License for more
17
* details.
18
*
19
* You should have received a copy of the GNU General Public License
20
* along with this file; if not, write to the Free Software
21
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22
* or visit http://www.gnu.org/licenses/.
23
*
24
* This file may also be available under a different license from Cavium.
25
* Contact Cavium Networks for more information
26
***********************license end**************************************/
27
28
/*
29
*
30
* This file contains defines for the SPI interface
31
*/
32
#ifndef __CVMX_SPI_H__
33
#define __CVMX_SPI_H__
34
35
#include <
asm/octeon/cvmx-gmxx-defs.h
>
36
37
/* CSR typedefs have been moved to cvmx-csr-*.h */
38
39
typedef
enum
{
40
CVMX_SPI_MODE_UNKNOWN
= 0,
41
CVMX_SPI_MODE_TX_HALFPLEX
= 1,
42
CVMX_SPI_MODE_RX_HALFPLEX
= 2,
43
CVMX_SPI_MODE_DUPLEX
= 3
44
}
cvmx_spi_mode_t
;
45
47
typedef
struct
{
49
int
(*reset_cb) (
int
interface
,
cvmx_spi_mode_t
mode
);
50
52
int
(*calendar_setup_cb) (
int
interface
,
cvmx_spi_mode_t
mode
,
53
int
num_ports
);
54
56
int
(*clock_detect_cb) (
int
interface
,
cvmx_spi_mode_t
mode
,
57
int
timeout
);
58
60
int
(*training_cb) (
int
interface
,
cvmx_spi_mode_t
mode
,
int
timeout
);
61
63
int
(*calendar_sync_cb) (
int
interface
,
cvmx_spi_mode_t
mode
,
64
int
timeout
);
65
67
int
(*interface_up_cb) (
int
interface
,
cvmx_spi_mode_t
mode
);
68
69
}
cvmx_spi_callbacks_t
;
70
77
static
inline
int
cvmx_spi_is_spi_interface(
int
interface
)
78
{
79
uint64_t
gmxState = cvmx_read_csr(CVMX_GMXX_INF_MODE(interface));
80
return
(gmxState & 0x2) && (gmxState & 0x1);
81
}
82
97
extern
int
cvmx_spi_start_interface
(
int
interface
,
cvmx_spi_mode_t
mode
,
98
int
timeout,
int
num_ports);
99
113
extern
int
cvmx_spi_restart_interface
(
int
interface
,
cvmx_spi_mode_t
mode
,
114
int
timeout);
115
123
static
inline
int
cvmx_spi4000_is_present(
int
interface
)
124
{
125
return
0;
126
}
127
133
static
inline
int
cvmx_spi4000_initialize(
int
interface
)
134
{
135
return
0;
136
}
137
145
static
inline
union
cvmx_gmxx_rxx_rx_inbnd
cvmx_spi4000_check_speed(
146
int
interface
,
147
int
port
)
148
{
149
union
cvmx_gmxx_rxx_rx_inbnd
r
;
150
r
.u64 = 0;
151
return
r
;
152
}
153
161
extern
void
cvmx_spi_get_callbacks
(
cvmx_spi_callbacks_t
*callbacks);
162
168
extern
void
cvmx_spi_set_callbacks
(
cvmx_spi_callbacks_t
*new_callbacks);
169
183
extern
int
cvmx_spi_reset_cb
(
int
interface
,
cvmx_spi_mode_t
mode
);
184
200
extern
int
cvmx_spi_calendar_setup_cb
(
int
interface
,
cvmx_spi_mode_t
mode
,
201
int
num_ports);
202
217
extern
int
cvmx_spi_clock_detect_cb
(
int
interface
,
cvmx_spi_mode_t
mode
,
218
int
timeout);
219
234
extern
int
cvmx_spi_training_cb
(
int
interface
,
cvmx_spi_mode_t
mode
,
235
int
timeout);
236
251
extern
int
cvmx_spi_calendar_sync_cb
(
int
interface
,
cvmx_spi_mode_t
mode
,
252
int
timeout);
253
267
extern
int
cvmx_spi_interface_up_cb
(
int
interface
,
cvmx_spi_mode_t
mode
);
268
269
#endif
/* __CVMX_SPI_H__ */
Generated on Thu Jan 10 2013 13:10:46 for Linux Kernel by
1.8.2