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

blmi_io.h (3448B)


      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 #ifndef BLMI_IO_H
      8 #define BLMI_IO_H
      9 #include <bbase_types.h>
     10 #include <blmi_err.h>
     11 
     12 
     13 #define BLMI_MAX_UNITS  BMF_MAX_MT_PORTS
     14 
     15 /*
     16  * typedef for address.
     17  */
     18 typedef buint32_t      blmi_dev_addr_t;
     19 
     20 /*
     21  * MACSEC I/O operation type identifier.
     22  */
     23 typedef enum {
     24 	BLMI_IO_REG_RD,   /* Register Read    */
     25 	BLMI_IO_REG_WR,   /* Register Write   */
     26 	BLMI_IO_TBL_RD,   /* Table Read       */
     27 	BLMI_IO_TBL_WR    /* Table Write      */
     28 } blmi_io_op_t;
     29 
     30 /*
     31  * MACSEC I/O callback prototype.
     32  */
     33 typedef int (*blmi_dev_io_f)(blmi_dev_addr_t devaddr,/* device addr*/
     34                                int dev_port,        /* dev port index  */
     35                                blmi_io_op_t op,  /* I/O operation   */  
     36                                buint32_t io_addr,   /* I/O address     */
     37                                int word_sz,         /* Word size       */
     38                                int num_entry,       /* Num entry       */
     39                                buint32_t *data);    /* Data buffer     */
     40 
     41 /*
     42  * MMI read callback prototype.
     43  */
     44 typedef int (*blmi_dev_mmi_mdio_rd_f)(blmi_dev_addr_t dev_addr, 
     45                                     buint32_t miim_reg, buint16_t *data);
     46 
     47 /*
     48  * MMI write callback prototype.
     49  */
     50 typedef int (*blmi_dev_mmi_mdio_wr_f)(blmi_dev_addr_t dev_addr, 
     51                                     buint32_t miim_reg, buint16_t data);
     52 
     53 /*
     54  * MMI IO callback registeration.
     55  */
     56 extern int
     57 blmi_dev_mmi_mdio_register(blmi_dev_mmi_mdio_rd_f mmi_rd_f,
     58                               blmi_dev_mmi_mdio_wr_f mmi_wr_f);
     59 
     60 /*
     61  * MDIO I/O operation type identifier.
     62  */
     63 typedef enum {
     64 	BLMI_MDIO_IO_REG_RD,   /* Register Read    */
     65 	BLMI_MDIO_IO_REG_WR    /* Register Write   */
     66 } blmi_mdio_io_op_t;
     67 
     68 /* MMI IO routine */
     69 /* MMI I/O function for MMI version 0, i.e. device bcm545XX. */
     70 extern int 
     71 blmi_io_mmi(blmi_dev_addr_t dev_addr, int dev_port, 
     72                    blmi_io_op_t op, buint32_t io_addr, 
     73                    int word_sz, int num_entry, buint32_t *data);
     74 
     75 /* MMI I/O function for MMI version 1 */
     76 extern buint32_t _blmi_mmi1_op_flags;
     77 typedef enum {
     78    BLMI_OP_FLAG_ACCESS_INHIBIT  =  (1<<0) /* Block Access */
     79 } blmi_op_flag_t;
     80 
     81 extern int
     82 blmi_io_mmi1_operational_flag_set(buint32_t flags, buint32_t mask);
     83 
     84 extern int 
     85 blmi_io_mmi1(blmi_dev_addr_t dev_addr, int dev_port, 
     86                    blmi_io_op_t op, buint32_t io_addr, 
     87                    int word_sz, int num_entry, buint32_t *data);
     88 
     89 /* MMI I/O function for MMI version 1 using clause45 */
     90 extern int 
     91 blmi_io_mmi1_cl45(blmi_dev_addr_t dev_addr, int dev_port, 
     92                      blmi_io_op_t op, buint32_t io_addr, 
     93                      int word_sz, int num_entry, buint32_t *data);
     94 
     95 /* MMI I/O function for MMI version 1 with quad select support */
     96 extern int 
     97 blmi_io_mmi1_quad(blmi_dev_addr_t dev_addr, int dev_port, 
     98                      blmi_io_op_t op, buint32_t io_addr, 
     99                      int word_sz, int num_entry, buint32_t *data);
    100 
    101 /* MDIO access routine. */
    102 extern int 
    103 blmi_io_mdio(blmi_dev_addr_t phy_addr, blmi_mdio_io_op_t op, 
    104                     buint32_t io_addr, buint16_t *data);
    105 
    106 #define BLMI_IO_CL45_ADDRESS(cl45_dev, reg)      \
    107                                 (((cl45_dev) << 16) | (reg))
    108 
    109 #endif /* BLMI_IO_H */
    110