1 /***********************license start***************
2 * Copyright (c) 2003-2010 Cavium Inc. (support@cavium.com). All rights
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
18 * * Neither the name of Cavium Inc. nor the names of
19 * its contributors may be used to endorse or promote products
20 * derived from this software without specific prior written
23 * This Software, including technical data, may be subject to U.S. export control
24 * laws, including the U.S. Export Administration Act and its associated
25 * regulations, and may be subject to export or import regulations in other
28 * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
29 * AND WITH ALL FAULTS AND CAVIUM INC. MAKES NO PROMISES, REPRESENTATIONS OR
30 * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
31 * THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
32 * DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
33 * SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
34 * MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
35 * VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
36 * CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
37 * PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
38 ***********************license end**************************************/
43 * This file contains defines for the ILK interface
45 * <hr>$Revision: 49448 $<hr>
49 #ifndef __CVMX_ILK_H__
50 #define __CVMX_ILK_H__
56 /* CSR typedefs have been moved to cvmx-ilk-defs.h */
58 #define CVMX_ILK_GBL_BASE 5
59 #define CVMX_ILK_QLM_BASE 1
69 #define CVMX_NUM_ILK_INTF 2
70 #define CVMX_MAX_ILK_LANES 8
71 extern unsigned char cvmx_ilk_lane_mask[CVMX_NUM_ILK_INTF];
77 } cvmx_ilk_pipe_chan_t;
79 #define CVMX_ILK_PIPE_BASE 72
80 #define CVMX_MAX_ILK_PIPES 45
81 #define CVMX_MAX_ILK_CHANS 8
82 extern unsigned char cvmx_ilk_chans[CVMX_NUM_ILK_INTF];
83 extern unsigned char cvmx_ilk_chan_map[CVMX_NUM_ILK_INTF][CVMX_MAX_ILK_CHANS];
89 } cvmx_ilk_chan_pknd_t;
91 #define CVMX_ILK_PKND_BASE 20
92 #define CVMX_MAX_ILK_PKNDS 8 /* must be <45 */
96 unsigned int *chan_list; /* for discrete channels. or, must be null */
97 unsigned int num_chans;
99 unsigned int chan_start; /* for continuous channels */
100 unsigned int chan_end;
101 unsigned int chan_step;
103 unsigned int clr_on_rd;
104 } cvmx_ilk_stats_ctrl_t;
106 #define CVMX_ILK_MAX_CAL 288
107 #define CVMX_ILK_TX_MIN_CAL 1
108 #define CVMX_ILK_RX_MIN_CAL 1
109 #define CVMX_ILK_CAL_GRP_SZ 8
110 #define CVMX_ILK_PIPE_BPID_SZ 7
111 #define CVMX_ILK_ENT_CTRL_SZ 2
112 #define CVMX_ILK_RX_FIFO_WM 0x200
120 } cvmx_ilk_cal_ent_ctrl_t;
124 unsigned char pipe_bpid;
125 cvmx_ilk_cal_ent_ctrl_t ent_ctrl;
126 } cvmx_ilk_cal_entry_t;
128 /** Callbacks structure to customize ILK initialization sequence */
131 /** Called to setup rx calendar */
132 int (*calendar_setup_rx) (int interface, int cal_depth,
133 cvmx_ilk_cal_entry_t *pent, int hi_wm,
134 unsigned char cal_ena);
137 } cvmx_ilk_callbacks_t;
141 CVMX_ILK_LPBK_DISA = 0,
143 } cvmx_ilk_lpbk_ena_t;
147 CVMX_ILK_LPBK_INT = 0,
149 } cvmx_ilk_lpbk_mode_t;
151 extern void cvmx_ilk_get_callbacks(cvmx_ilk_callbacks_t * callbacks);
152 extern void cvmx_ilk_set_callbacks(cvmx_ilk_callbacks_t * new_callbacks);
154 extern int cvmx_ilk_start_interface (int interface, unsigned char num_lanes);
155 extern int cvmx_ilk_set_pipe (int interface, int pipe_base,
156 unsigned int pipe_len);
157 extern int cvmx_ilk_tx_set_channel (int interface, cvmx_ilk_pipe_chan_t *pch,
158 unsigned int num_chs);
159 extern int cvmx_ilk_rx_set_pknd (int interface, cvmx_ilk_chan_pknd_t *chpknd,
160 unsigned int num_pknd);
161 extern int cvmx_ilk_calendar_setup_cb (int interface, int num_ports);
162 extern int cvmx_ilk_calendar_sync_cb (int interface, int timeout);
163 extern int cvmx_ilk_enable (int interface);
164 extern int cvmx_ilk_disable (int interface);
165 extern int cvmx_ilk_get_intf_ena (int interface);
166 extern unsigned char cvmx_ilk_bit_count (unsigned char uc);
167 extern unsigned char cvmx_ilk_get_intf_ln_msk (int interface);
168 extern int cvmx_ilk_get_chan_info (int interface, unsigned char **chans,
169 unsigned char *num_chan);
170 extern void cvmx_ilk_show_stats (int interface, cvmx_ilk_stats_ctrl_t *pstats);
171 extern int cvmx_ilk_cal_setup_rx (int interface, int cal_depth,
172 cvmx_ilk_cal_entry_t *pent, int hi_wm,
173 unsigned char cal_ena);
174 extern int cvmx_ilk_cal_setup_tx (int interface, int cal_depth,
175 cvmx_ilk_cal_entry_t *pent,
176 unsigned char cal_ena);
177 extern int cvmx_ilk_lpbk (int interface, cvmx_ilk_lpbk_ena_t enable,
178 cvmx_ilk_lpbk_mode_t mode);
183 #endif /* __CVMX_ILK_H__ */