E1000 - reading EEPROM

- once the DONE bit is set, we already have the data
This commit is contained in:
Tomas Hruby 2011-07-07 17:24:26 +00:00 committed by Tomas Hruby
parent 48a4ff2307
commit 123cf7fe37

View file

@ -941,20 +941,16 @@ void *v;
int reg;
{
e1000_t *e = (e1000_t *) v;
u16_t data;
u32_t data;
/* Request EEPROM read. */
e1000_reg_write(e, E1000_REG_EERD,
(reg << e->eeprom_addr_off) | (E1000_REG_EERD_START));
/* Wait until ready. */
while (!(e1000_reg_read(e, E1000_REG_EERD) &
e->eeprom_done_bit));
while (!(data = (e1000_reg_read(e, E1000_REG_EERD)) & e->eeprom_done_bit));
/* Fetch data. */
data = (e1000_reg_read(e, E1000_REG_EERD) &
E1000_REG_EERD_DATA) >> 16;
return data;
return data >> 16;
}
/*===========================================================================*