Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/baseband.h | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/vt6655/baseband.h b/drivers/staging/vt6655/baseband.h
index 6ce856c..c41bc33 100644
--- a/drivers/staging/vt6655/baseband.h
+++ b/drivers/staging/vt6655/baseband.h
@@ -80,11 +80,11 @@ void vnt_get_phy_field(struct vnt_private *, u32 frame_length,
bool BBbReadEmbedded(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned char *pbyData);
bool BBbWriteEmbedded(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned char byData);
-void BBvSetShortSlotTime(struct vnt_private *pDevice);
-void BBvSetVGAGainOffset(struct vnt_private *pDevice, unsigned char byData);
+void BBvSetShortSlotTime(struct vnt_private *);
+void BBvSetVGAGainOffset(struct vnt_private *, unsigned char byData);
/* VT3253 Baseband */
-bool BBbVT3253Init(struct vnt_private *pDevice);
+bool BBbVT3253Init(struct vnt_private *);
void BBvSoftwareReset(void __iomem *dwIoBase);
void BBvPowerSaveModeON(void __iomem *dwIoBase);
void BBvPowerSaveModeOFF(void __iomem *dwIoBase);
@@ -105,9 +105,9 @@ TimerState1CallBack(
unsigned long
);
-void BBvAntennaDiversity(struct vnt_private *pDevice,
+void BBvAntennaDiversity(struct vnt_private *,
unsigned char byRxRate, unsigned char bySQ3);
void
-BBvClearAntDivSQ3Value(struct vnt_private *pDevice);
+BBvClearAntDivSQ3Value(struct vnt_private *);
#endif /* __BASEBAND_H__ */
--
2.1.0
Replace with stucture vnt_private *priv
in functions
BBvSoftwareReset
BBvSetTxAntennaMode
BBvSetRxAntennaMode
BBvSetDeepSleep
BBvExitDeepSleep
__iomem *dwIoBase will be moved into BBbWriteEmbedded and BBbReadEmbedded
later.
Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/baseband.c | 30 +++++++++++++++++++-----------
drivers/staging/vt6655/baseband.h | 10 +++++-----
drivers/staging/vt6655/card.c | 4 ++--
drivers/staging/vt6655/channel.c | 2 +-
drivers/staging/vt6655/device_main.c | 6 +++---
5 files changed, 30 insertions(+), 22 deletions(-)
diff --git a/drivers/staging/vt6655/baseband.c b/drivers/staging/vt6655/baseband.c
index 32000d2..c6c811b 100644
--- a/drivers/staging/vt6655/baseband.c
+++ b/drivers/staging/vt6655/baseband.c
@@ -1719,22 +1719,22 @@ s_vChangeAntenna(
if (priv->dwRxAntennaSel == 0) {
priv->dwRxAntennaSel = 1;
if (priv->bTxRxAntInv == true)
- BBvSetRxAntennaMode(priv->PortOffset, ANT_A);
+ BBvSetRxAntennaMode(priv, ANT_A);
else
- BBvSetRxAntennaMode(priv->PortOffset, ANT_B);
+ BBvSetRxAntennaMode(priv, ANT_B);
} else {
priv->dwRxAntennaSel = 0;
if (priv->bTxRxAntInv == true)
- BBvSetRxAntennaMode(priv->PortOffset, ANT_B);
+ BBvSetRxAntennaMode(priv, ANT_B);
else
- BBvSetRxAntennaMode(priv->PortOffset, ANT_A);
+ BBvSetRxAntennaMode(priv, ANT_A);
}
if (priv->dwTxAntennaSel == 0) {
priv->dwTxAntennaSel = 1;
- BBvSetTxAntennaMode(priv->PortOffset, ANT_B);
+ BBvSetTxAntennaMode(priv, ANT_B);
} else {
priv->dwTxAntennaSel = 0;
- BBvSetTxAntennaMode(priv->PortOffset, ANT_A);
+ BBvSetTxAntennaMode(priv, ANT_A);
}
}
@@ -2266,8 +2266,10 @@ void BBvSetVGAGainOffset(struct vnt_private *priv, unsigned char byData)
*
*/
void
-BBvSoftwareReset(void __iomem *dwIoBase)
+BBvSoftwareReset(struct vnt_private *priv)
{
+ void __iomem *dwIoBase = priv->PortOffset;
+
BBbWriteEmbedded(dwIoBase, 0x50, 0x40);
BBbWriteEmbedded(dwIoBase, 0x50, 0);
BBbWriteEmbedded(dwIoBase, 0x9C, 0x01);
@@ -2333,8 +2335,9 @@ BBvPowerSaveModeOFF(void __iomem *dwIoBase)
*/
void
-BBvSetTxAntennaMode(void __iomem *dwIoBase, unsigned char byAntennaMode)
+BBvSetTxAntennaMode(struct vnt_private *priv, unsigned char byAntennaMode)
{
+ void __iomem *dwIoBase = priv->PortOffset;
unsigned char byBBTxConf;
BBbReadEmbedded(dwIoBase, 0x09, &byBBTxConf); /* CR09 */
@@ -2366,8 +2369,9 @@ BBvSetTxAntennaMode(void __iomem *dwIoBase, unsigned char byAntennaMode)
*/
void
-BBvSetRxAntennaMode(void __iomem *dwIoBase, unsigned char byAntennaMode)
+BBvSetRxAntennaMode(struct vnt_private *priv, unsigned char byAntennaMode)
{
+ void __iomem *dwIoBase = priv->PortOffset;
unsigned char byBBRxConf;
BBbReadEmbedded(dwIoBase, 0x0A, &byBBRxConf); /* CR10 */
@@ -2396,15 +2400,19 @@ BBvSetRxAntennaMode(void __iomem *dwIoBase, unsigned char byAntennaMode)
*
*/
void
-BBvSetDeepSleep(void __iomem *dwIoBase, unsigned char byLocalID)
+BBvSetDeepSleep(struct vnt_private *priv, unsigned char byLocalID)
{
+ void __iomem *dwIoBase = priv->PortOffset;
+
BBbWriteEmbedded(dwIoBase, 0x0C, 0x17); /* CR12 */
BBbWriteEmbedded(dwIoBase, 0x0D, 0xB9); /* CR13 */
}
void
-BBvExitDeepSleep(void __iomem *dwIoBase, unsigned char byLocalID)
+BBvExitDeepSleep(struct vnt_private *priv, unsigned char byLocalID)
{
+ void __iomem *dwIoBase = priv->PortOffset;
+
BBbWriteEmbedded(dwIoBase, 0x0C, 0x00); /* CR12 */
BBbWriteEmbedded(dwIoBase, 0x0D, 0x01); /* CR13 */
}
diff --git a/drivers/staging/vt6655/baseband.h b/drivers/staging/vt6655/baseband.h
index c41bc33..8594347 100644
--- a/drivers/staging/vt6655/baseband.h
+++ b/drivers/staging/vt6655/baseband.h
@@ -85,13 +85,13 @@ void BBvSetVGAGainOffset(struct vnt_private *, unsigned char byData);
/* VT3253 Baseband */
bool BBbVT3253Init(struct vnt_private *);
-void BBvSoftwareReset(void __iomem *dwIoBase);
+void BBvSoftwareReset(struct vnt_private *);
void BBvPowerSaveModeON(void __iomem *dwIoBase);
void BBvPowerSaveModeOFF(void __iomem *dwIoBase);
-void BBvSetTxAntennaMode(void __iomem *dwIoBase, unsigned char byAntennaMode);
-void BBvSetRxAntennaMode(void __iomem *dwIoBase, unsigned char byAntennaMode);
-void BBvSetDeepSleep(void __iomem *dwIoBase, unsigned char byLocalID);
-void BBvExitDeepSleep(void __iomem *dwIoBase, unsigned char byLocalID);
+void BBvSetTxAntennaMode(struct vnt_private *, unsigned char byAntennaMode);
+void BBvSetRxAntennaMode(struct vnt_private *, unsigned char byAntennaMode);
+void BBvSetDeepSleep(struct vnt_private *, unsigned char byLocalID);
+void BBvExitDeepSleep(struct vnt_private *, unsigned char byLocalID);
/* timer for antenna diversity */
diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c
index 60f051f..0121466 100644
--- a/drivers/staging/vt6655/card.c
+++ b/drivers/staging/vt6655/card.c
@@ -445,7 +445,7 @@ bool CARDbRadioPowerOff(struct vnt_private *pDevice)
MACvRegBitsOff(pDevice->PortOffset, MAC_REG_HOSTCR, HOSTCR_RXON);
- BBvSetDeepSleep(pDevice->PortOffset, pDevice->byLocalID);
+ BBvSetDeepSleep(pDevice, pDevice->byLocalID);
pDevice->bRadioOff = true;
pr_debug("chester power off\n");
@@ -480,7 +480,7 @@ bool CARDbRadioPowerOn(struct vnt_private *pDevice)
pr_debug("chester pbRadioOff\n");
return true; }
- BBvExitDeepSleep(pDevice->PortOffset, pDevice->byLocalID);
+ BBvExitDeepSleep(pDevice, pDevice->byLocalID);
MACvRegBitsOn(pDevice->PortOffset, MAC_REG_HOSTCR, HOSTCR_RXON);
diff --git a/drivers/staging/vt6655/channel.c b/drivers/staging/vt6655/channel.c
index 6bd5f16..cc1bc94 100644
--- a/drivers/staging/vt6655/channel.c
+++ b/drivers/staging/vt6655/channel.c
@@ -197,7 +197,7 @@ bool set_channel(void *pDeviceHandler, unsigned int uConnectionChannel)
if (pDevice->bEnablePSMode)
RFvWriteWakeProgSyn(pDevice->PortOffset, pDevice->byRFType, uConnectionChannel);
- BBvSoftwareReset(pDevice->PortOffset);
+ BBvSoftwareReset(pDevice);
if (pDevice->byLocalID > REV_ID_VT3253_B1) {
/* set HW default power register */
diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c
index 5fc6022..397f13f 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -254,7 +254,7 @@ static void device_init_registers(struct vnt_private *pDevice)
unsigned char byOFDMPwrdBm = 0;
MACbShutdown(pDevice->PortOffset);
- BBvSoftwareReset(pDevice->PortOffset);
+ BBvSoftwareReset(pDevice);
/* Do MACbSoftwareReset in MACvInitialize */
MACbSoftwareReset(pDevice->PortOffset);
@@ -446,8 +446,8 @@ static void device_init_registers(struct vnt_private *pDevice)
BBvSetVGAGainOffset(pDevice, pDevice->abyBBVGA[0]);
}
- BBvSetRxAntennaMode(pDevice->PortOffset, pDevice->byRxAntennaMode);
- BBvSetTxAntennaMode(pDevice->PortOffset, pDevice->byTxAntennaMode);
+ BBvSetRxAntennaMode(pDevice, pDevice->byRxAntennaMode);
+ BBvSetTxAntennaMode(pDevice, pDevice->byTxAntennaMode);
/* Set BB and packet type at the same time. */
/* Set Short Slot Time, xIFS, and RSPINF. */
--
2.1.0
set by calling CARDbyGetPktType.
change CARDbIsOFDMinBasicRate to check basic_rates.
Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/card.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c
index 1869557..aaa7289 100644
--- a/drivers/staging/vt6655/card.c
+++ b/drivers/staging/vt6655/card.c
@@ -342,6 +342,8 @@ bool CARDbSetPhyParameter(struct vnt_private *pDevice, CARD_PHY_TYPE ePHYType,
VNSvOutPortB(pDevice->PortOffset + MAC_REG_CWMAXMIN0, pDevice->byCWMaxMin);
}
+ pDevice->byPacketType = CARDbyGetPktType(pDevice);
+
CARDvSetRSPINF(pDevice, ePHYType);
return true;
@@ -876,7 +878,7 @@ bool CARDbIsOFDMinBasicRate(struct vnt_private *pDevice)
int ii;
for (ii = RATE_54M; ii >= RATE_6M; ii--) {
- if ((pDevice->wBasicRate) & ((unsigned short)(1 << ii)))
+ if ((pDevice->basic_rates) & ((u32)(1 << ii)))
return true;
}
return false;
--
2.1.0
Changing callers to point to private
Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/baseband.c | 22 ++++++++++------------
drivers/staging/vt6655/baseband.h | 2 +-
drivers/staging/vt6655/card.c | 12 ++++++------
3 files changed, 17 insertions(+), 19 deletions(-)
diff --git a/drivers/staging/vt6655/baseband.c b/drivers/staging/vt6655/baseband.c
index f1f1075..86c72ba 100644
--- a/drivers/staging/vt6655/baseband.c
+++ b/drivers/staging/vt6655/baseband.c
@@ -1961,8 +1961,10 @@ void vnt_get_phy_field(struct vnt_private *priv, u32 frame_length,
* Return Value: true if succeeded; false if failed.
*
*/
-bool BBbReadEmbedded(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned char *pbyData)
+bool BBbReadEmbedded(struct vnt_private *priv,
+ unsigned char byBBAddr, unsigned char *pbyData)
{
+ void __iomem *dwIoBase = priv->PortOffset;
unsigned short ww;
unsigned char byValue;
@@ -2222,7 +2224,7 @@ BBvSetShortSlotTime(struct vnt_private *priv)
unsigned char byBBRxConf = 0;
unsigned char byBBVGA = 0;
- BBbReadEmbedded(priv->PortOffset, 0x0A, &byBBRxConf); /* CR10 */
+ BBbReadEmbedded(priv, 0x0A, &byBBRxConf); /* CR10 */
if (priv->bShortSlotTime)
byBBRxConf &= 0xDF; /* 1101 1111 */
@@ -2230,7 +2232,7 @@ BBvSetShortSlotTime(struct vnt_private *priv)
byBBRxConf |= 0x20; /* 0010 0000 */
/* patch for 3253B0 Baseband with Cardbus module */
- BBbReadEmbedded(priv->PortOffset, 0xE7, &byBBVGA);
+ BBbReadEmbedded(priv, 0xE7, &byBBVGA);
if (byBBVGA == priv->abyBBVGA[0])
byBBRxConf |= 0x20; /* 0010 0000 */
@@ -2243,7 +2245,7 @@ void BBvSetVGAGainOffset(struct vnt_private *priv, unsigned char byData)
BBbWriteEmbedded(priv, 0xE7, byData);
- BBbReadEmbedded(priv->PortOffset, 0x0A, &byBBRxConf); /* CR10 */
+ BBbReadEmbedded(priv, 0x0A, &byBBRxConf); /* CR10 */
/* patch for 3253B0 Baseband with Cardbus module */
if (byData == priv->abyBBVGA[0])
byBBRxConf |= 0x20; /* 0010 0000 */
@@ -2291,10 +2293,9 @@ BBvSoftwareReset(struct vnt_private *priv)
void
BBvPowerSaveModeON(struct vnt_private *priv)
{
- void __iomem *dwIoBase = priv->PortOffset;
unsigned char byOrgData;
- BBbReadEmbedded(dwIoBase, 0x0D, &byOrgData);
+ BBbReadEmbedded(priv, 0x0D, &byOrgData);
byOrgData |= BIT(0);
BBbWriteEmbedded(priv, 0x0D, byOrgData);
}
@@ -2314,10 +2315,9 @@ BBvPowerSaveModeON(struct vnt_private *priv)
void
BBvPowerSaveModeOFF(struct vnt_private *priv)
{
- void __iomem *dwIoBase = priv->PortOffset;
unsigned char byOrgData;
- BBbReadEmbedded(dwIoBase, 0x0D, &byOrgData);
+ BBbReadEmbedded(priv, 0x0D, &byOrgData);
byOrgData &= ~(BIT(0));
BBbWriteEmbedded(priv, 0x0D, byOrgData);
}
@@ -2339,10 +2339,9 @@ BBvPowerSaveModeOFF(struct vnt_private *priv)
void
BBvSetTxAntennaMode(struct vnt_private *priv, unsigned char byAntennaMode)
{
- void __iomem *dwIoBase = priv->PortOffset;
unsigned char byBBTxConf;
- BBbReadEmbedded(dwIoBase, 0x09, &byBBTxConf); /* CR09 */
+ BBbReadEmbedded(priv, 0x09, &byBBTxConf); /* CR09 */
if (byAntennaMode == ANT_DIVERSITY) {
/* bit 1 is diversity */
byBBTxConf |= 0x02;
@@ -2373,10 +2372,9 @@ BBvSetTxAntennaMode(struct vnt_private *priv, unsigned char byAntennaMode)
void
BBvSetRxAntennaMode(struct vnt_private *priv, unsigned char byAntennaMode)
{
- void __iomem *dwIoBase = priv->PortOffset;
unsigned char byBBRxConf;
- BBbReadEmbedded(dwIoBase, 0x0A, &byBBRxConf); /* CR10 */
+ BBbReadEmbedded(priv, 0x0A, &byBBRxConf); /* CR10 */
if (byAntennaMode == ANT_DIVERSITY) {
byBBRxConf |= 0x01;
diff --git a/drivers/staging/vt6655/baseband.h b/drivers/staging/vt6655/baseband.h
index 743ec4f..d9f6d63 100644
--- a/drivers/staging/vt6655/baseband.h
+++ b/drivers/staging/vt6655/baseband.h
@@ -77,7 +77,7 @@ BBuGetFrameTime(
void vnt_get_phy_field(struct vnt_private *, u32 frame_length,
u16 tx_rate, u8 pkt_type, struct vnt_phy_field *);
-bool BBbReadEmbedded(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned char *pbyData);
+bool BBbReadEmbedded(struct vnt_private *, unsigned char byBBAddr, unsigned char *pbyData);
bool BBbWriteEmbedded(struct vnt_private *, unsigned char byBBAddr, unsigned char byData);
void BBvSetShortSlotTime(struct vnt_private *);
diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c
index 6f1cea0..1869557 100644
--- a/drivers/staging/vt6655/card.c
+++ b/drivers/staging/vt6655/card.c
@@ -223,14 +223,14 @@ bool CARDbSetPhyParameter(struct vnt_private *pDevice, CARD_PHY_TYPE ePHYType,
pDevice->abyBBVGA[0] = 0x20;
pDevice->abyBBVGA[2] = 0x10;
pDevice->abyBBVGA[3] = 0x10;
- BBbReadEmbedded(pDevice->PortOffset, 0xE7, &byData);
+ BBbReadEmbedded(pDevice, 0xE7, &byData);
if (byData == 0x1C)
BBbWriteEmbedded(pDevice, 0xE7, pDevice->abyBBVGA[0]);
} else if (pDevice->byRFType == RF_UW2452) {
MACvSetBBType(pDevice->PortOffset, BB_TYPE_11A);
pDevice->abyBBVGA[0] = 0x18;
- BBbReadEmbedded(pDevice->PortOffset, 0xE7, &byData);
+ BBbReadEmbedded(pDevice, 0xE7, &byData);
if (byData == 0x14) {
BBbWriteEmbedded(pDevice, 0xE7, pDevice->abyBBVGA[0]);
BBbWriteEmbedded(pDevice, 0xE1, 0x57);
@@ -249,13 +249,13 @@ bool CARDbSetPhyParameter(struct vnt_private *pDevice, CARD_PHY_TYPE ePHYType,
pDevice->abyBBVGA[0] = 0x1C;
pDevice->abyBBVGA[2] = 0x00;
pDevice->abyBBVGA[3] = 0x00;
- BBbReadEmbedded(pDevice->PortOffset, 0xE7, &byData);
+ BBbReadEmbedded(pDevice, 0xE7, &byData);
if (byData == 0x20)
BBbWriteEmbedded(pDevice, 0xE7, pDevice->abyBBVGA[0]);
} else if (pDevice->byRFType == RF_UW2452) {
pDevice->abyBBVGA[0] = 0x14;
- BBbReadEmbedded(pDevice->PortOffset, 0xE7, &byData);
+ BBbReadEmbedded(pDevice, 0xE7, &byData);
if (byData == 0x18) {
BBbWriteEmbedded(pDevice, 0xE7, pDevice->abyBBVGA[0]);
BBbWriteEmbedded(pDevice, 0xE1, 0xD3);
@@ -272,13 +272,13 @@ bool CARDbSetPhyParameter(struct vnt_private *pDevice, CARD_PHY_TYPE ePHYType,
pDevice->abyBBVGA[0] = 0x1C;
pDevice->abyBBVGA[2] = 0x00;
pDevice->abyBBVGA[3] = 0x00;
- BBbReadEmbedded(pDevice->PortOffset, 0xE7, &byData);
+ BBbReadEmbedded(pDevice, 0xE7, &byData);
if (byData == 0x20)
BBbWriteEmbedded(pDevice, 0xE7, pDevice->abyBBVGA[0]);
} else if (pDevice->byRFType == RF_UW2452) {
pDevice->abyBBVGA[0] = 0x14;
- BBbReadEmbedded(pDevice->PortOffset, 0xE7, &byData);
+ BBbReadEmbedded(pDevice, 0xE7, &byData);
if (byData == 0x18) {
BBbWriteEmbedded(pDevice, 0xE7, pDevice->abyBBVGA[0]);
BBbWriteEmbedded(pDevice, 0xE1, 0xD3);
--
2.1.0
Replace __iomem with vnt_private providing pointer for dwIoBase
Change BBvPowerSaveModeON and BBvPowerSaveModeOFF to vnt_private and
reference __iomem there, to be removed later.
Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/baseband.c | 6 ++++--
drivers/staging/vt6655/baseband.h | 4 ++--
drivers/staging/vt6655/rf.c | 9 +++++----
3 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/vt6655/baseband.c b/drivers/staging/vt6655/baseband.c
index c6c811b..9d5288c 100644
--- a/drivers/staging/vt6655/baseband.c
+++ b/drivers/staging/vt6655/baseband.c
@@ -2289,8 +2289,9 @@ BBvSoftwareReset(struct vnt_private *priv)
*
*/
void
-BBvPowerSaveModeON(void __iomem *dwIoBase)
+BBvPowerSaveModeON(struct vnt_private *priv)
{
+ void __iomem *dwIoBase = priv->PortOffset;
unsigned char byOrgData;
BBbReadEmbedded(dwIoBase, 0x0D, &byOrgData);
@@ -2311,8 +2312,9 @@ BBvPowerSaveModeON(void __iomem *dwIoBase)
*
*/
void
-BBvPowerSaveModeOFF(void __iomem *dwIoBase)
+BBvPowerSaveModeOFF(struct vnt_private *priv)
{
+ void __iomem *dwIoBase = priv->PortOffset;
unsigned char byOrgData;
BBbReadEmbedded(dwIoBase, 0x0D, &byOrgData);
diff --git a/drivers/staging/vt6655/baseband.h b/drivers/staging/vt6655/baseband.h
index 8594347..26f9cdc 100644
--- a/drivers/staging/vt6655/baseband.h
+++ b/drivers/staging/vt6655/baseband.h
@@ -86,8 +86,8 @@ void BBvSetVGAGainOffset(struct vnt_private *, unsigned char byData);
/* VT3253 Baseband */
bool BBbVT3253Init(struct vnt_private *);
void BBvSoftwareReset(struct vnt_private *);
-void BBvPowerSaveModeON(void __iomem *dwIoBase);
-void BBvPowerSaveModeOFF(void __iomem *dwIoBase);
+void BBvPowerSaveModeON(struct vnt_private *);
+void BBvPowerSaveModeOFF(struct vnt_private *);
void BBvSetTxAntennaMode(struct vnt_private *, unsigned char byAntennaMode);
void BBvSetRxAntennaMode(struct vnt_private *, unsigned char byAntennaMode);
void BBvSetDeepSleep(struct vnt_private *, unsigned char byLocalID);
diff --git a/drivers/staging/vt6655/rf.c b/drivers/staging/vt6655/rf.c
index e505af9..2b1e7a0 100644
--- a/drivers/staging/vt6655/rf.c
+++ b/drivers/staging/vt6655/rf.c
@@ -424,8 +424,9 @@ static const unsigned long dwAL7230ChannelTable2[CB_MAX_CHANNEL] = {
* Return Value: true if succeeded; false if failed.
*
*/
-static bool s_bAL7230Init(void __iomem *dwIoBase)
+static bool s_bAL7230Init(struct vnt_private *priv)
{
+ void __iomem *dwIoBase = priv->PortOffset;
int ii;
bool bResult;
@@ -436,7 +437,7 @@ static bool s_bAL7230Init(void __iomem *dwIoBase)
MACvWordRegBitsOn(dwIoBase, MAC_REG_SOFTPWRCTL, (SOFTPWRCTL_SWPECTI |
SOFTPWRCTL_TXPEINV));
- BBvPowerSaveModeOFF(dwIoBase); //RobertYu:20050106, have DC value for Calibration
+ BBvPowerSaveModeOFF(priv); /* RobertYu:20050106, have DC value for Calibration */
for (ii = 0; ii < CB_AL7230_INIT_SEQ; ii++)
bResult &= IFRFbWriteEmbedded(dwIoBase, dwAL7230InitTable[ii]);
@@ -457,7 +458,7 @@ static bool s_bAL7230Init(void __iomem *dwIoBase)
SOFTPWRCTL_SWPECTI |
SOFTPWRCTL_TXPEINV));
- BBvPowerSaveModeON(dwIoBase); // RobertYu:20050106
+ BBvPowerSaveModeON(priv); /* RobertYu:20050106 */
// PE1: TX_ON, PE2: RX_ON, PE3: PLLON
//3-wire control for power saving mode
@@ -759,7 +760,7 @@ bool RFbInit(
break;
case RF_AIROHA7230:
pDevice->byMaxPwrLevel = AL7230_PWR_IDX_LEN;
- bResult = s_bAL7230Init(pDevice->PortOffset);
+ bResult = s_bAL7230Init(pDevice);
break;
case RF_NOTHING:
bResult = true;
--
2.1.0
Referencing dwIoBase inside function.
Signed-off-by: Malcolm Priestley <[email protected]>
---
drivers/staging/vt6655/baseband.c | 82 +++++++++++++++++++--------------------
drivers/staging/vt6655/baseband.h | 2 +-
drivers/staging/vt6655/card.c | 24 ++++++------
3 files changed, 52 insertions(+), 56 deletions(-)
diff --git a/drivers/staging/vt6655/baseband.c b/drivers/staging/vt6655/baseband.c
index 9d5288c..f1f1075 100644
--- a/drivers/staging/vt6655/baseband.c
+++ b/drivers/staging/vt6655/baseband.c
@@ -2003,8 +2003,10 @@ bool BBbReadEmbedded(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned ch
* Return Value: true if succeeded; false if failed.
*
*/
-bool BBbWriteEmbedded(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned char byData)
+bool BBbWriteEmbedded(struct vnt_private *priv,
+ unsigned char byBBAddr, unsigned char byData)
{
+ void __iomem *dwIoBase = priv->PortOffset;
unsigned short ww;
unsigned char byValue;
@@ -2056,14 +2058,14 @@ bool BBbVT3253Init(struct vnt_private *priv)
if (byRFType == RF_RFMD2959) {
if (byLocalID <= REV_ID_VT3253_A1) {
for (ii = 0; ii < CB_VT3253_INIT_FOR_RFMD; ii++)
- bResult &= BBbWriteEmbedded(dwIoBase, byVT3253InitTab_RFMD[ii][0], byVT3253InitTab_RFMD[ii][1]);
+ bResult &= BBbWriteEmbedded(priv, byVT3253InitTab_RFMD[ii][0], byVT3253InitTab_RFMD[ii][1]);
} else {
for (ii = 0; ii < CB_VT3253B0_INIT_FOR_RFMD; ii++)
- bResult &= BBbWriteEmbedded(dwIoBase, byVT3253B0_RFMD[ii][0], byVT3253B0_RFMD[ii][1]);
+ bResult &= BBbWriteEmbedded(priv, byVT3253B0_RFMD[ii][0], byVT3253B0_RFMD[ii][1]);
for (ii = 0; ii < CB_VT3253B0_AGC_FOR_RFMD2959; ii++)
- bResult &= BBbWriteEmbedded(dwIoBase, byVT3253B0_AGC4_RFMD2959[ii][0], byVT3253B0_AGC4_RFMD2959[ii][1]);
+ bResult &= BBbWriteEmbedded(priv, byVT3253B0_AGC4_RFMD2959[ii][0], byVT3253B0_AGC4_RFMD2959[ii][1]);
VNSvOutPortD(dwIoBase + MAC_REG_ITRTMSET, 0x23);
MACvRegBitsOn(dwIoBase, MAC_REG_PAPEDELAY, BIT(0));
@@ -2078,10 +2080,10 @@ bool BBbVT3253Init(struct vnt_private *priv)
priv->ldBmThreshold[3] = 0;
} else if ((byRFType == RF_AIROHA) || (byRFType == RF_AL2230S)) {
for (ii = 0; ii < CB_VT3253B0_INIT_FOR_AIROHA2230; ii++)
- bResult &= BBbWriteEmbedded(dwIoBase, byVT3253B0_AIROHA2230[ii][0], byVT3253B0_AIROHA2230[ii][1]);
+ bResult &= BBbWriteEmbedded(priv, byVT3253B0_AIROHA2230[ii][0], byVT3253B0_AIROHA2230[ii][1]);
for (ii = 0; ii < CB_VT3253B0_AGC; ii++)
- bResult &= BBbWriteEmbedded(dwIoBase, byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]);
+ bResult &= BBbWriteEmbedded(priv, byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]);
priv->abyBBVGA[0] = 0x1C;
priv->abyBBVGA[1] = 0x10;
@@ -2093,10 +2095,10 @@ bool BBbVT3253Init(struct vnt_private *priv)
priv->ldBmThreshold[3] = 0;
} else if (byRFType == RF_UW2451) {
for (ii = 0; ii < CB_VT3253B0_INIT_FOR_UW2451; ii++)
- bResult &= BBbWriteEmbedded(dwIoBase, byVT3253B0_UW2451[ii][0], byVT3253B0_UW2451[ii][1]);
+ bResult &= BBbWriteEmbedded(priv, byVT3253B0_UW2451[ii][0], byVT3253B0_UW2451[ii][1]);
for (ii = 0; ii < CB_VT3253B0_AGC; ii++)
- bResult &= BBbWriteEmbedded(dwIoBase, byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]);
+ bResult &= BBbWriteEmbedded(priv, byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]);
VNSvOutPortB(dwIoBase + MAC_REG_ITRTMSET, 0x23);
MACvRegBitsOn(dwIoBase, MAC_REG_PAPEDELAY, BIT(0));
@@ -2111,28 +2113,28 @@ bool BBbVT3253Init(struct vnt_private *priv)
priv->ldBmThreshold[3] = 0;
} else if (byRFType == RF_UW2452) {
for (ii = 0; ii < CB_VT3253B0_INIT_FOR_UW2451; ii++)
- bResult &= BBbWriteEmbedded(dwIoBase, byVT3253B0_UW2451[ii][0], byVT3253B0_UW2451[ii][1]);
+ bResult &= BBbWriteEmbedded(priv, byVT3253B0_UW2451[ii][0], byVT3253B0_UW2451[ii][1]);
/* Init ANT B select,TX Config CR09 = 0x61->0x45, 0x45->0x41(VC1/VC2 define, make the ANT_A, ANT_B inverted) */
/*bResult &= BBbWriteEmbedded(dwIoBase,0x09,0x41);*/
/* Init ANT B select,RX Config CR10 = 0x28->0x2A, 0x2A->0x28(VC1/VC2 define, make the ANT_A, ANT_B inverted) */
/*bResult &= BBbWriteEmbedded(dwIoBase,0x0a,0x28);*/
/* Select VC1/VC2, CR215 = 0x02->0x06 */
- bResult &= BBbWriteEmbedded(dwIoBase, 0xd7, 0x06);
+ bResult &= BBbWriteEmbedded(priv, 0xd7, 0x06);
/* {{RobertYu:20050125, request by Jack */
- bResult &= BBbWriteEmbedded(dwIoBase, 0x90, 0x20);
- bResult &= BBbWriteEmbedded(dwIoBase, 0x97, 0xeb);
+ bResult &= BBbWriteEmbedded(priv, 0x90, 0x20);
+ bResult &= BBbWriteEmbedded(priv, 0x97, 0xeb);
/* }} */
/* {{RobertYu:20050221, request by Jack */
- bResult &= BBbWriteEmbedded(dwIoBase, 0xa6, 0x00);
- bResult &= BBbWriteEmbedded(dwIoBase, 0xa8, 0x30);
+ bResult &= BBbWriteEmbedded(priv, 0xa6, 0x00);
+ bResult &= BBbWriteEmbedded(priv, 0xa8, 0x30);
/* }} */
- bResult &= BBbWriteEmbedded(dwIoBase, 0xb0, 0x58);
+ bResult &= BBbWriteEmbedded(priv, 0xb0, 0x58);
for (ii = 0; ii < CB_VT3253B0_AGC; ii++)
- bResult &= BBbWriteEmbedded(dwIoBase, byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]);
+ bResult &= BBbWriteEmbedded(priv, byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]);
priv->abyBBVGA[0] = 0x14;
priv->abyBBVGA[1] = 0x0A;
@@ -2146,10 +2148,10 @@ bool BBbVT3253Init(struct vnt_private *priv)
} else if (byRFType == RF_VT3226) {
for (ii = 0; ii < CB_VT3253B0_INIT_FOR_AIROHA2230; ii++)
- bResult &= BBbWriteEmbedded(dwIoBase, byVT3253B0_AIROHA2230[ii][0], byVT3253B0_AIROHA2230[ii][1]);
+ bResult &= BBbWriteEmbedded(priv, byVT3253B0_AIROHA2230[ii][0], byVT3253B0_AIROHA2230[ii][1]);
for (ii = 0; ii < CB_VT3253B0_AGC; ii++)
- bResult &= BBbWriteEmbedded(dwIoBase, byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]);
+ bResult &= BBbWriteEmbedded(priv, byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]);
priv->abyBBVGA[0] = 0x1C;
priv->abyBBVGA[1] = 0x10;
@@ -2164,7 +2166,7 @@ bool BBbVT3253Init(struct vnt_private *priv)
/* {{ RobertYu: 20050104 */
} else if (byRFType == RF_AIROHA7230) {
for (ii = 0; ii < CB_VT3253B0_INIT_FOR_AIROHA2230; ii++)
- bResult &= BBbWriteEmbedded(dwIoBase, byVT3253B0_AIROHA2230[ii][0], byVT3253B0_AIROHA2230[ii][1]);
+ bResult &= BBbWriteEmbedded(priv, byVT3253B0_AIROHA2230[ii][0], byVT3253B0_AIROHA2230[ii][1]);
/* {{ RobertYu:20050223, request by JerryChung */
@@ -2177,7 +2179,7 @@ bool BBbVT3253Init(struct vnt_private *priv)
/* }} */
for (ii = 0; ii < CB_VT3253B0_AGC; ii++)
- bResult &= BBbWriteEmbedded(dwIoBase, byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]);
+ bResult &= BBbWriteEmbedded(priv, byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]);
priv->abyBBVGA[0] = 0x1C;
priv->abyBBVGA[1] = 0x10;
@@ -2195,8 +2197,8 @@ bool BBbVT3253Init(struct vnt_private *priv)
}
if (byLocalID > REV_ID_VT3253_A1) {
- BBbWriteEmbedded(dwIoBase, 0x04, 0x7F);
- BBbWriteEmbedded(dwIoBase, 0x0D, 0x01);
+ BBbWriteEmbedded(priv, 0x04, 0x7F);
+ BBbWriteEmbedded(priv, 0x0D, 0x01);
}
return bResult;
@@ -2232,14 +2234,14 @@ BBvSetShortSlotTime(struct vnt_private *priv)
if (byBBVGA == priv->abyBBVGA[0])
byBBRxConf |= 0x20; /* 0010 0000 */
- BBbWriteEmbedded(priv->PortOffset, 0x0A, byBBRxConf); /* CR10 */
+ BBbWriteEmbedded(priv, 0x0A, byBBRxConf); /* CR10 */
}
void BBvSetVGAGainOffset(struct vnt_private *priv, unsigned char byData)
{
unsigned char byBBRxConf = 0;
- BBbWriteEmbedded(priv->PortOffset, 0xE7, byData);
+ BBbWriteEmbedded(priv, 0xE7, byData);
BBbReadEmbedded(priv->PortOffset, 0x0A, &byBBRxConf); /* CR10 */
/* patch for 3253B0 Baseband with Cardbus module */
@@ -2250,7 +2252,7 @@ void BBvSetVGAGainOffset(struct vnt_private *priv, unsigned char byData)
else
byBBRxConf |= 0x20; /* 0010 0000 */
priv->byBBVGACurrent = byData;
- BBbWriteEmbedded(priv->PortOffset, 0x0A, byBBRxConf); /* CR10 */
+ BBbWriteEmbedded(priv, 0x0A, byBBRxConf); /* CR10 */
}
/*
@@ -2268,12 +2270,10 @@ void BBvSetVGAGainOffset(struct vnt_private *priv, unsigned char byData)
void
BBvSoftwareReset(struct vnt_private *priv)
{
- void __iomem *dwIoBase = priv->PortOffset;
-
- BBbWriteEmbedded(dwIoBase, 0x50, 0x40);
- BBbWriteEmbedded(dwIoBase, 0x50, 0);
- BBbWriteEmbedded(dwIoBase, 0x9C, 0x01);
- BBbWriteEmbedded(dwIoBase, 0x9C, 0);
+ BBbWriteEmbedded(priv, 0x50, 0x40);
+ BBbWriteEmbedded(priv, 0x50, 0);
+ BBbWriteEmbedded(priv, 0x9C, 0x01);
+ BBbWriteEmbedded(priv, 0x9C, 0);
}
/*
@@ -2296,7 +2296,7 @@ BBvPowerSaveModeON(struct vnt_private *priv)
BBbReadEmbedded(dwIoBase, 0x0D, &byOrgData);
byOrgData |= BIT(0);
- BBbWriteEmbedded(dwIoBase, 0x0D, byOrgData);
+ BBbWriteEmbedded(priv, 0x0D, byOrgData);
}
/*
@@ -2319,7 +2319,7 @@ BBvPowerSaveModeOFF(struct vnt_private *priv)
BBbReadEmbedded(dwIoBase, 0x0D, &byOrgData);
byOrgData &= ~(BIT(0));
- BBbWriteEmbedded(dwIoBase, 0x0D, byOrgData);
+ BBbWriteEmbedded(priv, 0x0D, byOrgData);
}
/*
@@ -2353,7 +2353,7 @@ BBvSetTxAntennaMode(struct vnt_private *priv, unsigned char byAntennaMode)
byBBTxConf &= 0xFD; /* 1111 1101 */
byBBTxConf |= 0x04;
}
- BBbWriteEmbedded(dwIoBase, 0x09, byBBTxConf); /* CR09 */
+ BBbWriteEmbedded(priv, 0x09, byBBTxConf); /* CR09 */
}
/*
@@ -2386,7 +2386,7 @@ BBvSetRxAntennaMode(struct vnt_private *priv, unsigned char byAntennaMode)
byBBRxConf &= 0xFE; /* 1111 1110 */
byBBRxConf |= 0x02;
}
- BBbWriteEmbedded(dwIoBase, 0x0A, byBBRxConf); /* CR10 */
+ BBbWriteEmbedded(priv, 0x0A, byBBRxConf); /* CR10 */
}
/*
@@ -2404,19 +2404,15 @@ BBvSetRxAntennaMode(struct vnt_private *priv, unsigned char byAntennaMode)
void
BBvSetDeepSleep(struct vnt_private *priv, unsigned char byLocalID)
{
- void __iomem *dwIoBase = priv->PortOffset;
-
- BBbWriteEmbedded(dwIoBase, 0x0C, 0x17); /* CR12 */
- BBbWriteEmbedded(dwIoBase, 0x0D, 0xB9); /* CR13 */
+ BBbWriteEmbedded(priv, 0x0C, 0x17); /* CR12 */
+ BBbWriteEmbedded(priv, 0x0D, 0xB9); /* CR13 */
}
void
BBvExitDeepSleep(struct vnt_private *priv, unsigned char byLocalID)
{
- void __iomem *dwIoBase = priv->PortOffset;
-
- BBbWriteEmbedded(dwIoBase, 0x0C, 0x00); /* CR12 */
- BBbWriteEmbedded(dwIoBase, 0x0D, 0x01); /* CR13 */
+ BBbWriteEmbedded(priv, 0x0C, 0x00); /* CR12 */
+ BBbWriteEmbedded(priv, 0x0D, 0x01); /* CR13 */
}
static
diff --git a/drivers/staging/vt6655/baseband.h b/drivers/staging/vt6655/baseband.h
index 26f9cdc..743ec4f 100644
--- a/drivers/staging/vt6655/baseband.h
+++ b/drivers/staging/vt6655/baseband.h
@@ -78,7 +78,7 @@ void vnt_get_phy_field(struct vnt_private *, u32 frame_length,
u16 tx_rate, u8 pkt_type, struct vnt_phy_field *);
bool BBbReadEmbedded(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned char *pbyData);
-bool BBbWriteEmbedded(void __iomem *dwIoBase, unsigned char byBBAddr, unsigned char byData);
+bool BBbWriteEmbedded(struct vnt_private *, unsigned char byBBAddr, unsigned char byData);
void BBvSetShortSlotTime(struct vnt_private *);
void BBvSetVGAGainOffset(struct vnt_private *, unsigned char byData);
diff --git a/drivers/staging/vt6655/card.c b/drivers/staging/vt6655/card.c
index 0121466..6f1cea0 100644
--- a/drivers/staging/vt6655/card.c
+++ b/drivers/staging/vt6655/card.c
@@ -225,20 +225,20 @@ bool CARDbSetPhyParameter(struct vnt_private *pDevice, CARD_PHY_TYPE ePHYType,
pDevice->abyBBVGA[3] = 0x10;
BBbReadEmbedded(pDevice->PortOffset, 0xE7, &byData);
if (byData == 0x1C)
- BBbWriteEmbedded(pDevice->PortOffset, 0xE7, pDevice->abyBBVGA[0]);
+ BBbWriteEmbedded(pDevice, 0xE7, pDevice->abyBBVGA[0]);
} else if (pDevice->byRFType == RF_UW2452) {
MACvSetBBType(pDevice->PortOffset, BB_TYPE_11A);
pDevice->abyBBVGA[0] = 0x18;
BBbReadEmbedded(pDevice->PortOffset, 0xE7, &byData);
if (byData == 0x14) {
- BBbWriteEmbedded(pDevice->PortOffset, 0xE7, pDevice->abyBBVGA[0]);
- BBbWriteEmbedded(pDevice->PortOffset, 0xE1, 0x57);
+ BBbWriteEmbedded(pDevice, 0xE7, pDevice->abyBBVGA[0]);
+ BBbWriteEmbedded(pDevice, 0xE1, 0x57);
}
} else {
MACvSetBBType(pDevice->PortOffset, BB_TYPE_11A);
}
- BBbWriteEmbedded(pDevice->PortOffset, 0x88, 0x03);
+ BBbWriteEmbedded(pDevice, 0x88, 0x03);
bySlot = C_SLOT_SHORT;
bySIFS = C_SIFS_A;
byDIFS = C_SIFS_A + 2*C_SLOT_SHORT;
@@ -251,17 +251,17 @@ bool CARDbSetPhyParameter(struct vnt_private *pDevice, CARD_PHY_TYPE ePHYType,
pDevice->abyBBVGA[3] = 0x00;
BBbReadEmbedded(pDevice->PortOffset, 0xE7, &byData);
if (byData == 0x20)
- BBbWriteEmbedded(pDevice->PortOffset, 0xE7, pDevice->abyBBVGA[0]);
+ BBbWriteEmbedded(pDevice, 0xE7, pDevice->abyBBVGA[0]);
} else if (pDevice->byRFType == RF_UW2452) {
pDevice->abyBBVGA[0] = 0x14;
BBbReadEmbedded(pDevice->PortOffset, 0xE7, &byData);
if (byData == 0x18) {
- BBbWriteEmbedded(pDevice->PortOffset, 0xE7, pDevice->abyBBVGA[0]);
- BBbWriteEmbedded(pDevice->PortOffset, 0xE1, 0xD3);
+ BBbWriteEmbedded(pDevice, 0xE7, pDevice->abyBBVGA[0]);
+ BBbWriteEmbedded(pDevice, 0xE1, 0xD3);
}
}
- BBbWriteEmbedded(pDevice->PortOffset, 0x88, 0x02);
+ BBbWriteEmbedded(pDevice, 0x88, 0x02);
bySlot = C_SLOT_LONG;
bySIFS = C_SIFS_BG;
byDIFS = C_SIFS_BG + 2*C_SLOT_LONG;
@@ -274,17 +274,17 @@ bool CARDbSetPhyParameter(struct vnt_private *pDevice, CARD_PHY_TYPE ePHYType,
pDevice->abyBBVGA[3] = 0x00;
BBbReadEmbedded(pDevice->PortOffset, 0xE7, &byData);
if (byData == 0x20)
- BBbWriteEmbedded(pDevice->PortOffset, 0xE7, pDevice->abyBBVGA[0]);
+ BBbWriteEmbedded(pDevice, 0xE7, pDevice->abyBBVGA[0]);
} else if (pDevice->byRFType == RF_UW2452) {
pDevice->abyBBVGA[0] = 0x14;
BBbReadEmbedded(pDevice->PortOffset, 0xE7, &byData);
if (byData == 0x18) {
- BBbWriteEmbedded(pDevice->PortOffset, 0xE7, pDevice->abyBBVGA[0]);
- BBbWriteEmbedded(pDevice->PortOffset, 0xE1, 0xD3);
+ BBbWriteEmbedded(pDevice, 0xE7, pDevice->abyBBVGA[0]);
+ BBbWriteEmbedded(pDevice, 0xE1, 0xD3);
}
}
- BBbWriteEmbedded(pDevice->PortOffset, 0x88, 0x08);
+ BBbWriteEmbedded(pDevice, 0x88, 0x08);
bySIFS = C_SIFS_BG;
if (pDevice->bShortSlotTime) {
--
2.1.0