]> Zhao Yanbai Git Server - minix.git/commitdiff
E1000 - reading EEPROM
authorTomas Hruby <thruby@few.vu.nl>
Thu, 7 Jul 2011 17:24:26 +0000 (17:24 +0000)
committerTomas Hruby <tom@minix3.org>
Fri, 8 Jul 2011 18:31:21 +0000 (20:31 +0200)
- once the DONE bit is set, we already have the data

drivers/e1000/e1000.c

index 302a91cf31b5b7b5abb10ada7399faaac2cb5df2..90235f0ff1c60f15bc1a1b1d7b2fac5d32779c90 100644 (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;
 }
 
 /*===========================================================================*