Commit bf5f6ca4 authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz Committed by Greg Kroah-Hartman

Staging: rtxxx0: unify different RT30xx{Read,Write}RFRegister() flavors

RTMP_IO_{READ,WRITE}32 equals RTUSB{Read,Write}MACRegister
in case of USB chipsets so unify RT30xx and !RT30xx code.
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent ca3d0a5c
...@@ -5635,117 +5635,6 @@ VOID AsicUpdateProtect( ...@@ -5635,117 +5635,6 @@ VOID AsicUpdateProtect(
} }
} }
#ifdef RT30xx
/*
========================================================================
Routine Description: Write RT30xx RF register through MAC
Arguments:
Return Value:
IRQL =
Note:
========================================================================
*/
NTSTATUS RT30xxWriteRFRegister(
IN PRTMP_ADAPTER pAd,
IN UCHAR RegID,
IN UCHAR Value)
{
RF_CSR_CFG_STRUC rfcsr;
UINT i = 0;
do
{
RTMP_IO_READ32(pAd, RF_CSR_CFG, &rfcsr.word);
if (!rfcsr.field.RF_CSR_KICK)
break;
i++;
}
while ((i < RETRY_LIMIT) && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)));
if ((i == RETRY_LIMIT) || (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)))
{
DBGPRINT_RAW(RT_DEBUG_ERROR, ("Retry count exhausted or device removed!!!\n"));
return STATUS_UNSUCCESSFUL;
}
rfcsr.field.RF_CSR_WR = 1;
rfcsr.field.RF_CSR_KICK = 1;
rfcsr.field.TESTCSR_RFACC_REGNUM = RegID;
rfcsr.field.RF_CSR_DATA = Value;
RTMP_IO_WRITE32(pAd, RF_CSR_CFG, rfcsr.word);
return STATUS_SUCCESS;
}
/*
========================================================================
Routine Description: Read RT30xx RF register through MAC
Arguments:
Return Value:
IRQL =
Note:
========================================================================
*/
NTSTATUS RT30xxReadRFRegister(
IN PRTMP_ADAPTER pAd,
IN UCHAR RegID,
IN PUCHAR pValue)
{
RF_CSR_CFG_STRUC rfcsr;
UINT i=0, k=0;
for (i=0; i<MAX_BUSY_COUNT; i++)
{
RTMP_IO_READ32(pAd, RF_CSR_CFG, &rfcsr.word);
if (rfcsr.field.RF_CSR_KICK == BUSY)
{
continue;
}
rfcsr.word = 0;
rfcsr.field.RF_CSR_WR = 0;
rfcsr.field.RF_CSR_KICK = 1;
rfcsr.field.TESTCSR_RFACC_REGNUM = RegID;
RTMP_IO_WRITE32(pAd, RF_CSR_CFG, rfcsr.word);
for (k=0; k<MAX_BUSY_COUNT; k++)
{
RTMP_IO_READ32(pAd, RF_CSR_CFG, &rfcsr.word);
if (rfcsr.field.RF_CSR_KICK == IDLE)
break;
}
if ((rfcsr.field.RF_CSR_KICK == IDLE) &&
(rfcsr.field.TESTCSR_RFACC_REGNUM == RegID))
{
*pValue = (UCHAR)rfcsr.field.RF_CSR_DATA;
break;
}
}
if (rfcsr.field.RF_CSR_KICK == BUSY)
{
DBGPRINT_ERR(("RF read R%d=0x%x fail, i[%d], k[%d]\n", RegID, rfcsr.word,i,k));
return STATUS_UNSUCCESSFUL;
}
return STATUS_SUCCESS;
}
#endif // RT30xx //
#ifdef RT30xx #ifdef RT30xx
// add by johnli, RF power sequence setup // add by johnli, RF power sequence setup
/* /*
......
...@@ -47,10 +47,11 @@ ...@@ -47,10 +47,11 @@
#define PCI_EECTRL 0x0004 #define PCI_EECTRL 0x0004
#define PCI_MCUCTRL 0x0008 #define PCI_MCUCTRL 0x0008
typedef int NTSTATUS;
#ifdef RT30xx #ifdef RT30xx
#define OPT_14 0x114 #define OPT_14 0x114
typedef int NTSTATUS;
#define RETRY_LIMIT 10 #define RETRY_LIMIT 10
#define STATUS_SUCCESS 0x00 #define STATUS_SUCCESS 0x00
#define STATUS_UNSUCCESSFUL 0x01 #define STATUS_UNSUCCESSFUL 0x01
......
...@@ -6528,7 +6528,6 @@ VOID AsicTurnOnRFClk( ...@@ -6528,7 +6528,6 @@ VOID AsicTurnOnRFClk(
IN PRTMP_ADAPTER pAd, IN PRTMP_ADAPTER pAd,
IN UCHAR Channel); IN UCHAR Channel);
#ifdef RT30xx
NTSTATUS RT30xxWriteRFRegister( NTSTATUS RT30xxWriteRFRegister(
IN PRTMP_ADAPTER pAd, IN PRTMP_ADAPTER pAd,
IN UCHAR RegID, IN UCHAR RegID,
...@@ -6539,6 +6538,7 @@ NTSTATUS RT30xxReadRFRegister( ...@@ -6539,6 +6538,7 @@ NTSTATUS RT30xxReadRFRegister(
IN UCHAR RegID, IN UCHAR RegID,
IN PUCHAR pValue); IN PUCHAR pValue);
#ifdef RT30xx
//2008/09/11:KH add to support efuse<-- //2008/09/11:KH add to support efuse<--
UCHAR eFuseReadRegisters( UCHAR eFuseReadRegisters(
IN PRTMP_ADAPTER pAd, IN PRTMP_ADAPTER pAd,
...@@ -6735,18 +6735,6 @@ NTSTATUS RTUSBWriteRFRegister( ...@@ -6735,18 +6735,6 @@ NTSTATUS RTUSBWriteRFRegister(
IN PRTMP_ADAPTER pAd, IN PRTMP_ADAPTER pAd,
IN UINT32 Value); IN UINT32 Value);
#ifndef RT30xx
NTSTATUS RT30xxWriteRFRegister(
IN PRTMP_ADAPTER pAd,
IN UCHAR RegID,
IN UCHAR Value);
NTSTATUS RT30xxReadRFRegister(
IN PRTMP_ADAPTER pAd,
IN UCHAR RegID,
IN PUCHAR pValue);
#endif
NTSTATUS RTUSB_VendorRequest( NTSTATUS RTUSB_VendorRequest(
IN PRTMP_ADAPTER pAd, IN PRTMP_ADAPTER pAd,
IN UINT32 TransferFlags, IN UINT32 TransferFlags,
......
...@@ -671,11 +671,10 @@ NTSTATUS RTUSBWriteRFRegister( ...@@ -671,11 +671,10 @@ NTSTATUS RTUSBWriteRFRegister(
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
#ifndef RT30xx
/* /*
======================================================================== ========================================================================
Routine Description: Write RT3070 RF register through MAC Routine Description: Write RT30xx RF register through MAC
Arguments: Arguments:
...@@ -687,7 +686,7 @@ NTSTATUS RTUSBWriteRFRegister( ...@@ -687,7 +686,7 @@ NTSTATUS RTUSBWriteRFRegister(
======================================================================== ========================================================================
*/ */
NTSTATUS RT30xxWriteRFRegister( NTSTATUS RT30xxWriteRFRegister(
IN PRTMP_ADAPTER pAd, IN PRTMP_ADAPTER pAd,
IN UCHAR RegID, IN UCHAR RegID,
IN UCHAR Value) IN UCHAR Value)
...@@ -697,7 +696,7 @@ NTSTATUS RT30xxWriteRFRegister( ...@@ -697,7 +696,7 @@ NTSTATUS RT30xxWriteRFRegister(
do do
{ {
RTUSBReadMACRegister(pAd, RF_CSR_CFG, &rfcsr.word); RTMP_IO_READ32(pAd, RF_CSR_CFG, &rfcsr.word);
if (!rfcsr.field.RF_CSR_KICK) if (!rfcsr.field.RF_CSR_KICK)
break; break;
...@@ -716,15 +715,16 @@ NTSTATUS RT30xxWriteRFRegister( ...@@ -716,15 +715,16 @@ NTSTATUS RT30xxWriteRFRegister(
rfcsr.field.TESTCSR_RFACC_REGNUM = RegID; rfcsr.field.TESTCSR_RFACC_REGNUM = RegID;
rfcsr.field.RF_CSR_DATA = Value; rfcsr.field.RF_CSR_DATA = Value;
RTUSBWriteMACRegister(pAd, RF_CSR_CFG, rfcsr.word); RTMP_IO_WRITE32(pAd, RF_CSR_CFG, rfcsr.word);
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
/* /*
======================================================================== ========================================================================
Routine Description: Read RT3070 RF register through MAC Routine Description: Read RT30xx RF register through MAC
Arguments: Arguments:
...@@ -736,17 +736,17 @@ NTSTATUS RT30xxWriteRFRegister( ...@@ -736,17 +736,17 @@ NTSTATUS RT30xxWriteRFRegister(
======================================================================== ========================================================================
*/ */
NTSTATUS RT30xxReadRFRegister( NTSTATUS RT30xxReadRFRegister(
IN PRTMP_ADAPTER pAd, IN PRTMP_ADAPTER pAd,
IN UCHAR RegID, IN UCHAR RegID,
IN PUCHAR pValue) IN PUCHAR pValue)
{ {
RF_CSR_CFG_STRUC rfcsr; RF_CSR_CFG_STRUC rfcsr;
UINT i=0, k; UINT i=0, k=0;
for (i=0; i<MAX_BUSY_COUNT; i++) for (i=0; i<MAX_BUSY_COUNT; i++)
{ {
RTUSBReadMACRegister(pAd, RF_CSR_CFG, &rfcsr.word); RTMP_IO_READ32(pAd, RF_CSR_CFG, &rfcsr.word);
if (rfcsr.field.RF_CSR_KICK == BUSY) if (rfcsr.field.RF_CSR_KICK == BUSY)
{ {
...@@ -756,10 +756,10 @@ NTSTATUS RT30xxReadRFRegister( ...@@ -756,10 +756,10 @@ NTSTATUS RT30xxReadRFRegister(
rfcsr.field.RF_CSR_WR = 0; rfcsr.field.RF_CSR_WR = 0;
rfcsr.field.RF_CSR_KICK = 1; rfcsr.field.RF_CSR_KICK = 1;
rfcsr.field.TESTCSR_RFACC_REGNUM = RegID; rfcsr.field.TESTCSR_RFACC_REGNUM = RegID;
RTUSBWriteMACRegister(pAd, RF_CSR_CFG, rfcsr.word); RTMP_IO_WRITE32(pAd, RF_CSR_CFG, rfcsr.word);
for (k=0; k<MAX_BUSY_COUNT; k++) for (k=0; k<MAX_BUSY_COUNT; k++)
{ {
RTUSBReadMACRegister(pAd, RF_CSR_CFG, &rfcsr.word); RTMP_IO_READ32(pAd, RF_CSR_CFG, &rfcsr.word);
if (rfcsr.field.RF_CSR_KICK == IDLE) if (rfcsr.field.RF_CSR_KICK == IDLE)
break; break;
...@@ -773,13 +773,12 @@ NTSTATUS RT30xxReadRFRegister( ...@@ -773,13 +773,12 @@ NTSTATUS RT30xxReadRFRegister(
} }
if (rfcsr.field.RF_CSR_KICK == BUSY) if (rfcsr.field.RF_CSR_KICK == BUSY)
{ {
DBGPRINT_ERR(("RF read R%d=0x%x fail\n", RegID, rfcsr.word)); DBGPRINT_ERR(("RF read R%d=0x%x fail, i[%d], k[%d]\n", RegID, rfcsr.word,i,k));
return STATUS_UNSUCCESSFUL; return STATUS_UNSUCCESSFUL;
} }
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
#endif /* RT30xx */
/* /*
======================================================================== ========================================================================
......
...@@ -411,9 +411,6 @@ extern UCHAR EpToQueue[6]; ...@@ -411,9 +411,6 @@ extern UCHAR EpToQueue[6];
//#undef MlmeAllocateMemory //#undef MlmeAllocateMemory
//#undef MlmeFreeMemory //#undef MlmeFreeMemory
#ifndef RT30xx
typedef int NTSTATUS;
#endif
typedef struct usb_device * PUSB_DEV; typedef struct usb_device * PUSB_DEV;
/* MACRO for linux usb */ /* MACRO for linux usb */
......
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