Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
ipath_eeprom.c File Reference
#include <linux/delay.h>
#include <linux/pci.h>
#include <linux/vmalloc.h>
#include "ipath_kernel.h"

Go to the source code of this file.

Data Structures

struct  i2c_chain_desc


#define IPATH_EEPROM_DEV_V1   0xA0
#define IPATH_EEPROM_DEV_V2   0xA2
#define IPATH_TEMP_DEV   0x98
#define IPATH_NO_DEV   (0xFF)
#define READ_CMD   1
#define WRITE_CMD   0
#define VALID_TS_WR_REG_MASK   ((1 << 9) | (1 << 0xB) | (1 << 0xD))


enum  i2c_type { i2c_line_scl = 0, i2c_line_sda }
enum  i2c_state { i2c_line_low = 0, i2c_line_high }


int ipath_eeprom_read (struct ipath_devdata *dd, u8 eeprom_offset, void *buff, int len)
int ipath_eeprom_write (struct ipath_devdata *dd, u8 eeprom_offset, const void *buff, int len)
void ipath_get_eeprom_info (struct ipath_devdata *dd)
int ipath_update_eeprom_log (struct ipath_devdata *dd)
void ipath_inc_eeprom_err (struct ipath_devdata *dd, u32 eidx, u32 incr)
int ipath_tempsense_read (struct ipath_devdata *dd, u8 regnum)
int ipath_tempsense_write (struct ipath_devdata *dd, u8 regnum, u8 data)

Macro Definition Documentation


Definition at line 69 of file ipath_eeprom.c.

#define IPATH_EEPROM_DEV_V1   0xA0

Definition at line 66 of file ipath_eeprom.c.

#define IPATH_EEPROM_DEV_V2   0xA2

Definition at line 67 of file ipath_eeprom.c.

#define IPATH_NO_DEV   (0xFF)

Definition at line 70 of file ipath_eeprom.c.

#define IPATH_TEMP_DEV   0x98

Definition at line 68 of file ipath_eeprom.c.

#define READ_CMD   1

Definition at line 102 of file ipath_eeprom.c.


Definition at line 1076 of file ipath_eeprom.c.

#define VALID_TS_WR_REG_MASK   ((1 << 9) | (1 << 0xB) | (1 << 0xD))

Definition at line 1153 of file ipath_eeprom.c.

#define WRITE_CMD   0

Definition at line 103 of file ipath_eeprom.c.

Enumeration Type Documentation

enum i2c_state

Definition at line 97 of file ipath_eeprom.c.

enum i2c_type

Definition at line 92 of file ipath_eeprom.c.

Function Documentation

int ipath_eeprom_read ( struct ipath_devdata dd,
u8  eeprom_offset,
void buff,
int  len 

ipath_eeprom_read - receives bytes from the eeprom via I2C : the infinipath device : address to read from : where to store result : number of bytes to receive

Definition at line 641 of file ipath_eeprom.c.

int ipath_eeprom_write ( struct ipath_devdata dd,
u8  eeprom_offset,
const void buff,
int  len 

ipath_eeprom_write - writes data to the eeprom via I2C : the infinipath device : where to place data : data to write : number of bytes to write

Definition at line 662 of file ipath_eeprom.c.

void ipath_get_eeprom_info ( struct ipath_devdata dd)

ipath_get_guid - get the GUID from the i2c device : the infinipath device

We have the capability to use the ipath_nguid field, and get the guid from the first chip's flash, to use for all of them.

Definition at line 706 of file ipath_eeprom.c.

void ipath_inc_eeprom_err ( struct ipath_devdata dd,
u32  eidx,
u32  incr 

ipath_inc_eeprom_err - increment one of the four error counters that are logged to EEPROM. : the infinipath device : 0..3, the counter to increment : how much to add

Each counter is 8-bits, and saturates at 255 (0xFF). They are copied to the EEPROM (aka flash) whenever ipath_update_eeprom_log() is called, but it can only be called in a context that allows sleep. This function can be called even at interrupt level.

Definition at line 1015 of file ipath_eeprom.c.

int ipath_tempsense_read ( struct ipath_devdata dd,
u8  regnum 

ipath_tempsense_read - read register of temp sensor via I2C : the infinipath device : register to read from

returns reg contents (0..255) or < 0 for error

Definition at line 1085 of file ipath_eeprom.c.

int ipath_tempsense_write ( struct ipath_devdata dd,
u8  regnum,
u8  data 

ipath_tempsense_write - write register of temp sensor via I2C : the infinipath device : register to write : data to write

returns 0 for success or < 0 for error

Definition at line 1163 of file ipath_eeprom.c.

int ipath_update_eeprom_log ( struct ipath_devdata dd)

ipath_update_eeprom_log - copy active-time and error counters to eeprom : the infinipath device

Although the time is kept as seconds in the ipath_devdata struct, it is rounded to hours for re-write, as we have only 16 bits in EEPROM. First-cut code reads whole (expected) struct ipath_flash, modifies, re-writes. Future direction: read/write only what we need, assuming that the EEPROM had to have been "good enough" for driver init, and if not, we aren't making it worse.

Definition at line 865 of file ipath_eeprom.c.