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

bcm_iunimac.h (11388B)


      1 /*
      2  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      3  * 
      4  * Copyright 2007-2019 Broadcom Inc. All rights reserved.
      5  */
      6 
      7 #ifndef BCM_IUNIMAC_H
      8 #define BCM_IUNIMAC_H
      9 #include "phy_mac_ctrl.h"
     10 
     11 /***************************************************************
     12  * Unimac driver functions.
     13  */
     14 /*
     15  * Function:
     16  *    imacsec_plp_base_t_unimac_init
     17  * Purpose:
     18  *    Initialize the MAC
     19  * Initialization is done as a part of the PHY initialization sequence
     20  * that initializes MAC to default settings.
     21  * Parameters:
     22  * @param unit (input) BCM unit number
     23  * @param port (input) - port number
     24  * @param if_side (input) - Select the side
     25  *  0       LINE_SIDE
     26  *  1       SYSTEM_SIDE
     27  * Notes:
     28  * The MAC will be put in Auto config mode at initilization
     29  * MAX Frame Size = 0x3fff
     30  * IPG = 12
     31  * TX and RX are enabled
     32  */
     33 int
     34 imacsec_plp_base_t_unimac_init(int unit, soc_port_t port,int if_side);
     35 
     36 /*
     37  * Function:
     38  *    imacsec_plp_base_t_unimac_auto_cfg
     39  * Purpose:
     40  *    This function puts the MAC in auto config if auto_cfg is 1.
     41  * Parameters:
     42  * @param unit (input) BCM unit number
     43  * @param port (input) - port number
     44  * @param if_side (input) - Select the side
     45  *  0       LINE_SIDE
     46  *  1       SYSTEM_SIDE
     47  * @param auto_cfg - Auto configuration flag
     48  *               1 = Auto configuration
     49  *               0 = Forced mode
     50  * Notes:
     51  */
     52 int
     53 imacsec_plp_base_t_unimac_auto_cfg(int unit, soc_port_t port,int if_side, int auto_cfg);
     54 
     55 /*
     56  * Function:
     57  *    imacsec_plp_base_t_unimac_reset
     58  * Purpose:
     59  *    This function puts the MAC in reset if reset is 1 else takes MAC
     60  *    out of reset
     61  * Parameters:
     62  * @param unit (input) BCM unit number
     63  * @param port (input) - port number
     64  * @param if_side (input) - Select the side
     65  *  0       LINE_SIDE
     66  *  1       SYSTEM_SIDE
     67  * @param   reset    - Reset MAC
     68  *               1 = Put in Reset
     69  *               0 = Take out of reset
     70  * Notes:
     71  */
     72 int
     73 imacsec_plp_base_t_unimac_reset(int unit, soc_port_t port,int if_side, int reset);
     74 
     75 /*
     76  * Function:
     77  *    imacsec_plp_base_t_unimac_enable_set
     78  * Purpose:
     79  *    Enable/Disable MAC
     80  * Parameters:
     81  * @param unit (input) BCM unit number
     82  * @param port (input) - port number
     83  * @param if_side (input) - Select the side
     84  *  0       LINE_SIDE
     85  *  1       SYSTEM_SIDE
     86  * @param   enable - Enable flag
     87  *               1 = Enable MAC
     88  *               0 = Disable MAC
     89  * Notes:
     90  */
     91 int
     92 imacsec_plp_base_t_unimac_enable_set(int unit, soc_port_t port,int if_side, int enable);
     93 /*
     94  * Function:
     95  *    imacsec_plp_base_t_unimac_enable_get
     96  * Purpose:
     97  *    Get the enable status of MAC
     98  * Parameters:
     99  * @param unit (input) BCM unit number
    100  * @param port (input) - port number
    101  * @param if_side (input) - Select the side
    102  *  0       LINE_SIDE
    103  *  1       SYSTEM_SIDE
    104  * @param enable   - (OUT)Enable flag
    105  *               1 = Enable MAC
    106  *               0 = Disable MAC
    107  * Notes:
    108  */
    109 int
    110 imacsec_plp_base_t_unimac_enable_get(int unit, soc_port_t port, int if_side, int *enable);
    111 /*
    112  * Function:
    113  *    imacsec_plp_base_t_unimac_speed_set
    114  * Purpose:
    115  *    Set Speed of the MAC
    116  * Parameters:
    117  * @param unit (input) BCM unit number
    118  * @param port (input) - port number
    119  * @param if_side (input) - Select the side
    120  *  0       LINE_SIDE
    121  *  1       SYSTEM_SIDE
    122  * @param   speed    - 1000 - 1000Mbps
    123  *               100  - 100Mbps
    124  *               10   - 10Mbps
    125  * Notes:
    126  */
    127 int
    128 imacsec_plp_base_t_unimac_speed_set(int unit, soc_port_t port, int if_side, int speed);
    129 /*
    130  * Function:
    131  *    imacsec_plp_base_t_unimac_speed_get
    132  * Purpose:
    133  *    Get Speed of the MAC
    134  * Parameters:
    135  * @param unit (input) BCM unit number
    136  * @param port (input) - port number
    137  * @param if_side (input) - Select the side
    138  *  0       LINE_SIDE
    139  *  1       SYSTEM_SIDE
    140  * @param   speed    - (OUT) 1000 - 1000Mbps
    141  *                     100  - 100Mbps
    142  *                     10   - 10Mbps
    143  * Notes:
    144  */
    145 int
    146 imacsec_plp_base_t_unimac_speed_get(int unit, soc_port_t port, int if_side, int *speed);
    147 /*
    148  * Function:
    149  *    imacsec_plp_base_t_unimac_duplex_set
    150  * Purpose:
    151  *    Set Duplex of the MAC
    152  * Parameters:
    153  * @param unit (input) BCM unit number
    154  * @param port (input) - port number
    155  * @param if_side (input) - Select the side
    156  *  0       LINE_SIDE
    157  *  1       SYSTEM_SIDE
    158  * @param   duplex   - 1 - Full Duplex
    159  *                   0 - Half Duplex
    160  * Notes:
    161  */
    162 int
    163 imacsec_plp_base_t_unimac_duplex_set(int unit, soc_port_t port, int if_side, int duplex);
    164 /*
    165  * Function:
    166  *    imacsec_plp_base_t_unimac_duplex_get
    167  * Purpose:
    168  *    Get Duplex of the MAC
    169  * Parameters:
    170  * @param unit (input) BCM unit number
    171  * @param port (input) - port number
    172  * @param if_side (input) - Select the side
    173  *  0       LINE_SIDE
    174  *  1       SYSTEM_SIDE
    175  * @param   duplex   - (OUT) 0 - Full Duplex
    176  *                     1 - Half Duplex
    177  * Notes:
    178  */
    179 int
    180 imacsec_plp_base_t_unimac_duplex_get(int unit, soc_port_t port, int if_side, int *duplex);
    181 /*
    182  * Function:
    183  *    imacsec_plp_base_t_unimac_pause_set
    184  * Purpose:
    185  *    Set pause of the MAC
    186  * Parameters:
    187  * @param unit (input) BCM unit number
    188  * @param port (input) - port number
    189  * @param if_side (input) - Select the side
    190  *  0       LINE_SIDE
    191  *  1       SYSTEM_SIDE
    192  * @param   pause   - 1 - Pause enable
    193  *               0 - Pause disable
    194  * Notes:
    195  */
    196 int
    197 imacsec_plp_base_t_unimac_pause_set(int unit, soc_port_t port, int if_side, int pause);
    198 /*
    199  * Function:
    200  *    imacsec_plp_base_t_unimac_update_ipg
    201  * Purpose:
    202  *    Set IPG of the MAC
    203  * Parameters:
    204  * @param unit (input) BCM unit number
    205  * @param port (input) - port number
    206  * @param if_side (input) - Select the side
    207  *  0       LINE_SIDE
    208  *  1       SYSTEM_SIDE
    209  * @param   ipg      - IPG value
    210  * Notes:
    211  */
    212 int
    213 imacsec_plp_base_t_unimac_update_ipg(int unit, soc_port_t port, int if_side, int ipg);
    214 /*
    215  * Function:
    216  *    imacsec_plp_base_t_unimac_max_frame_set
    217  * Purpose:
    218  *    Set Max frame of the MAC
    219  *
    220  * Maximum Frame size shouldn;t be less 48 and cannot be greater than
    221  * 0x3fff
    222  *
    223  * Parameters:
    224  * @param unit (input) BCM unit number
    225  * @param port (input) - port number
    226  * @param if_side (input) - Select the side
    227  *  0       LINE_SIDE
    228  *  1       SYSTEM_SIDE
    229  * @param   max_frame - Max frame value
    230  * Notes:
    231  */
    232 int
    233 imacsec_plp_base_t_unimac_max_frame_set(int unit, soc_port_t port, int if_side, uint32 max_frame);
    234 /*
    235  * Function:
    236  *    imacsec_plp_base_t_unimac_max_frame_get
    237  * Purpose:
    238  *    Get Max frame of the MAC
    239  * Parameters:
    240  * @param unit (input) BCM unit number
    241  * @param port (input) - port number
    242  * @param if_side (input) - Select the side
    243  *  0       LINE_SIDE
    244  *  1       SYSTEM_SIDE
    245  * @param   max_frame - (OUT) Max frame
    246  * Notes:
    247  */
    248 int
    249 imacsec_plp_base_t_unimac_max_frame_get(int unit, soc_port_t port, int if_side, uint32 *max_frame);
    250 /*
    251  * Function:
    252  *    imacsec_plp_base_t_unimac_pause_frame_fwd_set
    253  * Purpose:
    254  *    Enable/Disable Pause Frame Forward
    255  * Parameters:
    256  * @param unit (input) BCM unit number
    257  * @param port (input) - port number
    258  * @param if_side (input) - Select the side
    259  *  0       LINE_SIDE
    260  *  1       SYSTEM_SIDE
    261  * @param   pause_fwd - Pause forward
    262  *                1 - Forward pause
    263  *                0 - Consume PAUSE.
    264  * Notes:
    265  */
    266 int
    267 imacsec_plp_base_t_unimac_pause_frame_fwd_set(int unit, soc_port_t port, int if_side, int pause_fwd);
    268 /*
    269  * Function:
    270  *    imacsec_plp_base_t_unimac_pause_frame_fwd_get
    271  * Purpose:
    272  *    Get the status of Pause Frame Forward
    273  * Parameters:
    274  * @param unit (input) BCM unit number
    275  * @param port (input) - port number
    276  * @param if_side (input) - Select the side
    277  *  0       LINE_SIDE
    278  *  1       SYSTEM_SIDE
    279  * @param   pause_fwd - Pause forward
    280  *                1 - Forward pause
    281  *                0 - Consume PAUSE.
    282  * Notes:
    283  */
    284 int
    285 imacsec_plp_base_t_unimac_pause_frame_fwd_get(int unit, soc_port_t port, int if_side, int *pause_fwd);
    286 /*
    287  * Function:
    288  *    imacsec_plp_base_t_unimac_switch_side_set_params
    289  * Purpose:
    290  *    To set Switch side speed, duplex and pause parameters
    291  * Parameters:
    292  * @param unit (input) BCM unit number
    293  * @param port (input) - port number
    294  *    switch_side_policy - PHY_MAC_SWITCH_FIXED
    295  *                         ( Switch side is in fixed mode, and the speed
    296  *                           duplex and pause settings are provided by the
    297  *                           caller ).
    298  *                       - PHY_MAC_SWITCH_FOLLOWS_LINE
    299  *                         ( Switch side follows line side operating
    300  *                           parameters. Autoconfig mode ).
    301  *                       - PHY_MAC_SWITCH_DUPLEX_GATEWAY
    302  *                         ( half-duplex on Line-side MAC, and
    303  *                           full-duplex on switch-side MAC )
    304  *    speed     - Speed to set
    305  *                   10   = 10Mbps
    306  *                   100  = 100Mbps
    307  *                   1000 = 1000Mbps
    308  *    duplex    - Half Duplex = BMACSEC_HALF_DUPLEX
    309  *              - Full Duplex = BMACSEC_FULL_DUPLEX
    310  *    pause_enable - 1 = enables pause
    311  *                 - 0 = disables pause.
    312  * Returns:
    313  */
    314 int
    315 imacsec_plp_base_t_unimac_switch_side_set_params(int unit, soc_port_t port,
    316                                     phy_mac_policy_t switch_side_policy,
    317                                     int speed, int duplex, int pause_enable);
    318 /*
    319  * Function:
    320  *    imacsec_plp_base_t_unimac_frame_len_check_enable
    321  * Purpose:
    322  *    Enable the frame length check error mask in RSV vector
    323  *    to signal error to encryption block
    324  * Parameters:
    325  *
    326  * @param unit (input) BCM unit number
    327  * @param port (input) - port number
    328  * @param if_side (input) - Select the side
    329  *  0       LINE_SIDE
    330  *  1       SYSTEM_SIDE
    331  *    enable - Enable the error mask
    332  *    1 -  enable
    333  *    0 -  disable
    334  * Notes:
    335  */
    336 int
    337 imacsec_plp_base_t_unimac_frame_len_check_enable(int unit, soc_port_t port,
    338                                                  int if_side, int enable);
    339 
    340 /*
    341  * Function:
    342  *    imacsec_plp_base_t_unimac_rx_enable_set
    343  * Purpose:
    344  *    Enable/Disable MAC RX
    345  * Parameters:
    346  * @param unit (input) BCM unit number
    347  * @param port (input) - port number
    348  * @param if_side (input) - Select the side
    349  *  0       LINE_SIDE
    350  *  1       SYSTEM_SIDE
    351 
    352  *    enable - Enable the Rx
    353  *    1 -  enable
    354  *    0 -  disable
    355  * Notes:
    356  */
    357 int
    358 imacsec_plp_base_t_unimac_rx_enable_set(int unit, soc_port_t port, int if_side, int enable);
    359 
    360 /*
    361  * Function:
    362  *    imacsec_plp_base_t_unimac_tx_enable_set
    363  * Purpose:
    364  *    Enable/Disable MAC TX
    365  * Parameters:
    366  * @param unit (input) BCM unit number
    367  * @param port (input) - port number
    368  * @param if_side (input) - Select the side
    369  *  0       LINE_SIDE
    370  *  1       SYSTEM_SIDE
    371 
    372  *    enable - Enable the Tx
    373  *    1 -  enable
    374  *    0 -  disable
    375  * Notes:
    376  */
    377 int
    378 imacsec_plp_base_t_unimac_tx_enable_set(int unit, soc_port_t port, int if_side, int enable);
    379 
    380 /*
    381  * Function:
    382  *    imacsec_plp_base_t_unimac_tx_datapath_flush
    383  * Purpose:
    384  *    TX-FIFO flush control enable
    385  * Parameters:
    386  * @param unit (input) BCM unit number
    387  * @param port (input) - port number
    388  * @param if_side (input) - Select the side
    389  *  0       LINE_SIDE
    390  *  1       SYSTEM_SIDE
    391  * Notes: Before calling TX datapath flush user has to disable pause function
    392  *  once TX_FIFO is empty reenable the pause function
    393  */
    394 int
    395 imacsec_plp_base_t_unimac_tx_datapath_flush(int unit, soc_port_t port, int if_side, int enable);
    396 
    397 #endif /* BCM_IUNIMAC_H */