openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

temod16.h (12901B)


      1 /*----------------------------------------------------------------------
      2  * 
      3  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      4  * 
      5  * Copyright 2007-2019 Broadcom Inc. All rights reserved.
      6  *
      7  *  Broadcom Corporation
      8  *  Proprietary and Confidential information
      9  *  All rights reserved
     10  *  This source file is the property of Broadcom Corporation, and
     11  *  may not be copied or distributed in any isomorphic form without the
     12  *  prior written consent of Broadcom Corporation.
     13  *----------------------------------------------------------------------
     14  *  Description: define enumerators
     15  *----------------------------------------------------------------------*/
     16 /*
     17  * 
     18  * $Copyright:
     19  * All Rights Reserved.$
     20  */
     21 
     22 #ifndef _TEMOD16_H_
     23 #define _TEMOD16_H_
     24 
     25 #ifndef _DV_TB_
     26 #define _SDK_TEMOD16_ 1
     27 #endif
     28 
     29 #ifdef _SDK_TEMOD16_
     30 #include <phymod/phymod.h>
     31 #endif
     32 
     33 #ifndef PHYMOD_ST
     34 #ifdef _SDK_TEMOD16_
     35   #define PHYMOD_ST   const phymod_access_t
     36 #else
     37   #define PHYMOD_ST  temod16_st
     38 #endif /* _SDK_TEMOD16_ */
     39 #endif /* PHYMOD_ST */
     40 
     41 #ifdef _DV_TB_
     42 #include <stdint.h>
     43 #include <stdio.h>
     44 #include <string.h>
     45 #include <stdlib.h>
     46 #include "errno.h"
     47 #endif
     48 
     49 typedef enum {
     50     TEMOD16_AN_MODE_CL73 = 0,
     51     TEMOD16_AN_MODE_CL37,
     52     TEMOD16_AN_MODE_CL73BAM,
     53     TEMOD16_AN_MODE_CL37BAM,
     54     TEMOD16_AN_MODE_SGMII,
     55     TEMOD16_AN_MODE_HPAM,
     56     TEMOD16_AN_MODE_CL37_SGMII,
     57     TEMOD16_AN_MODE_NONE,
     58     TSMOD16_AN_MODE_TYPE_COUNT
     59 }temod16_an_mode_type_t;
     60 
     61 typedef enum {
     62     TEMOD16_CL37_SGMII_10M = 0,
     63     TEMOD16_CL37_SGMII_100M,
     64     TEMOD16_CL37_SGMII_1000M,
     65     TEMOD16_CL37_SGMII_SPEED_COUNT
     66 }temod16_cl37_sgmii_speed_t;
     67 
     68 typedef enum {
     69     TEMOD16_NO_PAUSE = 0,
     70     TEMOD16_SYMM_PAUSE,
     71     TEMOD16_ASYM_PAUSE,
     72     TEMOD16_ASYM_SYMM_PAUSE,
     73     TEMOD16_AN_PAUSE_COUNT
     74 }temod16_an_pause_t;
     75 
     76 typedef enum {
     77     TEMOD16_CL73_100GBASE_CR10 = 0,
     78     TEMOD16_CL73_40GBASE_CR4,
     79     TEMOD16_CL73_40GBASE_KR4,
     80     TEMOD16_CL73_10GBASE_KR,
     81     TEMOD16_CL73_10GBASE_KX4,
     82     TEMOD16_CL73_1000BASE_KX,
     83     TEMOD16_CL73_SPEED_COUNT
     84 }temod16_cl73_speed_t;
     85 
     86 typedef enum {
     87     TEMOD16_CL37_BAM_2p5GBASE_X = 0,
     88     TEMOD16_CL37_BAM_5GBASE_X4,
     89     TEMOD16_CL37_BAM_6GBASE_X4,
     90     TEMOD16_CL37_BAM_10GBASE_X4,
     91     TEMOD16_CL37_BAM_10GBASE_X4_CX4,
     92     TEMOD16_CL37_BAM_10GBASE_X2,
     93     TEMOD16_CL37_BAM_10GBASE_X2_CX4,
     94     TEMOD16_CL37_BAM_BAM_10p5GBASE_X2,
     95     TEMOD16_CL37_BAM_12GBASE_X4,
     96     TEMOD16_CL37_BAM_12p5GBASE_X4,
     97     TEMOD16_CL37_BAM_12p7GBASE_X2,
     98     TEMOD16_CL37_BAM_SPEED_COUNT
     99 }temod16_cl37_bam_speed_t;
    100 
    101 typedef enum {
    102     TEMOD16_CL37_BAM_13GBASE_X4 = 0,
    103     TEMOD16_CL37_BAM_15GBASE_X4,
    104     TEMOD16_CL37_BAM_15p75GBASE_X2,
    105     TEMOD16_CL37_BAM_16GBASE_X4,
    106     TEMOD16_CL37_BAM_20GBASE_X4_CX4,
    107     TEMOD16_CL37_BAM_20GBASE_X4,
    108     TEMOD16_CL37_BAM_20GBASE_X2,
    109     TEMOD16_CL37_BAM_20GBASE_X2_CX4,
    110     TEMOD16_CL37_BAM_21GBASE_X4,
    111     TEMOD16_CL37_BAM_25p455GBASE_X4,
    112     TEMOD16_CL37_BAM_31p5GBASE_X4,
    113     TEMOD16_CL37_BAM_32p7GBASE_X4,
    114     TEMOD16_CL37_BAM_40GBASE_X4,
    115     TEMOD16_CL37_BAM_SPEED1_COUNT
    116 }temod16_cl37_bam_speed1_t;
    117 
    118 typedef enum {
    119     TEMOD16_CL73_BAM_20GBASE_KR2 = 0,
    120     TEMOD16_CL73_BAM_20GBASE_CR2,
    121     TEMOD16_CL73_BAM_SPEED_COUNT
    122 }temod16_cl73_bam_speed_t;
    123 
    124 #define TEMOD16_FEC_NOT_SUPRTD         0
    125 #define TEMOD16_FEC_SUPRTD_NOT_REQSTD  1
    126 #define TEMOD16_FEC_CL74_SUPRTD_REQSTD 4
    127 
    128 typedef enum {
    129     TEMOD16_TX_LANE_RESET = 0,
    130     TEMOD16_TX_LANE_TRAFFIC_ENABLE = 1,
    131     TEMOD16_TX_LANE_TRAFFIC_DISABLE = 2,
    132     TEMOD16_TX_LANE_RESET_TRAFFIC_ENABLE = 3,
    133     TEMOD16_TX_LANE_RESET_TRAFFIC_DISABLE = 4,
    134     TEMOD16_TX_LANE_TYPE_COUNT
    135 }tx_lane_disable_type_t;
    136 
    137 
    138 typedef struct temod16_an_adv_ability_s{
    139   uint16_t an_base_speed;
    140   uint16_t an_bam_speed;
    141   uint16_t an_bam_speed1;
    142   uint16_t an_nxt_page;
    143   uint16_t an_pause;
    144   uint16_t an_fec;
    145   uint16_t an_cl72;
    146   uint16_t an_hg2;
    147   uint16_t cl37_sgmii_speed;
    148   temod16_an_mode_type_t an_type;
    149 }temod16_an_adv_ability_t;
    150 
    151 typedef struct temod16_an_ability_s {
    152     temod16_an_adv_ability_t cl37_adv;  /*this will include all the cl37 and cl37-bam related  (everything inlclduing fec, cl72 ) */
    153     temod16_an_adv_ability_t cl73_adv ;/*this will include all the cl73 and cl73-bam related */
    154 } temod16_an_ability_t;
    155 
    156 typedef struct temod16_an_control_s {
    157   temod16_an_mode_type_t an_type;
    158   uint16_t num_lane_adv;
    159   uint16_t enable;
    160   uint16_t pd_kx_en;
    161   uint16_t pd_kx4_en;
    162   an_property_enable  an_property_type;
    163 } temod16_an_control_t;
    164 
    165 
    166 typedef struct temod16_an_init_s{
    167   uint16_t  an_fail_cnt;
    168   uint16_t  an_oui_ctrl;
    169   uint16_t  linkfailtimer_dis;
    170   uint16_t  linkfailtimerqua_en;
    171   uint16_t  an_good_check_trap;
    172   uint16_t  an_good_trap;
    173   uint16_t  disable_rf_report;
    174   uint16_t  cl37_bam_ovr1g_pgcnt;
    175   uint16_t  cl73_remote_fault;
    176   uint16_t  cl73_nonce_match_over;
    177   uint16_t  cl73_nonce_match_val;
    178   uint16_t  cl73_transmit_nonce;
    179   uint16_t  base_selector;
    180 } temod16_an_init_t;
    181 
    182 
    183 typedef struct temod16_an_timers_s{
    184   uint16_t  value;
    185 } temod16_an_timers_t;
    186 
    187 typedef struct temod16_device_aux_modes_s {
    188     uint32_t core_id ;
    189     uint16_t st_current_entry ;
    190     uint16_t st_hcd[4] ;
    191     uint16_t st_pll_div[4] ;
    192     uint16_t st_os[4] ;
    193 
    194     uint16_t hto_enable[4]  ;
    195     uint16_t hto_pll_div[4] ;
    196     uint16_t hto_os[4] ;
    197 } temod16_device_aux_modes_t ;
    198 
    199 #define TEMOD16_CL72_CONTROL_NO_TRIGER  0x80
    200 #define TEMOD16_CL72_CONTROL_MASK       0x0f
    201 
    202 int temod16_get_mapped_speed(temod16_spd_intfc_type spd_intf, int *speed);
    203 int temod16_get_pll_ndiv(int pll_mode, int *pll_ndiv);
    204 int temod16_get_actual_speed(int speed_id, int *speed);
    205 
    206 
    207 typedef struct sc_table_entry_s {
    208   int illegal_;
    209 } sc_table_entry_t;
    210 
    211 
    212 extern int temod16_pll_lock_wait(PHYMOD_ST* pc, int timeOutValue);
    213 extern int temod16_credit_control(PHYMOD_ST* pc, int enable);
    214 extern int temod16_power_control(PHYMOD_ST* pc);
    215 extern int temod16_override_set(PHYMOD_ST* pc, override_type_t or_type, uint16_t or_val);
    216 extern int temod16_credit_set(PHYMOD_ST* pc, credit_type_t credit_type, int userCredit);
    217 extern int temod16_rx_lane_control_set(PHYMOD_ST* pc, int enable);
    218 extern int temod16_init_pmd(PHYMOD_ST* pc, int pmd_touched, int uc_active);
    219 extern int temod16_pmd_osmode_set(PHYMOD_ST* pc, temod16_spd_intfc_type spd_intf, int os_mode);
    220 extern int temod16_pll_lock_get(PHYMOD_ST* pc, int* lockStatus);
    221 extern int temod16_pmd_lock_get(PHYMOD_ST* pc, uint32_t* lockStatus);
    222 extern int temod16_wait_pmd_lock(PHYMOD_ST* pc, int timeOutValue, int* lockStatus);
    223 extern int temod16_pcs_bypass_ctl (PHYMOD_ST* pc, int cntl);
    224 extern int temod16_pmd_reset_bypass (PHYMOD_ST* pc, int cntl);
    225 extern int temod16_set_pll_mode(PHYMOD_ST* pc, int pmd_tched, temod16_spd_intfc_type sp, int pll_mode);
    226 extern int temod16_tick_override_set(PHYMOD_ST* pc, int tick_override, int numerator, int denominator);
    227 extern int temod16_tx_loopback_control(PHYMOD_ST* pc, int enable, int starting_lane, int port_type);
    228 extern int temod16_tx_pmd_loopback_control(PHYMOD_ST* pc, int cntl);
    229 extern int temod16_rx_loopback_control(PHYMOD_ST* pc, int enable, int starting_lane, int port_type);
    230 extern int temod16_encode_set(PHYMOD_ST* pc, temod16_spd_intfc_type spd_intf, uint16_t enable);
    231 extern int temod16_decode_set(PHYMOD_ST* pc, temod16_spd_intfc_type spd_intf, uint16_t enable);
    232 extern int temod16_spd_intf_get(PHYMOD_ST* pc, int *spd_intf);
    233 extern int temod16_revid_read(PHYMOD_ST* pc, uint32_t *revid);
    234 extern int temod16_init_pcs(PHYMOD_ST* pc);
    235 extern int temod16_pmd_reset_seq(PHYMOD_ST* pc, int pmd_touched);
    236 extern int temod16_wait_sc_done(PHYMOD_ST* pc, uint16_t *data);
    237 extern int temod16_get_pcs_link_status(PHYMOD_ST* pc, uint32_t *link);
    238 extern int temod16_disable_set(PHYMOD_ST* pc);
    239 extern int temod16_init_pcs_ilkn(PHYMOD_ST* pc);
    240 extern int temod16_pmd_x4_reset(PHYMOD_ST* pc);
    241 extern int temod16_init_pmd_sw(PHYMOD_ST* pc, int pmd_touched, int uc_active,
    242                              temod16_spd_intfc_type spd_intf,  int t_pma_os_mode);
    243 extern int temod16_fecmode_set(PHYMOD_ST* pc, int fec_enable);
    244 extern int temod16_fecmode_get(PHYMOD_ST* pc, uint32_t* fec_enable);
    245 extern int temod16_credit_override_set(PHYMOD_ST* pc, credit_type_t credit_type, int userCredit);
    246 extern int temod16_pmd_lane_reset(PHYMOD_ST* pc);
    247 extern int temod16_cjpat_crpat_mode_set(PHYMOD_ST* pc, temod16_spd_intfc_type spd, int port, int pat, int pnum, int size, int ipgsz);
    248 extern int temod16_cjpat_crpat_check(PHYMOD_ST* pc);
    249 extern int temod16_cjpat_crpat_control(PHYMOD_ST* pc, int enable);
    250 extern int temod16_pcs_lane_swap(PHYMOD_ST *pc, int lane_map);
    251 extern int temod16_trigger_speed_change(PHYMOD_ST* pc);
    252 extern int temod16_init_pmd_qsgmii(PHYMOD_ST* pc, int pmd_touched, int uc_active);
    253 extern int temod16_rx_lane_control_get(PHYMOD_ST* pc, int *value);
    254 extern int temod16_tx_loopback_get(PHYMOD_ST* pc, uint32_t *enable);
    255 extern int temod16_update_port_mode(PHYMOD_ST* pc, int* pll_restart);
    256 extern int temod16_tx_lane_control_set(PHYMOD_ST* pc, tx_lane_disable_type_t tx_dis_type);
    257 extern int temod16_refclk_set(PHYMOD_ST* pc, phymod_ref_clk_t ref_clock);
    258 extern int temod16_pcs_ilkn_mode_set(PHYMOD_ST* pc);
    259 extern int temod16_master_port_num_set( PHYMOD_ST *pc,  int port_num);
    260 extern int temod16_cl48_lfrfli_init(PHYMOD_ST* pc);
    261 extern int temod16_mld_am_timers_set(PHYMOD_ST* pc);
    262 extern int temod16_cl74_chng_default(PHYMOD_ST* pc);
    263 extern int temod16_speed_id_get(PHYMOD_ST* pc, int *speed_id);
    264 extern int temod16_autoneg_control_get(PHYMOD_ST* pc, temod16_an_control_t *an_control, int *an_complete);
    265 extern int temod16_pll_config_get(const phymod_access_t *pa, temod16_pll_mode_type  *pll_mode);
    266 extern int temod16_hg_enable_get(PHYMOD_ST* pc, int *enable);
    267 extern int temod16_pcs_ilkn_chk(PHYMOD_ST* pc, int *ilkn_set);
    268 extern int temod16_clause72_control(PHYMOD_ST* pc, int enable);
    269 extern int temod16_cl37_high_vco_set(PHYMOD_ST* pc, int value);
    270 extern int temod16_osdfe_on_lkup_get(PHYMOD_ST* pc, temod16_spd_intfc_type spd_intf, uint32_t* osdfe_on);
    271 extern int temod16_scrambling_dis_lkup_get(PHYMOD_ST* pc, temod16_spd_intfc_type spd_intf, uint32_t* scrambling_dis);
    272 extern int temod16_override_clear(PHYMOD_ST* pc, override_type_t or_type);
    273 extern int temod16_set_spd_intf(PHYMOD_ST *pc, temod16_spd_intfc_type spd_intf, int no_trig);
    274 extern int temod16_rx_squelch_set(PHYMOD_ST *pc, int enable);
    275 extern int temod16_rx_squelch_get(PHYMOD_ST *pc, int *val);
    276 extern int temod16_port_enable_set(PHYMOD_ST *pc, int enable);
    277 extern int temod16_tx_squelch_set(PHYMOD_ST *pc, int enable);
    278 extern int temod16_tx_squelch_get(PHYMOD_ST *pc, int *val);
    279 extern int temod16_tx_lane_control_get(PHYMOD_ST* pc, int *reset, int *enable);
    280 extern int temod16_pmd_lane_swap(PHYMOD_ST *pc);
    281 extern int temod16_get_pcs_latched_link_status(PHYMOD_ST* pc, uint32_t *link);
    282 extern int temod16_pmd_x4_reset_get(PHYMOD_ST* pc, int *is_in_reset);
    283 extern int temod16_pmd_osmode_get(PHYMOD_ST* pc, int *os_mode);
    284 extern int temod16_plldiv_lkup_get(PHYMOD_ST* pc, temod16_spd_intfc_type spd_intf, phymod_ref_clk_t ref_clk,  uint32_t *plldiv, uint16_t *speed_vec);
    285 extern int temod16_pll_config_set(const phymod_access_t *pa, temod16_pll_mode_type  pll_mode, phymod_ref_clk_t ref_clk);
    286 extern int temod16_pll_reset_enable_set(PHYMOD_ST *pa , int enable);
    287 extern int temod16_disable_get(PHYMOD_ST *pa, uint32_t *enable);
    288 extern int temod16_eee_control_set(PHYMOD_ST* pc, uint32_t enable);
    289 extern int temod16_eee_control_get(PHYMOD_ST* pc, uint32_t *enable);
    290 
    291 #ifdef _SDK_TEMOD16_
    292 extern int temod16_autoneg_set_init(PHYMOD_ST* pc, temod16_an_init_t *an_init_st);
    293 extern int temod16_autoneg_control(PHYMOD_ST* pc, temod16_an_control_t *an_control);
    294 extern int temod16_autoneg_timer_init(PHYMOD_ST* pc);
    295 extern int temod16_autoneg_set(PHYMOD_ST* pc, temod16_an_ability_t *an_ability_st);
    296 extern int temod16_set_an_port_mode(PHYMOD_ST* pc, int enable, int nl_encoded, int starting_lane, int single_port);
    297 extern int temod16_pmd_lane_swap_tx(PHYMOD_ST *pc, uint32_t tx_lane_map_0, uint32_t tx_lane_map_1, uint32_t tx_lane_map_2, uint32_t tx_lane_map_3);
    298 extern int temod16_tsc12_control(PHYMOD_ST* pc, int cl82_multi_pipe_mode, int cl82_mld_phys_map);
    299 #endif
    300 
    301 extern int temod16_autoneg_local_ability_get(PHYMOD_ST* pc, temod16_an_ability_t *an_ability_st);
    302 extern int temod16_diag_disp(PHYMOD_ST *pc, const char* cmd_str);
    303 extern int temod16_autoneg_remote_ability_get(PHYMOD_ST* pc, temod16_an_ability_t *an_ability_st);
    304 extern int temod16_set_an_fail_count(PHYMOD_ST* pc, int count);
    305 
    306 extern int temod16_synce_stg0_mode_set(PHYMOD_ST *pc, int mode);
    307 extern int temod16_synce_stg0_mode_get(PHYMOD_ST *pc, int *mode);
    308 extern int temod16_synce_stg1_mode_set(PHYMOD_ST *pc, int mode);
    309 extern int temod16_synce_stg1_mode_get(PHYMOD_ST *pc, int *mode);
    310 extern int temod16_synce_clk_ctrl_set(PHYMOD_ST *pc, uint32_t val);
    311 extern int temod16_synce_clk_ctrl_get(PHYMOD_ST *pc, uint32_t *val);
    312 
    313 #endif  /*  _temod16_H_ */
    314