cvmx-ilk.h revision 232812
17270Srgrimes/***********************license start*************** 210497Swollman * Copyright (c) 2003-2010 Cavium Inc. (support@cavium.com). All rights 37270Srgrimes * reserved. 47270Srgrimes * 57270Srgrimes * 67270Srgrimes * Redistribution and use in source and binary forms, with or without 77270Srgrimes * modification, are permitted provided that the following conditions are 87270Srgrimes * met: 97270Srgrimes * 107270Srgrimes * * Redistributions of source code must retain the above copyright 117270Srgrimes * notice, this list of conditions and the following disclaimer. 127270Srgrimes * 137270Srgrimes * * Redistributions in binary form must reproduce the above 147270Srgrimes * copyright notice, this list of conditions and the following 1510497Swollman * disclaimer in the documentation and/or other materials provided 1610497Swollman * with the distribution. 177270Srgrimes 1810497Swollman * * Neither the name of Cavium Inc. nor the names of 1910497Swollman * its contributors may be used to endorse or promote products 2010497Swollman * derived from this software without specific prior written 2110497Swollman * permission. 2210497Swollman 2310497Swollman * This Software, including technical data, may be subject to U.S. export control 2410497Swollman * laws, including the U.S. Export Administration Act and its associated 2510497Swollman * regulations, and may be subject to export or import regulations in other 2610497Swollman * countries. 2710497Swollman 2810497Swollman * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" 2910497Swollman * AND WITH ALL FAULTS AND CAVIUM INC. MAKES NO PROMISES, REPRESENTATIONS OR 3010497Swollman * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO 3110497Swollman * THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR 3210497Swollman * DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM 3310497Swollman * SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE, 3410497Swollman * MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF 3510497Swollman * VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR 3610497Swollman * CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR 3710497Swollman * PERFORMANCE OF THE SOFTWARE LIES WITH YOU. 3810497Swollman ***********************license end**************************************/ 3910497Swollman 4010497Swollman/** 4110497Swollman * @file 4210497Swollman * 4310497Swollman * This file contains defines for the ILK interface 4410497Swollman 4510497Swollman * <hr>$Revision: 49448 $<hr> 4610497Swollman * 4710497Swollman * 4810497Swollman */ 4910497Swollman#ifndef __CVMX_ILK_H__ 5010497Swollman#define __CVMX_ILK_H__ 5110497Swollman 5210497Swollman#ifdef __cplusplus 5310497Swollmanextern "C" { 5410497Swollman#endif 5510497Swollman 5610497Swollman/* CSR typedefs have been moved to cvmx-ilk-defs.h */ 5710497Swollman 5810497Swollman#define CVMX_ILK_GBL_BASE 5 5910497Swollman#define CVMX_ILK_QLM_BASE 1 607270Srgrimes 61typedef struct 62{ 63 int intf_en : 8; 64 int lane_en_mask : 8; 65 int lane_speed : 16; 66 /* add more here */ 67} cvmx_ilk_intf_t; 68 69#define CVMX_NUM_ILK_INTF 2 70#define CVMX_MAX_ILK_LANES 8 71extern unsigned char cvmx_ilk_lane_mask[CVMX_NUM_ILK_INTF]; 72 73typedef struct 74{ 75 unsigned int pipe; 76 unsigned int chan; 77} cvmx_ilk_pipe_chan_t; 78 79#define CVMX_ILK_PIPE_BASE 72 80#define CVMX_MAX_ILK_PIPES 45 81#define CVMX_MAX_ILK_CHANS 8 82extern unsigned char cvmx_ilk_chans[CVMX_NUM_ILK_INTF]; 83extern unsigned char cvmx_ilk_chan_map[CVMX_NUM_ILK_INTF][CVMX_MAX_ILK_CHANS]; 84 85typedef struct 86{ 87 unsigned int chan; 88 unsigned int pknd; 89} cvmx_ilk_chan_pknd_t; 90 91#define CVMX_ILK_PKND_BASE 20 92#define CVMX_MAX_ILK_PKNDS 8 /* must be <45 */ 93 94typedef struct 95{ 96 unsigned int *chan_list; /* for discrete channels. or, must be null */ 97 unsigned int num_chans; 98 99 unsigned int chan_start; /* for continuous channels */ 100 unsigned int chan_end; 101 unsigned int chan_step; 102 103 unsigned int clr_on_rd; 104} cvmx_ilk_stats_ctrl_t; 105 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 113 114typedef enum 115{ 116 PIPE_BPID = 0, 117 LINK, 118 XOFF, 119 XON 120} cvmx_ilk_cal_ent_ctrl_t; 121 122typedef struct 123{ 124 unsigned char pipe_bpid; 125 cvmx_ilk_cal_ent_ctrl_t ent_ctrl; 126} cvmx_ilk_cal_entry_t; 127 128/** Callbacks structure to customize ILK initialization sequence */ 129typedef struct 130{ 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); 135 136 /** add more here */ 137} cvmx_ilk_callbacks_t; 138 139typedef enum 140{ 141 CVMX_ILK_LPBK_DISA = 0, 142 CVMX_ILK_LPBK_ENA 143} cvmx_ilk_lpbk_ena_t; 144 145typedef enum 146{ 147 CVMX_ILK_LPBK_INT = 0, 148 CVMX_ILK_LPBK_EXT 149} cvmx_ilk_lpbk_mode_t; 150 151extern void cvmx_ilk_get_callbacks(cvmx_ilk_callbacks_t * callbacks); 152extern void cvmx_ilk_set_callbacks(cvmx_ilk_callbacks_t * new_callbacks); 153 154extern int cvmx_ilk_start_interface (int interface, unsigned char num_lanes); 155extern int cvmx_ilk_set_pipe (int interface, int pipe_base, 156 unsigned int pipe_len); 157extern int cvmx_ilk_tx_set_channel (int interface, cvmx_ilk_pipe_chan_t *pch, 158 unsigned int num_chs); 159extern int cvmx_ilk_rx_set_pknd (int interface, cvmx_ilk_chan_pknd_t *chpknd, 160 unsigned int num_pknd); 161extern int cvmx_ilk_calendar_setup_cb (int interface, int num_ports); 162extern int cvmx_ilk_calendar_sync_cb (int interface, int timeout); 163extern int cvmx_ilk_enable (int interface); 164extern int cvmx_ilk_disable (int interface); 165extern int cvmx_ilk_get_intf_ena (int interface); 166extern unsigned char cvmx_ilk_bit_count (unsigned char uc); 167extern unsigned char cvmx_ilk_get_intf_ln_msk (int interface); 168extern int cvmx_ilk_get_chan_info (int interface, unsigned char **chans, 169 unsigned char *num_chan); 170extern void cvmx_ilk_show_stats (int interface, cvmx_ilk_stats_ctrl_t *pstats); 171extern 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); 174extern int cvmx_ilk_cal_setup_tx (int interface, int cal_depth, 175 cvmx_ilk_cal_entry_t *pent, 176 unsigned char cal_ena); 177extern int cvmx_ilk_lpbk (int interface, cvmx_ilk_lpbk_ena_t enable, 178 cvmx_ilk_lpbk_mode_t mode); 179#ifdef __cplusplus 180} 181#endif 182 183#endif /* __CVMX_ILK_H__ */ 184