kernels/linux-2.4.0/drivers/net/sis900.c
/**
 *	read_eeprom: - Read Serial EEPROM
 *	@ioaddr: base i/o address
 *	@location: the EEPROM location to read
 *
 *	Read Serial EEPROM through EEPROM Access Register.
 *	Note that location is in word (16 bits) unit
 */
- Read Serial EEPROM
@ioaddr: base i/o address
@location: the EEPROM location to read

Read Serial EEPROM through EEPROM Access Register.
Note that location is in word (16 bits) unit
- Read Serial EEPROM @ioaddr : base i / o address @location : the EEPROM location to read Read Serial EEPROM through EEPROM Access Register . Note that location is in word ( 16 bits ) unit
static u16 read_eeprom(long ioaddr, int location)
{
	int i;
	u16 retval = 0;
	long ee_addr = ioaddr + mear;
	u32 read_cmd = location | EEread;
	outl(0, ee_addr);
	eeprom_delay();
	outl(EECLK, ee_addr);
	eeprom_delay();
	for (i = 8; i >= 0; i--) {
		u32 dataval = (read_cmd & (1 << i)) ? EEDI | EECS : EECS;
		outl(dataval, ee_addr);
		eeprom_delay();
		outl(dataval | EECLK, ee_addr);
		eeprom_delay();
	}
	outb(EECS, ee_addr);
	eeprom_delay();
	for (i = 16; i > 0; i--) {
		outl(EECS, ee_addr);
		eeprom_delay();
		outl(EECS | EECLK, ee_addr);
		eeprom_delay();
		retval = (retval << 1) | ((inl(ee_addr) & EEDO) ? 1 : 0);
		eeprom_delay();
	}
	outl(0, ee_addr);
	eeprom_delay();
	outl(EECLK, ee_addr);
	return (retval);
}
static u16 read_eeprom ( long ioaddr , int location ) { int i ; u16 retval = 0 ; long ee_addr = ioaddr + mear ; u32 read_cmd = location | EEread ; outl ( 0 , ee_addr ) ; eeprom_delay ( ) ; outl ( EECLK , ee_addr ) ; eeprom_delay ( ) ; for ( i = 8 ; i >= 0 ; i -- ) { u32 dataval = ( read_cmd & ( 1 << i ) ) ? EEDI | EECS : EECS ; outl ( dataval , ee_addr ) ; eeprom_delay ( ) ; outl ( dataval | EECLK , ee_addr ) ; eeprom_delay ( ) ; } outb ( EECS , ee_addr ) ; eeprom_delay ( ) ; for ( i = 16 ; i > 0 ; i -- ) { outl ( EECS , ee_addr ) ; eeprom_delay ( ) ; outl ( EECS | EECLK , ee_addr ) ; eeprom_delay ( ) ; retval = ( retval << 1 ) | ( ( inl ( ee_addr ) & EEDO ) ? 1 : 0 ) ; eeprom_delay ( ) ; } outl ( 0 , ee_addr ) ; eeprom_delay ( ) ; outl ( EECLK , ee_addr ) ; return ( retval ) ; }
read_eeprom: - Read Serial EEPROM
      @ioaddr: base i/o address
      @location: the EEPROM location to read
read_eeprom : - Read Serial EEPROM @ioaddr : base i / o address @location : the EEPROM location to read
/* Shift the read command (9) bits out. */ /* read the 16-bits data in */ /* Terminate the EEPROM access. */