Commit 0d50168d authored by Maxim Mikityanskiy's avatar Maxim Mikityanskiy Committed by Greg Kroah-Hartman

staging: rtl8187se: Removed unused parameters of HwHSSIThreeWire()

Removed two parameters of HwHSSIThreeWire() that are equal in all
function calls, fixed return type, fixed register width and simplified
code
Signed-off-by: default avatarMaxim Mikityanskiy <maxtram95@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b9ce05ee
...@@ -23,8 +23,8 @@ void rtl8225z2_rf_init(struct net_device *dev); ...@@ -23,8 +23,8 @@ void rtl8225z2_rf_init(struct net_device *dev);
void rtl8225z2_rf_set_chan(struct net_device *dev, short ch); void rtl8225z2_rf_set_chan(struct net_device *dev, short ch);
void rtl8225z2_rf_close(struct net_device *dev); void rtl8225z2_rf_close(struct net_device *dev);
void RF_WriteReg(struct net_device *dev, u8 offset, u32 data); void RF_WriteReg(struct net_device *dev, u8 offset, u16 data);
u32 RF_ReadReg(struct net_device *dev, u8 offset); u16 RF_ReadReg(struct net_device *dev, u8 offset);
void rtl8180_set_mode(struct net_device *dev, int mode); void rtl8180_set_mode(struct net_device *dev, int mode);
void rtl8180_set_mode(struct net_device *dev, int mode); void rtl8180_set_mode(struct net_device *dev, int mode);
......
...@@ -207,13 +207,10 @@ void SetOutputEnableOfRfPins(struct net_device *dev) ...@@ -207,13 +207,10 @@ void SetOutputEnableOfRfPins(struct net_device *dev)
write_nic_word(dev, RFPinsEnable, 0x1bff); write_nic_word(dev, RFPinsEnable, 0x1bff);
} }
static int HwHSSIThreeWire(struct net_device *dev, static bool HwHSSIThreeWire(struct net_device *dev,
u8 *pDataBuf, u8 *pDataBuf,
u8 nDataBufBitCnt, bool write)
int bSI,
int bWrite)
{ {
int bResult = 1;
u8 TryCnt; u8 TryCnt;
u8 u1bTmp; u8 u1bTmp;
...@@ -228,77 +225,29 @@ static int HwHSSIThreeWire(struct net_device *dev, ...@@ -228,77 +225,29 @@ static int HwHSSIThreeWire(struct net_device *dev,
if (TryCnt == TC_3W_POLL_MAX_TRY_CNT) { if (TryCnt == TC_3W_POLL_MAX_TRY_CNT) {
printk(KERN_ERR "rtl8187se: HwThreeWire(): CmdReg:" printk(KERN_ERR "rtl8187se: HwThreeWire(): CmdReg:"
" %#X RE|WE bits are not clear!!\n", u1bTmp); " %#X RE|WE bits are not clear!!\n", u1bTmp);
dump_stack(); return false;
return 0;
} }
/* RTL8187S HSSI Read/Write Function */ /* RTL8187S HSSI Read/Write Function */
u1bTmp = read_nic_byte(dev, RF_SW_CONFIG); u1bTmp = read_nic_byte(dev, RF_SW_CONFIG);
u1bTmp |= RF_SW_CFG_SI; /* reg08[1]=1 Serial Interface(SI) */
if (bSI)
u1bTmp |= RF_SW_CFG_SI; /* reg08[1]=1 Serial Interface(SI) */
else
u1bTmp &= ~RF_SW_CFG_SI; /* reg08[1]=0 Parallel Interface(PI) */
write_nic_byte(dev, RF_SW_CONFIG, u1bTmp); write_nic_byte(dev, RF_SW_CONFIG, u1bTmp);
if (bSI) { /* jong: HW SI read must set reg84[3]=0. */
/* jong: HW SI read must set reg84[3]=0. */ u1bTmp = read_nic_byte(dev, RFPinsSelect);
u1bTmp = read_nic_byte(dev, RFPinsSelect); u1bTmp &= ~BIT3;
u1bTmp &= ~BIT3; write_nic_byte(dev, RFPinsSelect, u1bTmp);
write_nic_byte(dev, RFPinsSelect, u1bTmp);
}
/* Fill up data buffer for write operation. */ /* Fill up data buffer for write operation. */
if (bWrite) { /* SI - reg274[3:0] : RF register's Address */
if (nDataBufBitCnt == 16) { if (write)
write_nic_word(dev, SW_3W_DB0, *((u16 *)pDataBuf)); write_nic_word(dev, SW_3W_DB0, *((u16 *)pDataBuf));
} else if (nDataBufBitCnt == 64) { else
/* RTL8187S shouldn't enter this case */ write_nic_word(dev, SW_3W_DB0, *((u16 *)pDataBuf));
write_nic_dword(dev, SW_3W_DB0, *((u32 *)pDataBuf));
write_nic_dword(dev, SW_3W_DB1, *((u32 *)(pDataBuf + 4)));
} else {
int idx;
int ByteCnt = nDataBufBitCnt / 8;
/* printk("%d\n",nDataBufBitCnt); */
if ((nDataBufBitCnt % 8) != 0) {
printk(KERN_ERR "rtl8187se: "
"HwThreeWire(): nDataBufBitCnt(%d)"
" should be multiple of 8!!!\n",
nDataBufBitCnt);
dump_stack();
nDataBufBitCnt += 8;
nDataBufBitCnt &= ~7;
}
if (nDataBufBitCnt > 64) {
printk(KERN_ERR "rtl8187se: HwThreeWire():"
" nDataBufBitCnt(%d) should <= 64!!!\n",
nDataBufBitCnt);
dump_stack();
nDataBufBitCnt = 64;
}
for (idx = 0; idx < ByteCnt; idx++)
write_nic_byte(dev, (SW_3W_DB0+idx), *(pDataBuf+idx));
}
} else { /* read */
if (bSI) {
/* SI - reg274[3:0] : RF register's Address */
write_nic_word(dev, SW_3W_DB0, *((u16 *)pDataBuf));
} else {
/* PI - reg274[15:12] : RF register's Address */
write_nic_word(dev, SW_3W_DB0, (*((u16 *)pDataBuf)) << 12);
}
}
/* Set up command: WE or RE. */ /* Set up command: WE or RE. */
if (bWrite) if (write)
write_nic_byte(dev, SW_3W_CMD1, SW_3W_CMD1_WE); write_nic_byte(dev, SW_3W_CMD1, SW_3W_CMD1_WE);
else else
write_nic_byte(dev, SW_3W_CMD1, SW_3W_CMD1_RE); write_nic_byte(dev, SW_3W_CMD1, SW_3W_CMD1_RE);
...@@ -306,7 +255,7 @@ static int HwHSSIThreeWire(struct net_device *dev, ...@@ -306,7 +255,7 @@ static int HwHSSIThreeWire(struct net_device *dev,
/* Check if DONE is set. */ /* Check if DONE is set. */
for (TryCnt = 0; TryCnt < TC_3W_POLL_MAX_TRY_CNT; TryCnt++) { for (TryCnt = 0; TryCnt < TC_3W_POLL_MAX_TRY_CNT; TryCnt++) {
u1bTmp = read_nic_byte(dev, SW_3W_CMD1); u1bTmp = read_nic_byte(dev, SW_3W_CMD1);
if ((u1bTmp & SW_3W_CMD1_DONE) != 0) if (u1bTmp & SW_3W_CMD1_DONE)
break; break;
udelay(10); udelay(10);
...@@ -315,45 +264,26 @@ static int HwHSSIThreeWire(struct net_device *dev, ...@@ -315,45 +264,26 @@ static int HwHSSIThreeWire(struct net_device *dev,
write_nic_byte(dev, SW_3W_CMD1, 0); write_nic_byte(dev, SW_3W_CMD1, 0);
/* Read back data for read operation. */ /* Read back data for read operation. */
if (bWrite == 0) { if (!write) {
if (bSI) { /* Serial Interface : reg363_362[11:0] */
/* Serial Interface : reg363_362[11:0] */ *((u16 *)pDataBuf) = read_nic_word(dev, SI_DATA_READ);
*((u16 *)pDataBuf) = read_nic_word(dev, SI_DATA_READ) ;
} else {
/* Parallel Interface : reg361_360[11:0] */
*((u16 *)pDataBuf) = read_nic_word(dev, PI_DATA_READ);
}
*((u16 *)pDataBuf) &= 0x0FFF; *((u16 *)pDataBuf) &= 0x0FFF;
} }
return bResult; return true;
} }
void RF_WriteReg(struct net_device *dev, u8 offset, u32 data) void RF_WriteReg(struct net_device *dev, u8 offset, u16 data)
{ {
u32 data2Write; u16 reg = (data << 4) | (offset & 0x0f);
u8 len; HwHSSIThreeWire(dev, (u8 *)&reg, true);
/* Pure HW 3-wire. */
data2Write = (data << 4) | (u32)(offset & 0x0f);
len = 16;
HwHSSIThreeWire(dev, (u8 *)(&data2Write), len, 1, 1);
} }
u32 RF_ReadReg(struct net_device *dev, u8 offset) u16 RF_ReadReg(struct net_device *dev, u8 offset)
{ {
u32 data2Write; u16 reg = offset & 0x0f;
u8 wlen; HwHSSIThreeWire(dev, (u8 *)&reg, false);
u32 dataRead; return reg;
data2Write = ((u32)(offset & 0x0f));
wlen = 16;
HwHSSIThreeWire(dev, (u8 *)(&data2Write), wlen, 1, 0);
dataRead = data2Write;
return dataRead;
} }
...@@ -469,7 +399,8 @@ void ZEBRA_Config_85BASIC_HardCode(struct net_device *dev) ...@@ -469,7 +399,8 @@ void ZEBRA_Config_85BASIC_HardCode(struct net_device *dev)
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev); struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
u32 i; u32 i;
u32 addr, data; u32 addr, data;
u32 u4bRegOffset, u4bRegValue, u4bRF23, u4bRF24; u32 u4bRegOffset, u4bRegValue;
u16 u4bRF23, u4bRF24;
u8 u1b24E; u8 u1b24E;
int d_cut = 0; int d_cut = 0;
......
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