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

Staging: rt2860: prepare for rt28[67]0/*.[ch] merge

Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 0eae1ca3
......@@ -2,6 +2,7 @@ obj-$(CONFIG_RT2860) += rt2860sta.o
# TODO: all of these should be removed
EXTRA_CFLAGS += -DLINUX -DAGGREGATION_SUPPORT -DPIGGYBACK_SUPPORT -DWMM_SUPPORT
EXTRA_CFLAGS += -DRT2860
EXTRA_CFLAGS += -DDBG
rt2860sta-objs := \
......
......@@ -324,6 +324,13 @@ VOID APQuickResponeForRateUpExec(
IN PVOID SystemSpecific2,
IN PVOID SystemSpecific3);
#ifdef RT2870
VOID BeaconUpdateExec(
IN PVOID SystemSpecific1,
IN PVOID FunctionContext,
IN PVOID SystemSpecific2,
IN PVOID SystemSpecific3);
#endif // RT2870 //
VOID RTMPSetPiggyBack(
IN PRTMP_ADAPTER pAd,
......
......@@ -524,7 +524,12 @@ static CH_REGION ChRegion[] =
JAP,
{
{ 1, 14, 20, BOTH, FALSE}, // 2.4 G, ch 1~14
#ifndef RT30xx
{ 36, 4, 23, IDOR, FALSE}, // 5G, ch 36~48
#endif
#ifdef RT30xx
{ 34, 4, 23, IDOR, FALSE}, // 5G, ch 34~46
#endif
{ 0}, // end
}
},
......
......@@ -535,8 +535,10 @@ typedef enum _NDIS_802_11_WEP_STATUS
Ndis802_11Encryption3KeyAbsent,
Ndis802_11Encryption4Enabled, // TKIP or AES mix
Ndis802_11Encryption4KeyAbsent,
#ifndef RT30xx
Ndis802_11GroupWEP40Enabled,
Ndis802_11GroupWEP104Enabled,
#endif
} NDIS_802_11_WEP_STATUS, *PNDIS_802_11_WEP_STATUS,
NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS;
......@@ -631,11 +633,17 @@ typedef struct _NDIS_802_11_CAPABILITY
#define SIOCIWFIRSTPRIV SIOCDEVPRIVATE
#endif
#ifdef RT30xx
#define RT_PRIV_IOCTL_EXT (SIOCIWFIRSTPRIV + 0x01) // Sync. with AP for wsc upnp daemon
#endif
#define RTPRIV_IOCTL_SET (SIOCIWFIRSTPRIV + 0x02)
#ifdef DBG
#define RTPRIV_IOCTL_BBP (SIOCIWFIRSTPRIV + 0x03)
#define RTPRIV_IOCTL_MAC (SIOCIWFIRSTPRIV + 0x05)
#ifdef RT30xx
#define RTPRIV_IOCTL_RF (SIOCIWFIRSTPRIV + 0x13)
#endif
#define RTPRIV_IOCTL_E2P (SIOCIWFIRSTPRIV + 0x07)
#endif
......@@ -652,9 +660,16 @@ enum {
SHOW_DRVIER_VERION = 5,
SHOW_BA_INFO = 6,
SHOW_DESC_INFO = 7,
#ifdef RT2870
SHOW_RXBULK_INFO = 8,
SHOW_TXBULK_INFO = 9,
#endif // RT2870 //
RAIO_OFF = 10,
RAIO_ON = 11,
SHOW_CFG_VALUE = 20,
#if !defined(RT2860) && !defined(RT30xx)
SHOW_ADHOC_ENTRY_INFO = 21,
#endif
};
#define OID_802_11_BUILD_CHANNEL_EX 0x0714
......@@ -662,13 +677,41 @@ enum {
#define OID_802_11_GET_COUNTRY_CODE 0x0716
#define OID_802_11_GET_CHANNEL_GEOGRAPHY 0x0717
#ifdef RT30xx
#define RT_OID_WSC_SET_PASSPHRASE 0x0740 // passphrase for wpa(2)-psk
#define RT_OID_WSC_DRIVER_AUTO_CONNECT 0x0741
#define RT_OID_WSC_QUERY_DEFAULT_PROFILE 0x0742
#define RT_OID_WSC_SET_CONN_BY_PROFILE_INDEX 0x0743
#define RT_OID_WSC_SET_ACTION 0x0744
#define RT_OID_WSC_SET_SSID 0x0745
#define RT_OID_WSC_SET_PIN_CODE 0x0746
#define RT_OID_WSC_SET_MODE 0x0747 // PIN or PBC
#define RT_OID_WSC_SET_CONF_MODE 0x0748 // Enrollee or Registrar
#define RT_OID_WSC_SET_PROFILE 0x0749
#define RT_OID_802_11_WSC_QUERY_PROFILE 0x0750
// for consistency with RT61
#define RT_OID_WSC_QUERY_STATUS 0x0751
#define RT_OID_WSC_PIN_CODE 0x0752
#define RT_OID_WSC_UUID 0x0753
#define RT_OID_WSC_SET_SELECTED_REGISTRAR 0x0754
#define RT_OID_WSC_EAPMSG 0x0755
#define RT_OID_WSC_MANUFACTURER 0x0756
#define RT_OID_WSC_MODEL_NAME 0x0757
#define RT_OID_WSC_MODEL_NO 0x0758
#define RT_OID_WSC_SERIAL_NO 0x0759
#define RT_OID_WSC_MAC_ADDRESS 0x0760
#endif
#ifdef LLTD_SUPPORT
// for consistency with RT61
#define RT_OID_GET_PHY_MODE 0x761
#endif // LLTD_SUPPORT //
#if defined(RT2860) || defined(RT30xx)
// New for MeetingHouse Api support
#define OID_MH_802_1X_SUPPORTED 0xFFEDC100
#endif
// MIMO Tx parameter, ShortGI, MCS, STBC, etc. these are fields in TXWI. Don't change this definition!!!
typedef union _HTTRANSMIT_SETTING {
......@@ -691,7 +734,6 @@ typedef enum _RT_802_11_PREAMBLE {
} RT_802_11_PREAMBLE, *PRT_802_11_PREAMBLE;
// Only for STA, need to sync with AP
// 2005-03-08 match current RaConfig.
typedef enum _RT_802_11_PHY_MODE {
PHY_11BG_MIXED = 0,
PHY_11B,
......@@ -886,6 +928,27 @@ typedef struct _RT_CHANNEL_LIST_INFO
UCHAR ChannelListNum; // number of channel in ChannelList[]
} RT_CHANNEL_LIST_INFO, *PRT_CHANNEL_LIST_INFO;
#ifdef RT2870
// WSC configured credential
typedef struct _WSC_CREDENTIAL
{
NDIS_802_11_SSID SSID; // mandatory
USHORT AuthType; // mandatory, 1: open, 2: wpa-psk, 4: shared, 8:wpa, 0x10: wpa2, 0x20: wpa2-psk
USHORT EncrType; // mandatory, 1: none, 2: wep, 4: tkip, 8: aes
UCHAR Key[64]; // mandatory, Maximum 64 byte
USHORT KeyLength;
UCHAR MacAddr[6]; // mandatory, AP MAC address
UCHAR KeyIndex; // optional, default is 1
UCHAR Rsvd[3]; // Make alignment
} WSC_CREDENTIAL, *PWSC_CREDENTIAL;
// WSC configured profiles
typedef struct _WSC_PROFILE
{
UINT ProfileCnt;
WSC_CREDENTIAL Profile[8]; // Support up to 8 profiles
} WSC_PROFILE, *PWSC_PROFILE;
#endif
#endif // _OID_H_
......@@ -47,6 +47,15 @@
#define PCI_EECTRL 0x0004
#define PCI_MCUCTRL 0x0008
#ifdef RT30xx
#define OPT_14 0x114
typedef int NTSTATUS;
#define RETRY_LIMIT 10
#define STATUS_SUCCESS 0x00
#define STATUS_UNSUCCESSFUL 0x01
#endif
//
// SCH/DMA registers - base address 0x0200
//
......@@ -282,6 +291,36 @@ typedef union _USB_DMA_CFG_STRUC {
#define PBF_DBG 0x043c
#define PBF_CAP_CTRL 0x0440
#ifdef RT30xx
// eFuse registers
#define EFUSE_CTRL 0x0580
#define EFUSE_DATA0 0x0590
#define EFUSE_DATA1 0x0594
#define EFUSE_DATA2 0x0598
#define EFUSE_DATA3 0x059c
#define EFUSE_USAGE_MAP_START 0x2d0
#define EFUSE_USAGE_MAP_END 0x2fc
#define EFUSE_TAG 0x2fe
#define EFUSE_USAGE_MAP_SIZE 45
typedef union _EFUSE_CTRL_STRUC {
struct {
UINT32 EFSROM_AOUT:6;
UINT32 EFSROM_MODE:2;
UINT32 EFSROM_LDO_OFF_TIME:6;
UINT32 EFSROM_LDO_ON_TIME:2;
UINT32 EFSROM_AIN:10;
UINT32 RESERVED:4;
UINT32 EFSROM_KICK:1;
UINT32 SEL_EFUSE:1;
} field;
UINT32 word;
} EFUSE_CTRL_STRUC, *PEFUSE_CTRL_STRUC;
#define LDO_CFG0 0x05d4
#define GPIO_SWITCH 0x05dc
#endif /* RT30xx */
//
// 4 MAC registers
//
......@@ -1007,10 +1046,16 @@ typedef struct _HW_WCID_ENTRY { // 8-byte per entry
#define E2PROM_CSR 0x0004
#define IO_CNTL_CSR 0x77d0
#ifdef RT2860
// 8051 firmware image for RT2860 - base address = 0x4000
#define FIRMWARE_IMAGE_BASE 0x2000
#define MAX_FIRMWARE_IMAGE_SIZE 0x2000 // 8kbyte
#endif
#ifdef RT2870
// 8051 firmware image for usb - use last-half base address = 0x3000
#define FIRMWARE_IMAGE_BASE 0x3000
#define MAX_FIRMWARE_IMAGE_SIZE 0x1000 // 4kbyte
#endif // RT2870 //
// ================================================================
// Tx / Rx / Mgmt ring descriptor definition
......@@ -1091,6 +1136,9 @@ typedef struct _HW_WCID_ENTRY { // 8-byte per entry
#define BBP_R22 22
#define BBP_R24 24
#define BBP_R25 25
#ifdef RT30xx
#define BBP_R31 31
#endif
#define BBP_R49 49 //TSSI
#define BBP_R50 50
#define BBP_R51 51
......@@ -1108,6 +1156,10 @@ typedef struct _HW_WCID_ENTRY { // 8-byte per entry
#define BBP_R73 73
#define BBP_R75 75
#define BBP_R77 77
#ifdef RT30xx
#define BBP_R79 79
#define BBP_R80 80
#endif
#define BBP_R81 81
#define BBP_R82 82
#define BBP_R83 83
......@@ -1129,6 +1181,9 @@ typedef struct _HW_WCID_ENTRY { // 8-byte per entry
#define BBP_R121 121
#define BBP_R122 122
#define BBP_R123 123
#ifdef RT30xx
#define BBP_R138 138 // add by johnli, RF power sequence setup, ADC dynamic on/off control
#endif // RT30xx //
#define BBPR94_DEFAULT 0x06 // Add 1 value will gain 1db
......@@ -1294,6 +1349,7 @@ typedef struct PACKED _TXWI_STRUC {
//
// Rx descriptor format, Rx Ring
//
#ifdef RT2860
typedef struct PACKED _RXD_STRUC {
// Word 0
UINT32 SDP0;
......@@ -1326,6 +1382,7 @@ typedef struct PACKED _RXD_STRUC {
UINT32 PlcpRssil:1;// To be moved
UINT32 Rsv1:13;
} RXD_STRUC, *PRXD_STRUC, RT28XX_RXD_STRUC, *PRT28XX_RXD_STRUC;
#endif /* RT2860 */
//
// RXWI wireless information format, in PBF. invisible in driver.
......@@ -1550,7 +1607,15 @@ typedef union _EEPROM_NIC_CINFIG2_STRUC {
USHORT EnableWPSPBC:1; // WPS PBC Control bit
USHORT BW40MAvailForG:1; // 0:enable, 1:disable
USHORT BW40MAvailForA:1; // 0:enable, 1:disable
#ifndef RT30xx
USHORT Rsv2:6; // must be 0
#endif
#ifdef RT30xx
USHORT Rsv1:1; // must be 0
USHORT AntDiversity:1; // Antenna diversity
USHORT Rsv2:3; // must be 0
USHORT DACTestBit:1; // control if driver should patch the DAC issue
#endif
} field;
USHORT word;
} EEPROM_NIC_CONFIG2_STRUC, *PEEPROM_NIC_CONFIG2_STRUC;
......
......@@ -47,8 +47,12 @@
#include "rtmp_def.h"
#include "rt28xx.h"
#ifdef RT2860
#include "rt2860.h"
#endif
#ifdef RT2870
#include "../rt2870/rt2870.h"
#endif // RT2870 //
#include "oid.h"
#include "mlme.h"
......
......@@ -33,6 +33,9 @@ BUILD_TIMER_FUNCTION(MlmePeriodicExec);
BUILD_TIMER_FUNCTION(AsicRxAntEvalTimeout);
BUILD_TIMER_FUNCTION(APSDPeriodicExec);
BUILD_TIMER_FUNCTION(AsicRfTuningExec);
#ifdef RT2870
BUILD_TIMER_FUNCTION(BeaconUpdateExec);
#endif // RT2870 //
BUILD_TIMER_FUNCTION(BeaconTimeout);
BUILD_TIMER_FUNCTION(ScanTimeout);
......@@ -43,8 +46,10 @@ BUILD_TIMER_FUNCTION(DisassocTimeout);
BUILD_TIMER_FUNCTION(LinkDownExec);
BUILD_TIMER_FUNCTION(StaQuickResponeForRateUpExec);
BUILD_TIMER_FUNCTION(WpaDisassocApAndBlockAssoc);
#ifdef RT2860
BUILD_TIMER_FUNCTION(PsPollWakeExec);
BUILD_TIMER_FUNCTION(RadioOnExec);
#endif
// for wireless system event message
char const *pWirelessSysEventText[IW_SYS_EVENT_TYPE_NUM] = {
......@@ -281,9 +286,9 @@ VOID RTMPFreeAdapter(
NdisFreeSpinLock(&pAd->MgmtRingLock);
#ifdef RT2860
NdisFreeSpinLock(&pAd->RxRingLock);
#endif
for (index =0 ; index < NUM_OF_TX_RING; index++)
{
NdisFreeSpinLock(&pAd->TxSwQueueLock[index]);
......@@ -829,7 +834,12 @@ void send_monitor_packets(
if (pRxBlk->DataSize + sizeof(wlan_ng_prism2_header) > RX_BUFFER_AGGRESIZE)
{
#ifndef RT30xx
DBGPRINT(RT_DEBUG_ERROR, ("%s : Size is too large! (%zu)\n", __func__, pRxBlk->DataSize + sizeof(wlan_ng_prism2_header)));
#endif
#ifdef RT30xx
DBGPRINT(RT_DEBUG_ERROR, ("%s : Size is too large! (%d)\n", __func__, pRxBlk->DataSize + sizeof(wlan_ng_prism2_header)));
#endif
goto err_free_sk_buff;
}
......
......@@ -43,6 +43,9 @@
#include "rtmp_type.h"
#include <linux/module.h>
#include <linux/kernel.h>
#if !defined(RT2860) && !defined(RT30xx)
#include <linux/kthread.h>
#endif
#include <linux/spinlock.h>
#include <linux/init.h>
......@@ -64,6 +67,9 @@
#include <linux/vmalloc.h>
#ifdef RT30xx
#include <linux/wireless.h>
#endif
#include <net/iw_handler.h>
// load firmware
......@@ -87,16 +93,31 @@ typedef int (*HARD_START_XMIT_FUNC)(struct sk_buff *skb, struct net_device *net_
// add by kathy
#ifdef RT2860
#define STA_PROFILE_PATH "/etc/Wireless/RT2860STA/RT2860STA.dat"
#define STA_RTMP_FIRMWARE_FILE_NAME "/etc/Wireless/RT2860STA/RT2860STA.bin"
#define STA_NIC_DEVICE_NAME "RT2860STA"
#define STA_DRIVER_VERSION "1.8.1.1"
#endif
#ifdef RT2870
#define STA_PROFILE_PATH "/etc/Wireless/RT2870STA/RT2870STA.dat"
#define STA_RT2870_IMAGE_FILE_NAME "/etc/Wireless/RT2870STA/rt2870.bin"
#define STA_NIC_DEVICE_NAME "RT2870STA"
#ifndef RT30xx
#define STA_DRIVER_VERSION "1.4.0.0"
#endif
#ifdef RT30xx
#define STA_DRIVER_VERSION "2.0.1.0"
#endif
#endif
#ifdef RT2860
#ifndef PCI_DEVICE
#define PCI_DEVICE(vend,dev) \
.vendor = (vend), .device = (dev), \
.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
#endif // PCI_DEVICE //
#endif
#define RTMP_TIME_AFTER(a,b) \
(typecheck(unsigned long, (unsigned long)a) && \
......@@ -143,12 +164,16 @@ typedef int (*HARD_START_XMIT_FUNC)(struct sk_buff *skb, struct net_device *net_
#define NDIS_PACKET_TYPE_BROADCAST 2
#define NDIS_PACKET_TYPE_ALL_MULTICAST 3
#ifndef RT30xx
typedef struct pid * THREAD_PID;
#ifdef RT2860
#define THREAD_PID_INIT_VALUE NULL
#endif
#define GET_PID(_v) find_get_pid(_v)
#define GET_PID_NUMBER(_v) pid_nr(_v)
#define CHECK_PID_LEGALITY(_pid) if (pid_nr(_pid) >= 0)
#define KILL_THREAD_PID(_A, _B, _C) kill_pid(_A, _B, _C)
#endif
struct os_lock {
spinlock_t lock;
......@@ -157,10 +182,25 @@ struct os_lock {
struct os_cookie {
#ifdef RT2860
struct pci_dev *pci_dev;
struct pci_dev *parent_pci_dev;
dma_addr_t pAd_pa;
#endif
#ifdef RT2870
struct usb_device *pUsb_Dev;
#ifndef RT30xx
struct task_struct *MLMEThr_task;
struct task_struct *RTUSBCmdThr_task;
struct task_struct *TimerQThr_task;
#endif
#ifdef RT30xx
struct pid *MLMEThr_pid;
struct pid *RTUSBCmdThr_pid;
struct pid *TimerQThr_pid;
#endif
#endif // RT2870 //
struct tasklet_struct rx_done_task;
struct tasklet_struct mgmt_dma_done_task;
......@@ -170,8 +210,14 @@ struct os_cookie {
struct tasklet_struct ac3_dma_done_task;
struct tasklet_struct hcca_dma_done_task;
struct tasklet_struct tbtt_task;
#ifdef RT2860
struct tasklet_struct fifo_statistic_full_task;
#endif
#ifdef RT2870
struct tasklet_struct null_frame_complete_task;
struct tasklet_struct rts_frame_complete_task;
struct tasklet_struct pspoll_frame_complete_task;
#endif // RT2870 //
unsigned long apd_pid; //802.1x daemon pid
INT ioctl_if_type;
......@@ -219,6 +265,7 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, int
#define RT2860_PCI_DEVICE_ID 0x0601
#ifdef RT2860
#define PCI_MAP_SINGLE(_handle, _ptr, _size, _sd_idx, _dir) \
linux_pci_map_single(_handle, _ptr, _size, _sd_idx, _dir)
......@@ -233,7 +280,12 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, int
#define DEV_ALLOC_SKB(_length) \
dev_alloc_skb(_length)
#endif
#ifdef RT2870
#define PCI_MAP_SINGLE(_handle, _ptr, _size, _dir) (ULONG)0
#define PCI_UNMAP_SINGLE(_handle, _ptr, _size, _dir)
#endif // RT2870 //
#define BEACON_FRAME_DMA_CACHE_WBACK(_ptr, _size) \
......@@ -247,9 +299,20 @@ void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, int
#define NdisMIndicateStatus(_w, _x, _y, _z)
typedef struct timer_list RTMP_OS_TIMER;
#ifdef RT2870
/* ----------------- Timer Related MARCO ---------------*/
// In RT2870, we have a lot of timer functions and will read/write register, it's
// not allowed in Linux USB sub-system to do it ( because of sleep issue when submit
// to ctrl pipe). So we need a wrapper function to take care it.
typedef VOID (*RT2870_TIMER_HANDLE)(
IN PVOID SystemSpecific1,
IN PVOID FunctionContext,
IN PVOID SystemSpecific2,
IN PVOID SystemSpecific3);
#endif // RT2870 //
typedef struct _RALINK_TIMER_STRUCT {
......@@ -260,9 +323,42 @@ typedef struct _RALINK_TIMER_STRUCT {
BOOLEAN Repeat; // True if periodic timer
ULONG TimerValue; // Timer value in milliseconds
ULONG cookie; // os specific object
#ifdef RT2870
RT2870_TIMER_HANDLE handle;
void *pAd;
#endif // RT2870 //
} RALINK_TIMER_STRUCT, *PRALINK_TIMER_STRUCT;
#ifdef RT2870
typedef enum _RT2870_KERNEL_THREAD_STATUS_
{
RT2870_THREAD_UNKNOWN = 0,
RT2870_THREAD_INITED = 1,
RT2870_THREAD_RUNNING = 2,
RT2870_THREAD_STOPED = 4,
}RT2870_KERNEL_THREAD_STATUS;
#define RT2870_THREAD_CAN_DO_INSERT (RT2870_THREAD_INITED |RT2870_THREAD_RUNNING)
typedef struct _RT2870_TIMER_ENTRY_
{
RALINK_TIMER_STRUCT *pRaTimer;
struct _RT2870_TIMER_ENTRY_ *pNext;
}RT2870_TIMER_ENTRY;
#define TIMER_QUEUE_SIZE_MAX 128
typedef struct _RT2870_TIMER_QUEUE_
{
unsigned int status;
UCHAR *pTimerQPoll;
RT2870_TIMER_ENTRY *pQPollFreeList;
RT2870_TIMER_ENTRY *pQHead;
RT2870_TIMER_ENTRY *pQTail;
}RT2870_TIMER_QUEUE;
#endif // RT2870 //
//#define DBG 1
......@@ -352,6 +448,7 @@ extern ULONG RTDebugLevel;
spin_unlock_irqrestore((spinlock_t *)(__lock), ((unsigned long)__irqflag)); \
}
#ifdef RT2860
#if defined(INF_TWINPASS) || defined(INF_DANUBE) || defined(IKANOS_VX_1X0)
//Patch for ASIC turst read/write bug, needs to remove after metel fix
#define RTMP_IO_READ32(_A, _R, _pV) \
......@@ -453,7 +550,32 @@ extern ULONG RTDebugLevel;
writew((_V), (PUSHORT)((_A)->CSRBaseAddress + (_R))); \
}
#endif
#endif /* RT2860 */
#ifdef RT2870
//Patch for ASIC turst read/write bug, needs to remove after metel fix
#define RTMP_IO_READ32(_A, _R, _pV) \
RTUSBReadMACRegister(_A, _R, _pV)
#define RTMP_IO_READ8(_A, _R, _pV) \
{ \
}
#define RTMP_IO_WRITE32(_A, _R, _V) \
RTUSBWriteMACRegister(_A, _R, _V)
#define RTMP_IO_WRITE8(_A, _R, _V) \
{ \
USHORT _Val = _V; \
RTUSBSingleWrite(_A, _R, _Val); \
}
#define RTMP_IO_WRITE16(_A, _R, _V) \
{ \
RTUSBSingleWrite(_A, _R, _V); \
}
#endif // RT2870 //
#ifndef wait_event_interruptible_timeout
#define __wait_event_interruptible_timeout(wq, condition, ret) \
......@@ -496,7 +618,6 @@ do { \
wait_event_interruptible_timeout(_wait, 0, ONE_TICK); }
/* Modified by Wu Xi-Kun 4/21/2006 */
typedef void (*TIMER_FUNCTION)(unsigned long);
#define COPY_MAC_ADDR(Addr1, Addr2) memcpy((Addr1), (Addr2), MAC_ADDR_LEN)
......@@ -504,6 +625,7 @@ typedef void (*TIMER_FUNCTION)(unsigned long);
#define MlmeAllocateMemory(_pAd, _ppVA) os_alloc_mem(_pAd, _ppVA, MGMT_DMA_BUFFER_SIZE)
#define MlmeFreeMemory(_pAd, _pVA) os_free_mem(_pAd, _pVA)
#ifdef RT2860
#define BUILD_TIMER_FUNCTION(_func) \
void linux_##_func(unsigned long data) \
{ \
......@@ -513,7 +635,22 @@ void linux_##_func(unsigned long data) \
if (pTimer->Repeat) \
RTMP_OS_Add_Timer(&pTimer->TimerObj, pTimer->TimerValue); \
}
#endif
#ifdef RT2870
#define BUILD_TIMER_FUNCTION(_func) \
void linux_##_func(unsigned long data) \
{ \
PRALINK_TIMER_STRUCT _pTimer = (PRALINK_TIMER_STRUCT)data; \
RT2870_TIMER_ENTRY *_pQNode; \
RTMP_ADAPTER *_pAd; \
\
_pTimer->handle = _func; \
_pAd = (RTMP_ADAPTER *)_pTimer->pAd; \
_pQNode = RT2870_TimerQ_Insert(_pAd, _pTimer); \
if ((_pQNode == NULL) && (_pAd->TimerQ.status & RT2870_THREAD_CAN_DO_INSERT)) \
RTMP_OS_Add_Timer(&_pTimer->TimerObj, HZ); \
}
#endif // RT2870 //
#define DECLARE_TIMER_FUNCTION(_func) \
......@@ -527,6 +664,9 @@ DECLARE_TIMER_FUNCTION(MlmeRssiReportExec);
DECLARE_TIMER_FUNCTION(AsicRxAntEvalTimeout);
DECLARE_TIMER_FUNCTION(APSDPeriodicExec);
DECLARE_TIMER_FUNCTION(AsicRfTuningExec);
#ifdef RT2870
DECLARE_TIMER_FUNCTION(BeaconUpdateExec);
#endif // RT2870 //
DECLARE_TIMER_FUNCTION(BeaconTimeout);
DECLARE_TIMER_FUNCTION(ScanTimeout);
......@@ -849,6 +989,7 @@ int rt28xx_packet_xmit(struct sk_buff *skb);
void rtmp_os_thread_init(PUCHAR pThreadName, PVOID pNotify);
#ifdef RT2860
#if !defined(PCI_CAP_ID_EXP)
#define PCI_CAP_ID_EXP 0x10
#endif
......@@ -862,5 +1003,5 @@ void rtmp_os_thread_init(PUCHAR pThreadName, PVOID pNotify);
#endif
#define PCIBUS_INTEL_VENDOR 0x8086
#endif
......@@ -58,7 +58,9 @@ extern BOOLEAN ba_reordering_resource_init(PRTMP_ADAPTER pAd, int num);
extern void ba_reordering_resource_release(PRTMP_ADAPTER pAd);
extern NDIS_STATUS NICLoadRateSwitchingParams(IN PRTMP_ADAPTER pAd);
#ifdef RT2860
extern void init_thread_task(PRTMP_ADAPTER pAd);
#endif
// public function prototype
INT __devinit rt28xx_probe(IN void *_dev_p, IN void *_dev_id_p,
......@@ -187,6 +189,12 @@ int rt28xx_close(IN PNET_DEV dev)
RTMP_ADAPTER *pAd = net_dev->ml_priv;
BOOLEAN Cancelled = FALSE;
UINT32 i = 0;
#ifdef RT2870
DECLARE_WAIT_QUEUE_HEAD(unlink_wakeup);
DECLARE_WAITQUEUE(wait, current);
//RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_REMOVE_IN_PROGRESS);
#endif // RT2870 //
DBGPRINT(RT_DEBUG_TRACE, ("===> rt28xx_close\n"));
......@@ -198,11 +206,21 @@ int rt28xx_close(IN PNET_DEV dev)
{
// If dirver doesn't wake up firmware here,
// NICLoadFirmware will hang forever when interface is up again.
#ifdef RT2860
if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE) ||
RTMP_SET_PSFLAG(pAd, fRTMP_PS_SET_PCI_CLK_OFF_COMMAND) ||
RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_IDLE_RADIO_OFF))
#endif
#ifdef RT2870
if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE))
#endif
{
#ifdef RT2860
AsicForceWakeup(pAd, RTMP_HALT);
#endif
#ifdef RT2870
AsicForceWakeup(pAd, TRUE);
#endif
}
if (INFRA_ON(pAd) &&
......@@ -230,6 +248,9 @@ int rt28xx_close(IN PNET_DEV dev)
RTMPusecDelay(1000);
}
#ifdef RT2870
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_REMOVE_IN_PROGRESS);
#endif // RT2870 //
#ifdef CCX_SUPPORT
RTMPCancelTimer(&pAd->StaCfg.LeapAuthTimer, &Cancelled);
......@@ -239,7 +260,9 @@ int rt28xx_close(IN PNET_DEV dev)
RTMPCancelTimer(&pAd->StaCfg.WpaDisassocAndBlockAssocTimer, &Cancelled);
MlmeRadioOff(pAd);
#ifdef RT2860
pAd->bPCIclkOff = FALSE;
#endif
}
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS);
......@@ -253,6 +276,40 @@ int rt28xx_close(IN PNET_DEV dev)
}
}
#ifdef RT2870
// ensure there are no more active urbs.
add_wait_queue (&unlink_wakeup, &wait);
pAd->wait = &unlink_wakeup;
// maybe wait for deletions to finish.
i = 0;
//while((i < 25) && atomic_read(&pAd->PendingRx) > 0)
while(i < 25)
{
unsigned long IrqFlags;
RTMP_IRQ_LOCK(&pAd->BulkInLock, IrqFlags);
if (pAd->PendingRx == 0)
{
RTMP_IRQ_UNLOCK(&pAd->BulkInLock, IrqFlags);
break;
}
RTMP_IRQ_UNLOCK(&pAd->BulkInLock, IrqFlags);
msleep(UNLINK_TIMEOUT_MS); //Time in millisecond
i++;
}
pAd->wait = NULL;
remove_wait_queue (&unlink_wakeup, &wait);
#endif // RT2870 //
#ifdef RT2870
// We need clear timerQ related structure before exits of the timer thread.
RT2870_TimerQ_Exit(pAd);
// Close kernel threads or tasklets
RT28xxThreadTerminate(pAd);
#endif // RT2870 //
// Stop Mlme state machine
MlmeHalt(pAd);
......@@ -264,7 +321,7 @@ int rt28xx_close(IN PNET_DEV dev)
MeasureReqTabExit(pAd);
TpcReqTabExit(pAd);
#ifdef RT2860
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE))
{
NICDisableInterrupt(pAd);
......@@ -280,7 +337,7 @@ int rt28xx_close(IN PNET_DEV dev)
RT28XX_IRQ_RELEASE(net_dev)
RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_IN_USE);
}
#endif
// Free Ring or USB buffers
RTMPFreeTxRxRingMemory(pAd);
......@@ -297,7 +354,12 @@ int rt28xx_close(IN PNET_DEV dev)
static int rt28xx_init(IN struct net_device *net_dev)
{
#ifdef RT2860
PRTMP_ADAPTER pAd = (PRTMP_ADAPTER)net_dev->ml_priv;
#endif
#ifdef RT2870
PRTMP_ADAPTER pAd = net_dev->ml_priv;
#endif
UINT index;
UCHAR TmpPhy;
NDIS_STATUS Status;
......@@ -320,11 +382,11 @@ static int rt28xx_init(IN struct net_device *net_dev)
} while (index++ < 100);
DBGPRINT(RT_DEBUG_TRACE, ("MAC_CSR0 [ Ver:Rev=0x%08x]\n", pAd->MACVersion));
/*Iverson patch PCIE L1 issue */
// Disable DMA
RT28XXDMADisable(pAd);
// Load 8051 firmware
Status = NICLoadFirmware(pAd);
if (Status != NDIS_STATUS_SUCCESS)
......@@ -337,10 +399,12 @@ static int rt28xx_init(IN struct net_device *net_dev)
// Disable interrupts here which is as soon as possible
// This statement should never be true. We might consider to remove it later
#ifdef RT2860
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_INTERRUPT_ACTIVE))
{
NICDisableInterrupt(pAd);
}
#endif
Status = RTMPAllocTxRxRingMemory(pAd);
if (Status != NDIS_STATUS_SUCCESS)
......@@ -365,6 +429,10 @@ static int rt28xx_init(IN struct net_device *net_dev)
//
UserCfgInit(pAd);
#ifdef RT2870
// We need init timerQ related structure before create the timer thread.
RT2870_TimerQ_Init(pAd);
#endif // RT2870 //
RT28XX_TASK_THREAD_INIT(pAd, Status);
if (Status != NDIS_STATUS_SUCCESS)
......@@ -398,6 +466,14 @@ static int rt28xx_init(IN struct net_device *net_dev)
goto err4;
}
#ifdef RT2870
pAd->CommonCfg.bMultipleIRP = FALSE;
if (pAd->CommonCfg.bMultipleIRP)
pAd->CommonCfg.NumOfBulkInIRP = RX_RING_SIZE;
else
pAd->CommonCfg.NumOfBulkInIRP = 1;
#endif // RT2870 //
//Init Ba Capability parameters.
......@@ -436,6 +512,11 @@ static int rt28xx_init(IN struct net_device *net_dev)
pAd->CommonCfg.HtCapability.MCSSet[1], pAd->CommonCfg.HtCapability.MCSSet[2],
pAd->CommonCfg.HtCapability.MCSSet[3], pAd->CommonCfg.HtCapability.MCSSet[4]);
#ifdef RT2870
//Init RT30xx RFRegisters after read RFIC type from EEPROM
NICInitRT30xxRFRegisters(pAd);
#endif // RT2870 //
#ifdef IKANOS_VX_1X0
VR_IKANOS_FP_Init(pAd->ApCfg.BssidNum, pAd->PermanentAddress);
#endif // IKANOS_VX_1X0 //
......@@ -446,8 +527,10 @@ static int rt28xx_init(IN struct net_device *net_dev)
AsicSwitchChannel(pAd, pAd->CommonCfg.Channel, FALSE);
AsicLockChannel(pAd, pAd->CommonCfg.Channel);
#ifndef RT30xx
// 8051 firmware require the signal during booting time.
AsicSendCommandToMcu(pAd, 0x72, 0xFF, 0x00, 0x00);
#endif
if (pAd && (Status != NDIS_STATUS_SUCCESS))
{
......@@ -464,9 +547,24 @@ static int rt28xx_init(IN struct net_device *net_dev)
// Microsoft HCT require driver send a disconnect event after driver initialization.
OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_MEDIA_STATE_CONNECTED);
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_MEDIA_STATE_CHANGE);
DBGPRINT(RT_DEBUG_TRACE, ("NDIS_STATUS_MEDIA_DISCONNECT Event B!\n"));
#ifdef RT2870
RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_RESET_IN_PROGRESS);
RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_REMOVE_IN_PROGRESS);
//
// Support multiple BulkIn IRP,
// the value on pAd->CommonCfg.NumOfBulkInIRP may be large than 1.
//
for(index=0; index<pAd->CommonCfg.NumOfBulkInIRP; index++)
{
RTUSBBulkReceive(pAd);
DBGPRINT(RT_DEBUG_TRACE, ("RTUSBBulkReceive!\n" ));
}
#endif // RT2870 //
}// end of else
......@@ -565,8 +663,9 @@ int rt28xx_open(IN PNET_DEV dev)
printk("0x1300 = %08x\n", reg);
}
#ifdef RT2860
RTMPInitPCIeLinkCtrlValue(pAd);
#endif
return (retval);
err:
......@@ -662,8 +761,15 @@ INT __devinit rt28xx_probe(
PRTMP_ADAPTER pAd = (PRTMP_ADAPTER) NULL;
INT status;
PVOID handle;
#ifdef RT2860
struct pci_dev *dev_p = (struct pci_dev *)_dev_p;
#endif
#ifdef RT2870
struct usb_interface *intf = (struct usb_interface *)_dev_p;
struct usb_device *dev_p = interface_to_usbdev(intf);
dev_p = usb_get_dev(dev_p);
#endif // RT2870 //
DBGPRINT(RT_DEBUG_TRACE, ("STA Driver version-%s\n", STA_DRIVER_VERSION));
......
......@@ -886,11 +886,13 @@ NDIS_STATUS RTMPReadParametersHook(
// Save uid and gid used for filesystem access.
// Set user and group to 0 (root)
#ifndef RT30xx
orgfsuid = current_fsuid();
orgfsgid = current_fsgid();
/* Hm, can't really do this nicely anymore, so rely on these files
* being set to the proper permission to read them... */
/* current->cred->fsuid = current->cred->fsgid = 0; */
#endif
orgfs = get_fs();
set_fs(KERNEL_DS);
......@@ -1352,7 +1354,12 @@ NDIS_STATUS RTMPReadParametersHook(
{
//PSMode
#ifdef RT2860
if (RTMPGetKeyParameter("PSMode", tmpbuf, 32, buffer))
#endif
#ifdef RT2870
if (RTMPGetKeyParameter("PSMode", tmpbuf, 10, buffer))
#endif
{
if (pAd->StaCfg.BssType == BSS_INFRA)
{
......@@ -1435,6 +1442,23 @@ NDIS_STATUS RTMPReadParametersHook(
DBGPRINT(RT_DEBUG_TRACE, ("TGnWifiTest=%d\n", pAd->StaCfg.bTGnWifiTest));
}
}
#ifdef RT30xx
{
if(RTMPGetKeyParameter("AntDiversity", tmpbuf, 10, buffer))
{
for (i = 0, macptr = rstrtok(tmpbuf,";"); macptr; macptr = rstrtok(NULL,";"), i++)
{
if(simple_strtol(macptr, 0, 10) != 0) //Enable
pAd->CommonCfg.bRxAntDiversity = TRUE;
else //Disable
pAd->CommonCfg.bRxAntDiversity = FALSE;
DBGPRINT(RT_DEBUG_ERROR, ("AntDiversity=%d\n", pAd->CommonCfg.bRxAntDiversity));
}
}
}
#endif // RT30xx //
}
}
else
......@@ -1547,12 +1571,21 @@ static void HTParametersHook(
if (Value == 0)
{
pAd->CommonCfg.BACapability.field.AutoBA = FALSE;
#ifdef RT30xx
pAd->CommonCfg.BACapability.field.Policy = BA_NOTUSE;
#endif
}
else
{
pAd->CommonCfg.BACapability.field.AutoBA = TRUE;
#ifdef RT30xx
pAd->CommonCfg.BACapability.field.Policy = IMMED_BA;
#endif
}
pAd->CommonCfg.REGBACapability.field.AutoBA = pAd->CommonCfg.BACapability.field.AutoBA;
#ifdef RT30xx
pAd->CommonCfg.REGBACapability.field.Policy = pAd->CommonCfg.BACapability.field.Policy;
#endif
DBGPRINT(RT_DEBUG_TRACE, ("HT: Auto BA = %s\n", (Value==0) ? "Disable" : "Enable"));
}
......
This diff is collapsed.
......@@ -102,6 +102,7 @@
// Entry number for each DMA descriptor ring
//
#ifdef RT2860
#define TX_RING_SIZE 64 //64
#define MGMT_RING_SIZE 128
#define RX_RING_SIZE 128 //64
......@@ -109,6 +110,15 @@
#define MAX_DMA_DONE_PROCESS TX_RING_SIZE
#define MAX_TX_DONE_PROCESS TX_RING_SIZE //8
#define LOCAL_TXBUF_SIZE 2
#endif
#ifdef RT2870
#define TX_RING_SIZE 8 // 1
#define PRIO_RING_SIZE 8
#define MGMT_RING_SIZE 32 // PRIO_RING_SIZE
#define RX_RING_SIZE 8
#define MAX_TX_PROCESS 4
#define LOCAL_TXBUF_SIZE 2048
#endif // RT2870 //
#define MAX_RX_PROCESS 128 //64 //32
#define NUM_OF_LOCAL_TXBUF 2
......@@ -138,7 +148,11 @@
#define MAX_PACKETS_IN_PS_QUEUE 128 //32
#define WMM_NUM_OF_AC 4 /* AC0, AC1, AC2, and AC3 */
#ifdef RT30xx
//2008/09/11:KH add to support efuse<--
#define MAX_EEPROM_BIN_FILE_SIZE 1024
//2008/09/11:KH add to support efuse-->
#endif
// RxFilter
#define STANORMAL 0x17f97
......@@ -195,6 +209,7 @@
#define fOP_STATUS_WAKEUP_NOW 0x00008000
#define fOP_STATUS_ADVANCE_POWER_SAVE_PCIE_DEVICE 0x00020000
#ifdef RT2860
//
// RTMP_ADAPTER PSFlags : related to advanced power save.
//
......@@ -207,6 +222,7 @@
// Indicate driver should IMMEDIATELY fo to sleep after receiving AP's beacon in which doesn't indicate unicate nor multicast packets for me
//. This flag is used ONLY in RTMPHandleRxDoneInterrupt routine.
#define fRTMP_PS_GO_TO_SLEEP_NOW 0x00000008
#endif
#define CCKSETPROTECT 0x1
#define OFDMSETPROTECT 0x2
......@@ -309,10 +325,12 @@
#define MAX_APCLI_NUM 0
#define MAX_MBSSID_NUM 1
#if defined(RT2860) || defined(RT30xx)
#ifdef MBSS_SUPPORT
#undef MAX_MBSSID_NUM
#define MAX_MBSSID_NUM (8 - MAX_MESH_NUM - MAX_APCLI_NUM)
#endif // MBSS_SUPPORT //
#endif
/* sanity check for apidx */
#define MBSS_MR_APIDX_SANITY_CHECK(apidx) \
......@@ -555,6 +573,9 @@
// For 802.11n D3.03
//#define IE_NEW_EXT_CHA_OFFSET 62 // 802.11n d1. New extension channel offset elemet
#define IE_SECONDARY_CH_OFFSET 62 // 802.11n D3.03 Secondary Channel Offset element
#ifdef RT2870
#define IE_WAPI 68 // WAPI information element
#endif
#define IE_2040_BSS_COEXIST 72 // 802.11n D3.0.3
#define IE_2040_BSS_INTOLERANT_REPORT 73 // 802.11n D3.03
#define IE_OVERLAPBSS_SCAN_PARM 74 // 802.11n D3.03
......@@ -603,6 +624,11 @@
#define AP_CNTL_STATE_MACHINE 15
#define AP_WPA_STATE_MACHINE 16
#ifdef RT30xx
#define WSC_STATE_MACHINE 17
#define WSC_UPNP_STATE_MACHINE 18
#endif
//
// STA's CONTROL/CONNECT state machine: states, events, total function #
//
......@@ -616,6 +642,9 @@
#define CNTL_WAIT_AUTH2 7
#define CNTL_WAIT_OID_LIST_SCAN 8
#define CNTL_WAIT_OID_DISASSOC 9
#ifdef RT2870
#define CNTL_WAIT_SCAN_FOR_CONNECT 10
#endif // RT2870 //
#define MT2_ASSOC_CONF 34
#define MT2_AUTH_CONF 35
......@@ -1186,6 +1215,10 @@
#define RFIC_2750 4 // 2.4G/5G 1T2R
#define RFIC_3020 5 // 2.4G 1T1R
#define RFIC_2020 6 // 2.4G B/G
#ifdef RT30xx
#define RFIC_3021 7 // 2.4G 1T2R
#define RFIC_3022 8 // 2.4G 2T2R
#endif
// LED Status.
#define LED_LINK_DOWN 0
......@@ -1286,6 +1319,8 @@
#define INT_APCLI 0x0400
#define INT_MESH 0x0500
// Use bitmap to allow coexist of ATE_TXFRAME and ATE_RXFRAME(i.e.,to support LoopBack mode)
// WEP Key TYPE
#define WEP_HEXADECIMAL_TYPE 0
#define WEP_ASCII_TYPE 1
......@@ -1378,6 +1413,7 @@
#define MCAST_HTMIX 3
#endif // MCAST_RATE_SPECIFIC //
#ifdef RT2860
// For AsicRadioOff/AsicRadioOn/AsicForceWakeup function
// This is to indicate from where to call this function.
#define DOT11POWERSAVE 0 // TO do .11 power save sleep
......@@ -1385,8 +1421,14 @@
#define RTMP_HALT 2 // Called from Halt handler.
#define GUI_IDLE_POWER_SAVE 3 // Call to sleep before link up with AP
#define FROM_TX 4 // Force wake up from Tx packet.
#endif
#ifdef RT2870
// For AsicRadioOff/AsicRadioOn function
#define DOT11POWERSAVE 0
#define GUIRADIO_OFF 1
#define RTMP_HALT 2
#define GUI_IDLE_POWER_SAVE 3
#endif
// definition for WpaSupport flag
#define WPA_SUPPLICANT_DISABLE 0
......
This diff is collapsed.
......@@ -90,7 +90,9 @@
#define TKIP_AP_RXMICK_OFFSET (TKIP_AP_TXMICK_OFFSET+LEN_TKIP_TXMICK)
#define TKIP_GTK_LENGTH ((LEN_TKIP_EK)+(LEN_TKIP_RXMICK)+(LEN_TKIP_TXMICK))
#define LEN_PTK ((LEN_EAP_KEY)+(LEN_TKIP_KEY))
#ifndef RT30xx
#define MIN_LEN_OF_GTK 5
#endif
// RSN IE Length definition
#define MAX_LEN_OF_RSNIE 90
......
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