/******************************************************************************* NAME $RCSfile: commI2cApi.h,v $ SUMMARY Public APIs header for I2C/SMBus devices VERSION $Revision: 1.5 $ UPDATE DATE $Date: 2009/10/30 08:33:41 $ PROGRAMMER $Author: cloud $ Copyright 2009 LSI Corporation. All Rights Reserved. DESCRIPTION: REFERENCE: *******************************************************************************/ #ifndef __INCcommI2cApi #define __INCcommI2cApi #include #include "i2c-address.h" #if defined(CHASSIS_WSAS) #include "wemblySAS.h" #endif #define ZEBULON_I2C_BUS_NUM 3 #define ZEBULON_I2C_BUS_0 0 #define ZEBULON_I2C_BUS_1 1 #define ZEBULON_I2C_BUS_2 2 #define PCA9548_NCHANS 8 #define PCA9548_CHANNEL_0 0 #define PCA9548_CHANNEL_1 1 #define PCA9548_CHANNEL_2 2 #define PCA9548_CHANNEL_3 3 #define PCA9548_CHANNEL_4 4 #define PCA9548_CHANNEL_5 5 #define PCA9548_CHANNEL_6 6 #define PCA9548_CHANNEL_7 7 /* I2c bus handler for PCH */ extern struct i2c_adapter *pchAdapter; /* I2c bus handler for zebulon i2c master */ extern struct i2c_adapter *zebulonAdapter[ZEBULON_I2C_BUS_NUM]; /* Exported from pca9548 kernel driver */ extern void pca9548_mutex_lock(struct i2c_client *); extern void pca9548_mutex_unlock(struct i2c_client *); /* Public i2c APIs */ int i2cPca9548Read(struct i2c_adapter *adap, uint16_t addr, uint8_t *data); int i2cPca9548Write(struct i2c_adapter *adap, uint16_t addr, uint8_t value); int i2cEeprom64KBitRead(struct i2c_adapter *adap, uint16_t i2c_addr, uint16_t offset, uint8_t *buf, int count); int i2cEeprom64KBitWrite(struct i2c_adapter *adap, uint16_t i2c_addr, uint16_t offset, uint8_t *buf, int count); int i2cEeprom4KBitRead(struct i2c_adapter *adap, uint16_t i2c_addr, uint16_t offset, uint8_t *buf, int count); int i2cEeprom4KBitWrite(struct i2c_adapter *adap, uint16_t i2c_addr, uint16_t offset, uint8_t *buf, int count); int i2cSMbusReadByte(struct i2c_adapter *adap, uint16_t i2c_addr, uint8_t command, uint8_t *byte); int i2cSMbusWriteByte(struct i2c_adapter *adap, uint16_t i2c_addr, uint8_t command, uint8_t byte); #if defined(CHASSIS_WSAS) int i2cSMbusReadBlock(struct i2c_adapter *adap, uint16_t i2c_addr, uint8_t command, uint8_t *block, uint8_t len); int i2cSMbusWriteBlock(struct i2c_adapter *adap, uint16_t i2c_addr, uint8_t command, uint8_t *block, uint8_t len); int i2cSMbusSendByte(struct i2c_adapter *adap, uint16_t i2c_addr, uint8_t command, uint8_t byte); s32 i2cSMbusWriteReadBlock(struct i2c_adapter *adap, uint16_t i2c_addr, uint8_t command, uint8_t *block, uint8_t len); #endif int i2cPlxCsrRead(struct i2c_adapter *adap, uint16_t offset, uint32_t *data); int i2cEeprom64KBitProgram(struct i2c_adapter *adap, uint16_t i2c_addr, uint16_t address, uint8_t *buf, int size); void dump_hex(char *buf, int length); #define i2cSFPRead i2cEeprom4KBitRead #endif /* __INCcommI2cApi */