etheriwl: fix rominit
we used use the *last* block in otp block list instead of the block *before* the last block resulting in wrong eeprom data (1000er series only)
This commit is contained in:
parent
e68130f082
commit
00ba1aac9e
1 changed files with 6 additions and 5 deletions
|
@ -744,9 +744,9 @@ poweroff(Ctlr *ctlr)
|
|||
static char*
|
||||
rominit(Ctlr *ctlr)
|
||||
{
|
||||
uint prev, last;
|
||||
uchar buf[2];
|
||||
char *err;
|
||||
uint off;
|
||||
int i;
|
||||
|
||||
ctlr->eeprom.otp = 0;
|
||||
|
@ -785,18 +785,19 @@ rominit(Ctlr *ctlr)
|
|||
* Find the block before last block (contains the EEPROM image)
|
||||
* for HW without OTP shadow RAM.
|
||||
*/
|
||||
off = 0;
|
||||
prev = last = 0;
|
||||
for(i=0; i<3; i++){
|
||||
if((err = eepromread(ctlr, buf, 2, off)) != nil)
|
||||
if((err = eepromread(ctlr, buf, 2, last)) != nil)
|
||||
return err;
|
||||
if(get16(buf) == 0)
|
||||
break;
|
||||
off = get16(buf);
|
||||
prev = last;
|
||||
last = get16(buf);
|
||||
}
|
||||
if(i == 0 || i >= 3)
|
||||
return "rominit: missing eeprom image";
|
||||
|
||||
ctlr->eeprom.off = off+1;
|
||||
ctlr->eeprom.off = prev+1;
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue