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
|
@ -744,9 +744,9 @@ poweroff(Ctlr *ctlr)
|
||||||
static char*
|
static char*
|
||||||
rominit(Ctlr *ctlr)
|
rominit(Ctlr *ctlr)
|
||||||
{
|
{
|
||||||
|
uint prev, last;
|
||||||
uchar buf[2];
|
uchar buf[2];
|
||||||
char *err;
|
char *err;
|
||||||
uint off;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
ctlr->eeprom.otp = 0;
|
ctlr->eeprom.otp = 0;
|
||||||
|
@ -785,18 +785,19 @@ rominit(Ctlr *ctlr)
|
||||||
* Find the block before last block (contains the EEPROM image)
|
* Find the block before last block (contains the EEPROM image)
|
||||||
* for HW without OTP shadow RAM.
|
* for HW without OTP shadow RAM.
|
||||||
*/
|
*/
|
||||||
off = 0;
|
prev = last = 0;
|
||||||
for(i=0; i<3; i++){
|
for(i=0; i<3; i++){
|
||||||
if((err = eepromread(ctlr, buf, 2, off)) != nil)
|
if((err = eepromread(ctlr, buf, 2, last)) != nil)
|
||||||
return err;
|
return err;
|
||||||
if(get16(buf) == 0)
|
if(get16(buf) == 0)
|
||||||
break;
|
break;
|
||||||
off = get16(buf);
|
prev = last;
|
||||||
|
last = get16(buf);
|
||||||
}
|
}
|
||||||
if(i == 0 || i >= 3)
|
if(i == 0 || i >= 3)
|
||||||
return "rominit: missing eeprom image";
|
return "rominit: missing eeprom image";
|
||||||
|
|
||||||
ctlr->eeprom.off = off+1;
|
ctlr->eeprom.off = prev+1;
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue