rtl8188eu: Fix endedness of EEPROM readout for BE machines

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
Larry Finger 2015-01-26 21:14:34 -06:00
parent 9f59c77b0f
commit 77e8b5de91

View file

@ -293,7 +293,7 @@ void efuse_read_phymap_from_txpktbuf(
u32 start = 0, passing_time = 0;
u8 reg_0x143 = 0;
u8 reg_0x106 = 0;
u32 lo32 = 0, hi32 = 0;
__le32 lo32 = 0, hi32 = 0;
u16 len = 0, count = 0;
int i = 0;
u16 limit = *size;
@ -329,51 +329,39 @@ void efuse_read_phymap_from_txpktbuf(
}
lo32 = rtw_read32(adapter, REG_PKTBUF_DBG_DATA_L);
hi32 = rtw_read32(adapter, REG_PKTBUF_DBG_DATA_H);
/* data from EEPROM needs to be in LE */
lo32 = cpu_to_le32(rtw_read32(adapter, REG_PKTBUF_DBG_DATA_L));
hi32 = cpu_to_le32(rtw_read32(adapter, REG_PKTBUF_DBG_DATA_H));
if(i==0)
{
#if 1 //for debug
u8 lenc[2];
u16 lenbak, aaabak;
u16 aaa;
lenc[0] = rtw_read8(adapter, REG_PKTBUF_DBG_DATA_L);
lenc[1] = rtw_read8(adapter, REG_PKTBUF_DBG_DATA_L+1);
aaabak = le16_to_cpup((u16*)lenc);
lenbak = le16_to_cpu(*((u16*)lenc));
aaa = le16_to_cpup((u16*)&lo32);
#endif
len = le16_to_cpu(*((u16*)&lo32));
if (i == 0) {
/* Although lenc is only used in a debug statement,
* do not remove it as the rtw_read16() call consumes
* 2 bytes from the EEPROM source.
*/
u16 lenc = rtw_read16(adapter, REG_PKTBUF_DBG_DATA_L);
len = le32_to_cpu(lo32) & 0x0000ffff;
limit = (len - 2 < limit) ? len - 2 : limit;
DBG_871X("%s len:%u, lenbak:%u, aaa:%u, aaabak:%u\n", __FUNCTION__, len, lenbak, aaa, aaabak);
DBG_871X("%s len:%u, lenc:%u\n", __func__, len, lenc);
_rtw_memcpy(pos, ((u8*)&lo32)+2, (limit>=count+2)?2:limit-count);
memcpy(pos, ((u8*)&lo32)+2, (limit>=count+2)?2:limit-count);
count+= (limit>=count+2)?2:limit-count;
pos=content+count;
}
else
{
_rtw_memcpy(pos, ((u8*)&lo32), (limit>=count+4)?4:limit-count);
} else {
memcpy(pos, ((u8*)&lo32), (limit>=count+4)?4:limit-count);
count+=(limit>=count+4)?4:limit-count;
pos=content+count;
}
if(limit>count && len-2>count) {
_rtw_memcpy(pos, (u8*)&hi32, (limit>=count+4)?4:limit-count);
memcpy(pos, (u8*)&hi32, (limit>=count+4)?4:limit-count);
count+=(limit>=count+4)?4:limit-count;
pos=content+count;
}
if(limit<=count || len-2<=count)
break;
i++;
}
@ -381,10 +369,8 @@ void efuse_read_phymap_from_txpktbuf(
DBG_871X("%s read count:%u\n", __FUNCTION__, count);
*size = count;
}
static s32 iol_read_efuse(
struct adapter *padapter,
u8 txpktbuf_bndy,