kernels/linux-2.4.0/drivers/net/dmfe.c
/*
   Read one word data from the serial ROM
 */
Read one word data from the serial ROM
Read one word data from the serial ROM
static u16 read_srom_word(long ioaddr, int offset)
{
	int i;
	u16 srom_data = 0;
	long cr9_ioaddr = ioaddr + DCR9;
	outl(CR9_SROM_READ, cr9_ioaddr);
	outl(CR9_SROM_READ | CR9_SRCS, cr9_ioaddr);
	SROM_CLK_WRITE(SROM_DATA_1, cr9_ioaddr);
	SROM_CLK_WRITE(SROM_DATA_1, cr9_ioaddr);
	SROM_CLK_WRITE(SROM_DATA_0, cr9_ioaddr);
	for (i = 5; i >= 0; i--) {
		srom_data = (offset & (1 << i)) ? SROM_DATA_1 : SROM_DATA_0;
		SROM_CLK_WRITE(srom_data, cr9_ioaddr);
	}
	outl(CR9_SROM_READ | CR9_SRCS, cr9_ioaddr);
	for (i = 16; i > 0; i--) {
		outl(CR9_SROM_READ | CR9_SRCS | CR9_SRCLK, cr9_ioaddr);
		DELAY_5US;
		srom_data = (srom_data << 1) | ((inl(cr9_ioaddr) & CR9_CRDOUT) ? 1 : 0);
		outl(CR9_SROM_READ | CR9_SRCS, cr9_ioaddr);
		DELAY_5US;
	}
	outl(CR9_SROM_READ, cr9_ioaddr);
	return srom_data;
}
static u16 read_srom_word ( long ioaddr , int offset ) { int i ; u16 srom_data = 0 ; long cr9_ioaddr = ioaddr + DCR9 ; outl ( CR9_SROM_READ , cr9_ioaddr ) ; outl ( CR9_SROM_READ | CR9_SRCS , cr9_ioaddr ) ; SROM_CLK_WRITE ( SROM_DATA_1 , cr9_ioaddr ) ; SROM_CLK_WRITE ( SROM_DATA_1 , cr9_ioaddr ) ; SROM_CLK_WRITE ( SROM_DATA_0 , cr9_ioaddr ) ; for ( i = 5 ; i >= 0 ; i -- ) { srom_data = ( offset & ( 1 << i ) ) ? SROM_DATA_1 : SROM_DATA_0 ; SROM_CLK_WRITE ( srom_data , cr9_ioaddr ) ; } outl ( CR9_SROM_READ | CR9_SRCS , cr9_ioaddr ) ; for ( i = 16 ; i > 0 ; i -- ) { outl ( CR9_SROM_READ | CR9_SRCS | CR9_SRCLK , cr9_ioaddr ) ; DELAY_5US ; srom_data = ( srom_data << 1 ) | ( ( inl ( cr9_ioaddr ) & CR9_CRDOUT ) ? 1 : 0 ) ; outl ( CR9_SROM_READ | CR9_SRCS , cr9_ioaddr ) ; DELAY_5US ; } outl ( CR9_SROM_READ , cr9_ioaddr ) ; return srom_data ; }
Read one word data from the serial ROM
Read one word data from the serial ROM
/* Send the Read Command 110b */ /* Send the offset */