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

phy84756_i2c.h (2042B)


      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 
      8 #ifndef _PHY84756_I2C_H
      9 #define _PHY84756_I2C_H
     10 /* I2C related defines */
     11 #define PHY84756_BSC_XFER_MAX     0x1F9
     12 #define PHY84756_BSC_WR_MAX       16
     13 #define PHY84756_WRITE_START_ADDR 0x8007
     14 #define PHY84756_READ_START_ADDR  0x8007
     15 #define PHY84756_WR_FREQ_400KHZ   0x0100
     16 #define PHY84756_2W_STAT          0x000C
     17 #define PHY84756_2W_STAT_IDLE     0x0000
     18 #define PHY84756_2W_STAT_COMPLETE 0x0004
     19 #define PHY84756_2W_STAT_IN_PRG   0x0008
     20 #define PHY84756_2W_STAT_FAIL     0x000C
     21 #define PHY84756_BSC_WRITE_OP     0x22
     22 #define PHY84756_BSC_READ_OP      0x2
     23 #define PHY84756_I2CDEV_WRITE     0x1
     24 #define PHY84756_I2CDEV_READ      0x0
     25 #define PHY84756_I2C_8BIT         0
     26 #define PHY84756_I2C_16BIT        1
     27 #define PHY84756_I2C_TEMP_RAM     0xE
     28 #define PHY84756_I2C_OP_TYPE(access_type,data_type) \
     29         ((access_type) | ((data_type) << 8))
     30 #define PHY84756_I2C_ACCESS_TYPE(op_type) ((op_type) & 0xff)
     31 #define PHY84756_I2C_DATA_TYPE(op_type)   (((op_type) >> 8) & 0xff)
     32 
     33 extern int
     34 _phy_84756_bsc_rw(phy_ctrl_t *pc, int dev_addr, int opr,
     35                     int addr, int count, void *data_array,buint32_t ram_start);
     36 
     37 extern int
     38 phy_84756_i2cdev_read(phy_ctrl_t *pc,
     39                      int dev_addr,  /* 7 bit I2C bus device address */
     40                      int offset,    /* starting data address to read */
     41                      int nbytes,    /* number of bytes to read */
     42                      buint8_t *read_array);   /* buffer to hold retrieved data */
     43 
     44 
     45 extern int
     46 phy_84756_i2cdev_write(phy_ctrl_t *pc,
     47                      int dev_addr,  /* I2C bus device address */
     48                      int offset,    /* starting data address to write to */
     49                      int nbytes,    /* number of bytes to write */
     50                      buint8_t *write_array);   /* buffer to hold written data */
     51 
     52 #endif /* _PHY84756_I2C_H */
     53 
     54