Commit 0aeb623d authored by Ali Bahar's avatar Ali Bahar Committed by Greg Kroah-Hartman

staging: r8712u: Merging Realtek's latest (v2.6.6). Rework efuse data handling.

Rework efuse data handling.
Signed-off-by: default avatarAli Bahar <ali@internetDog.org>
Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 07a6b037
...@@ -307,21 +307,25 @@ static u8 fix_header(struct _adapter *padapter, u8 header, u16 header_addr) ...@@ -307,21 +307,25 @@ static u8 fix_header(struct _adapter *padapter, u8 header, u16 header_addr)
continue; continue;
} }
for (i = 0; i < PGPKG_MAX_WORDS; i++) { for (i = 0; i < PGPKG_MAX_WORDS; i++) {
if (BIT(i) & word_en) if (BIT(i) & word_en) {
continue; if (BIT(i) & pkt.word_en) {
if (!(BIT(i) & pkt.word_en)) { if (efuse_one_byte_read(
if (efuse_one_byte_read(padapter, addr, padapter, addr,
&value) == true) &value) == true)
pkt.data[i*2] = value; pkt.data[i*2] = value;
else else
return false; return false;
if (efuse_one_byte_read(padapter, addr + 1, if (efuse_one_byte_read(
&value) == true) padapter,
pkt.data[i*2 + 1] = value; addr + 1,
else &value) == true)
return false; pkt.data[i*2 + 1] =
value;
else
return false;
}
addr += 2;
} }
addr += 2;
} }
} }
if (addr != header_addr) if (addr != header_addr)
...@@ -329,26 +333,29 @@ static u8 fix_header(struct _adapter *padapter, u8 header, u16 header_addr) ...@@ -329,26 +333,29 @@ static u8 fix_header(struct _adapter *padapter, u8 header, u16 header_addr)
addr++; addr++;
/* fill original data */ /* fill original data */
for (i = 0; i < PGPKG_MAX_WORDS; i++) { for (i = 0; i < PGPKG_MAX_WORDS; i++) {
if (BIT(i) & pkt.word_en) if (BIT(i) & pkt.word_en) {
continue; efuse_one_byte_write(padapter, addr, pkt.data[i*2]);
efuse_one_byte_write(padapter, addr, pkt.data[i*2]); efuse_one_byte_write(padapter, addr+1,
efuse_one_byte_write(padapter, addr+1, pkt.data[i*2 + 1]); pkt.data[i*2 + 1]);
/* additional check */ /* additional check */
if (efuse_one_byte_read(padapter, addr, &value) == false) if (efuse_one_byte_read(padapter, addr, &value)
ret = false; == false)
else if (pkt.data[i*2] != value) { ret = false;
ret = false; else if (pkt.data[i*2] != value) {
if (0xFF == value) /* write again */ ret = false;
efuse_one_byte_write(padapter, addr, if (0xFF == value) /* write again */
pkt.data[i * 2]); efuse_one_byte_write(padapter, addr,
} pkt.data[i * 2]);
if (efuse_one_byte_read(padapter, addr+1, &value) == false) }
ret = false; if (efuse_one_byte_read(padapter, addr+1, &value) ==
else if (pkt.data[i*2 + 1] != value) { false)
ret = false; ret = false;
if (0xFF == value) /* write again */ else if (pkt.data[i*2 + 1] != value) {
efuse_one_byte_write(padapter, addr+1, ret = false;
pkt.data[i*2 + 1]); if (0xFF == value) /* write again */
efuse_one_byte_write(padapter, addr+1,
pkt.data[i*2 + 1]);
}
} }
addr += 2; addr += 2;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment