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

Staging: rt28x0: updates from vendor's V2.1.0.0 drivers

Port changes from:

* 2009_0420_RT2860_Linux_STA_V2.1.0.0
* 2009_0302_RT2870_Linux_STA_v2.1.0.0
* 2009_0525_RT3070_Linux_STA_v2.1.1.0

to in-kernel drivers.


From the RT2860 driver release note:

[2.1.0.0]
1. New generation schema for multiple OS porting
2. Fixed Ad-hoc ping failed in noisy environment. (Probe Response has too
    many retry packet then cause "not enough space in MgmtRing")
3. Fixed WPA(2)PSK issue when group cipher of AP is WEP40 or WEP104.
4. Modified iwpriv ra0 get_site_survey:
	In scan list result: Security shows "NONE" when AP is OPEN/NONE,
	shows "WEP" when AP is OPEN/WEP or SHARED/WEP, shows
	"WPAPSK(WPA2PSK)/TKIP(AES)" when AP is WPAPSK(WPA2PSK)/TKIP(AES)
	shows "WPA(WPA2)/TKIP(AES)" when AP is WPA(WPA2)/TKIP(AES)
5. Support kthread.
6. Add New A band channel list region 15 contains the whole channels in
   the A band region 4 and the new CE channel 167,169,171,173
7. Add New IEEE802.11r functionality.
8. Fixed WPA2-Enterprise failed when AP reboot or turn off then turn on.
9. Fixed STA cannot connect to 11B only AP when the setting of is PHY_11GN.


From the RT2870 driver release note:

[V2.1.0.0]
1. New generation schema for multiple OS porting.
2. Fixed Ad-hoc ping failed in noisy environment. (Probe Response has too
   many retry packet then cause "not enough space in MgmtRing").
3. Fixed WPS failed with D-Link DIR-628 in 5GHz.
4. Change FastRoaming in DAT file to AutoRoaming.
5. Support kthread.
6. Add New A band channel list region 15 contains the whole channels in
   the A band region and the new CE channel 167,169,171,173.
7. New IEEE802.11r functionality.


From the RT3070 driver release note:

Version V2.1.1.0
       1. Linux kernel 2.6.29 support.
       2. Fix eFuse write from BIN file bug.

Version 2.1.0.0
       1. New generation schema for multiple OS porting
       2. Fixed Ad-hoc ping failed in noisy environment.
       3. Modified iwpriv ra0 get_site_survey:
       4. Change FastRoaming in DAT file to AutoRoaming.
       5. Support kthread.
       6. New IEEE802.11r functionality.


Tested with RT2860 and RT3070 chipsets.
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 3441d25f
......@@ -2,26 +2,33 @@ 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 += -DRTMP_MAC_PCI -DRTMP_PCI_SUPPORT -DRT2860
EXTRA_CFLAGS += -DDBG
rt2860sta-objs := \
common/md5.o \
common/crypt_md5.o \
common/crypt_sha2.o \
common/crypt_hmac.o \
common/mlme.o \
common/rtmp_wep.o \
common/cmm_wep.o \
common/action.o \
common/cmm_data.o \
common/rtmp_init.o \
common/rtmp_tkip.o \
common/cmm_tkip.o \
common/cmm_aes.o \
common/cmm_sync.o \
common/eeprom.o \
common/cmm_sanity.o \
common/cmm_info.o \
common/cmm_cfg.o \
common/cmm_wpa.o \
common/dfs.o \
common/spectrum.o \
common/rtmp_timer.o \
common/rt_channel.o \
common/cmm_profile.o \
common/cmm_asic.o \
sta/assoc.o \
sta/aironet.o \
sta/auth.o \
sta/auth_rsp.o \
sta/sync.o \
......@@ -34,6 +41,9 @@ rt2860sta-objs := \
rt_main_dev.o \
sta_ioctl.o \
common/ba_action.o \
common/2860_rtmp_init.o \
2860_main_dev.o \
common/cmm_data_2860.o
pci_main_dev.o \
rt_pci_rbus.o \
common/cmm_mac_pci.o \
common/cmm_data_pci.o \
common/ee_prom.o \
common/rtmp_mcu.o
/*
*************************************************************************
* Ralink Tech Inc.
* 5F., No.36, Taiyuan St., Jhubei City,
* Hsinchu County 302,
* Taiwan, R.O.C.
*
* (c) Copyright 2002-2007, Ralink Technology, Inc.
*
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
*************************************************************************
Module Name:
aironet.h
Abstract:
Revision History:
Who When What
-------- ---------- ----------------------------------------------
Name Date Modification logs
Paul Lin 04-06-15 Initial
*/
#ifndef __AIRONET_H__
#define __AIRONET_H__
// Measurement Type definition
#define MSRN_TYPE_UNUSED 0
#define MSRN_TYPE_CHANNEL_LOAD_REQ 1
#define MSRN_TYPE_NOISE_HIST_REQ 2
#define MSRN_TYPE_BEACON_REQ 3
#define MSRN_TYPE_FRAME_REQ 4
// Scan Mode in Beacon Request
#define MSRN_SCAN_MODE_PASSIVE 0
#define MSRN_SCAN_MODE_ACTIVE 1
#define MSRN_SCAN_MODE_BEACON_TABLE 2
// PHY type definition for Aironet beacon report, CCX 2 table 36-9
#define PHY_FH 1
#define PHY_DSS 2
#define PHY_UNUSED 3
#define PHY_OFDM 4
#define PHY_HR_DSS 5
#define PHY_ERP 6
// RPI table in dBm
#define RPI_0 0 // Power <= -87
#define RPI_1 1 // -87 < Power <= -82
#define RPI_2 2 // -82 < Power <= -77
#define RPI_3 3 // -77 < Power <= -72
#define RPI_4 4 // -72 < Power <= -67
#define RPI_5 5 // -67 < Power <= -62
#define RPI_6 6 // -62 < Power <= -57
#define RPI_7 7 // -57 < Power
// Cisco Aironet IAPP definetions
#define AIRONET_IAPP_TYPE 0x32
#define AIRONET_IAPP_SUBTYPE_REQUEST 0x01
#define AIRONET_IAPP_SUBTYPE_REPORT 0x81
// Measurement Request detail format
typedef struct _MEASUREMENT_REQUEST {
UCHAR Channel;
UCHAR ScanMode; // Use only in beacon request, other requests did not use this field
USHORT Duration;
} MEASUREMENT_REQUEST, *PMEASUREMENT_REQUEST;
// Beacon Measurement Report
// All these field might change to UCHAR, because we didn't do anything to these report.
// We copy all these beacons and report to CCX 2 AP.
typedef struct _BEACON_REPORT {
UCHAR Channel;
UCHAR Spare;
USHORT Duration;
UCHAR PhyType; // Definiation is listed above table 36-9
UCHAR RxPower;
UCHAR BSSID[6];
UCHAR ParentTSF[4];
UCHAR TargetTSF[8];
USHORT BeaconInterval;
USHORT CapabilityInfo;
} BEACON_REPORT, *PBEACON_REPORT;
// Frame Measurement Report (Optional)
typedef struct _FRAME_REPORT {
UCHAR Channel;
UCHAR Spare;
USHORT Duration;
UCHAR TA;
UCHAR BSSID[6];
UCHAR RSSI;
UCHAR Count;
} FRAME_REPORT, *PFRAME_REPORT;
#pragma pack(1)
// Channel Load Report
typedef struct _CHANNEL_LOAD_REPORT {
UCHAR Channel;
UCHAR Spare;
USHORT Duration;
UCHAR CCABusy;
} CHANNEL_LOAD_REPORT, *PCHANNEL_LOAD_REPORT;
#pragma pack()
// Nosie Histogram Report
typedef struct _NOISE_HIST_REPORT {
UCHAR Channel;
UCHAR Spare;
USHORT Duration;
UCHAR Density[8];
} NOISE_HIST_REPORT, *PNOISE_HIST_REPORT;
// Radio Management Capability element
typedef struct _RADIO_MANAGEMENT_CAPABILITY {
UCHAR Eid; // TODO: Why the Eid is 1 byte, not normal 2 bytes???
UCHAR Length;
UCHAR AironetOui[3]; // AIronet OUI (00 40 96)
UCHAR Type; // Type / Version
USHORT Status; // swap16 required
} RADIO_MANAGEMENT_CAPABILITY, *PRADIO_MANAGEMENT_CAPABILITY;
// Measurement Mode Bit definition
typedef struct _MEASUREMENT_MODE {
UCHAR Rsvd:4;
UCHAR Report:1;
UCHAR NotUsed:1;
UCHAR Enable:1;
UCHAR Parallel:1;
} MEASUREMENT_MODE, *PMEASUREMENT_MODE;
// Measurement Request element, This is little endian mode
typedef struct _MEASUREMENT_REQUEST_ELEMENT {
USHORT Eid;
USHORT Length; // swap16 required
USHORT Token; // non-zero unique token
UCHAR Mode; // Measurement Mode
UCHAR Type; // Measurement type
} MEASUREMENT_REQUEST_ELEMENT, *PMEASUREMENT_REQUEST_ELEMENT;
// Measurement Report element, This is little endian mode
typedef struct _MEASUREMENT_REPORT_ELEMENT {
USHORT Eid;
USHORT Length; // swap16 required
USHORT Token; // non-zero unique token
UCHAR Mode; // Measurement Mode
UCHAR Type; // Measurement type
} MEASUREMENT_REPORT_ELEMENT, *PMEASUREMENT_REPORT_ELEMENT;
// Cisco Aironet IAPP Frame Header, Network byte order used
typedef struct _AIRONET_IAPP_HEADER {
UCHAR CiscoSnapHeader[8]; // 8 bytes Cisco snap header
USHORT Length; // IAPP ID & length, remember to swap16 in LE system
UCHAR Type; // IAPP type
UCHAR SubType; // IAPP subtype
UCHAR DA[6]; // Destination MAC address
UCHAR SA[6]; // Source MAC address
USHORT Token; // Dialog token, no need to swap16 since it is for yoken usage only
} AIRONET_IAPP_HEADER, *PAIRONET_IAPP_HEADER;
// Radio Measurement Request frame
typedef struct _AIRONET_RM_REQUEST_FRAME {
AIRONET_IAPP_HEADER IAPP; // Common header
UCHAR Delay; // Activation Delay
UCHAR Offset; // Measurement offset
} AIRONET_RM_REQUEST_FRAME, *PAIRONET_RM_REQUEST_FRAME;
// Radio Measurement Report frame
typedef struct _AIRONET_RM_REPORT_FRAME {
AIRONET_IAPP_HEADER IAPP; // Common header
} AIRONET_RM_REPORT_FRAME, *PAIRONET_RM_REPORT_FRAME;
// Saved element request actions which will saved in StaCfg.
typedef struct _RM_REQUEST_ACTION {
MEASUREMENT_REQUEST_ELEMENT ReqElem; // Saved request element
MEASUREMENT_REQUEST Measurement; // Saved measurement within the request element
} RM_REQUEST_ACTION, *PRM_REQUEST_ACTION;
// CCX administration control
typedef union _CCX_CONTROL {
struct {
UINT32 Enable:1; // Enable CCX2
UINT32 LeapEnable:1; // Enable LEAP at CCX2
UINT32 RMEnable:1; // Radio Measurement Enable
UINT32 DCRMEnable:1; // Non serving channel Radio Measurement enable
UINT32 QOSEnable:1; // Enable QOS for CCX 2.0 support
UINT32 FastRoamEnable:1; // Enable fast roaming
UINT32 Rsvd:2; // Not used
UINT32 dBmToRoam:8; // the condition to roam when receiving Rssi less than this value. It's negative value.
UINT32 TuLimit:16; // Limit for different channel scan
} field;
UINT32 word;
} CCX_CONTROL, *PCCX_CONTROL;
#endif // __AIRONET_H__
......@@ -40,22 +40,24 @@
#ifndef __AP_H__
#define __AP_H__
// ap_mlme.c
// ap_wpa.c
VOID WpaStateMachineInit(
IN PRTMP_ADAPTER pAd,
IN STATE_MACHINE *Sm,
OUT STATE_MACHINE_FUNC Trans[]);
#ifdef RT2870
#ifdef RTMP_MAC_USB
VOID BeaconUpdateExec(
IN PVOID SystemSpecific1,
IN PVOID FunctionContext,
IN PVOID SystemSpecific2,
IN PVOID SystemSpecific3);
#endif // RT2870 //
#endif // RTMP_MAC_USB //
VOID RTMPSetPiggyBack(
IN PRTMP_ADAPTER pAd,
IN BOOLEAN bPiggyBack);
// ap.c
VOID MacTableReset(
IN PRTMP_ADAPTER pAd);
......
This diff is collapsed.
/*
*************************************************************************
* Ralink Tech Inc.
* 5F., No.36, Taiyuan St., Jhubei City,
* Hsinchu County 302,
* Taiwan, R.O.C.
*
* (c) Copyright 2002-2007, Ralink Technology, Inc.
*
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
*************************************************************************
*/
#ifndef __RT2860_H__
#define __RT2860_H__
#include "mac_pci.h"
#ifndef RTMP_PCI_SUPPORT
#error "For RT2860, you should define the compile flag -DRTMP_PCI_SUPPORT"
#endif
#ifndef RTMP_MAC_PCI
#error "For RT2880, you should define the compile flag -DRTMP_MAC_PCI"
#endif
//
// Device ID & Vendor ID, these values should match EEPROM value
//
#define NIC2860_PCI_DEVICE_ID 0x0601
#define NIC2860_PCIe_DEVICE_ID 0x0681
#define NIC2760_PCI_DEVICE_ID 0x0701 // 1T/2R Cardbus ???
#define NIC2790_PCIe_DEVICE_ID 0x0781 // 1T/2R miniCard
#define VEN_AWT_PCIe_DEVICE_ID 0x1059
#define VEN_AWT_PCI_VENDOR_ID 0x1A3B
#define EDIMAX_PCI_VENDOR_ID 0x1432
#endif //__RT2860_H__ //
/*
*************************************************************************
* Ralink Tech Inc.
* 5F., No.36, Taiyuan St., Jhubei City,
* Hsinchu County 302,
* Taiwan, R.O.C.
*
* (c) Copyright 2002-2007, Ralink Technology, Inc.
*
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
*************************************************************************
*/
#ifndef __RT2870_H__
#define __RT2870_H__
#ifdef RT2870
#ifndef RTMP_USB_SUPPORT
#error "For RT2870, you should define the compile flag -DRTMP_USB_SUPPORT"
#endif
#ifndef RTMP_MAC_USB
#error "For RT2870, you should define the compile flag -DRTMP_MAC_USB"
#endif
#include "../rtmp_type.h"
#include "mac_usb.h"
//#define RTMP_CHIP_NAME "RT2870"
#endif // RT2870 //
#endif //__RT2870_H__ //
/*
*************************************************************************
* Ralink Tech Inc.
* 5F., No.36, Taiyuan St., Jhubei City,
* Hsinchu County 302,
* Taiwan, R.O.C.
*
* (c) Copyright 2002-2007, Ralink Technology, Inc.
*
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
*************************************************************************
Module Name:
rt3070.h
Abstract:
Revision History:
Who When What
--------- ---------- ----------------------------------------------
*/
#ifndef __RT3070_H__
#define __RT3070_H__
#ifdef RT3070
#ifndef RTMP_USB_SUPPORT
#error "For RT3070, you should define the compile flag -DRTMP_USB_SUPPORT"
#endif
#ifndef RTMP_MAC_USB
#error "For RT3070, you should define the compile flag -DRTMP_MAC_USB"
#endif
#ifndef RTMP_RF_RW_SUPPORT
#error "For RT3070, you should define the compile flag -DRTMP_RF_RW_SUPPORT"
#endif
#ifndef RT30xx
#error "For RT3070, you should define the compile flag -DRT30xx"
#endif
#include "mac_usb.h"
#include "rt30xx.h"
//
// Device ID & Vendor ID, these values should match EEPROM value
//
#endif // RT3070 //
#endif //__RT3070_H__ //
/*
*************************************************************************
* Ralink Tech Inc.
* 5F., No.36, Taiyuan St., Jhubei City,
* Hsinchu County 302,
* Taiwan, R.O.C.
*
* (c) Copyright 2002-2007, Ralink Technology, Inc.
*
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
*************************************************************************
Module Name:
rt30xx.h
Abstract:
Revision History:
Who When What
--------- ---------- ----------------------------------------------
*/
#ifndef __RT30XX_H__
#define __RT30XX_H__
#ifdef RT30xx
extern REG_PAIR RT30xx_RFRegTable[];
extern UCHAR NUM_RF_REG_PARMS;
#endif // RT30xx //
#endif //__RT30XX_H__ //
This diff is collapsed.
/*
*************************************************************************
* Ralink Tech Inc.
* 5F., No.36, Taiyuan St., Jhubei City,
* Hsinchu County 302,
* Taiwan, R.O.C.
*
* (c) Copyright 2002-2007, Ralink Technology, Inc.
*
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
*************************************************************************
Module Name:
rt3070.c
Abstract:
Specific funcitons and variables for RT3070
Revision History:
Who When What
-------- ---------- ----------------------------------------------
*/
#ifdef RT3070
#include "../rt_config.h"
#ifndef RTMP_RF_RW_SUPPORT
#error "You Should Enable compile flag RTMP_RF_RW_SUPPORT for this chip"
#endif // RTMP_RF_RW_SUPPORT //
VOID NICInitRT3070RFRegisters(IN PRTMP_ADAPTER pAd)
{
INT i;
UCHAR RFValue;
// Driver must read EEPROM to get RfIcType before initial RF registers
// Initialize RF register to default value
if (IS_RT3070(pAd) || IS_RT3071(pAd))
{
// Init RF calibration
// Driver should toggle RF R30 bit7 before init RF registers
UINT32 RfReg = 0;
UINT32 data;
RT30xxReadRFRegister(pAd, RF_R30, (PUCHAR)&RfReg);
RfReg |= 0x80;
RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg);
RTMPusecDelay(1000);
RfReg &= 0x7F;
RT30xxWriteRFRegister(pAd, RF_R30, (UCHAR)RfReg);
// Initialize RF register to default value
for (i = 0; i < NUM_RF_REG_PARMS; i++)
{
RT30xxWriteRFRegister(pAd, RT30xx_RFRegTable[i].Register, RT30xx_RFRegTable[i].Value);
}
// add by johnli
if (IS_RT3070(pAd))
{
//
// The DAC issue(LDO_CFG0) has been fixed in RT3070(F).
// The voltage raising patch is no longer needed for RT3070(F)
//
if ((pAd->MACVersion & 0xffff) < 0x0201)
{
// Update MAC 0x05D4 from 01xxxxxx to 0Dxxxxxx (voltage 1.2V to 1.35V) for RT3070 to improve yield rate
RTUSBReadMACRegister(pAd, LDO_CFG0, &data);
data = ((data & 0xF0FFFFFF) | 0x0D000000);
RTUSBWriteMACRegister(pAd, LDO_CFG0, data);
}
}
else if (IS_RT3071(pAd))
{
// Driver should set RF R6 bit6 on before init RF registers
RT30xxReadRFRegister(pAd, RF_R06, (PUCHAR)&RfReg);
RfReg |= 0x40;
RT30xxWriteRFRegister(pAd, RF_R06, (UCHAR)RfReg);
// init R31
RT30xxWriteRFRegister(pAd, RF_R31, 0x14);
// RT3071 version E has fixed this issue
if ((pAd->NicConfig2.field.DACTestBit == 1) && ((pAd->MACVersion & 0xffff) < 0x0211))
{
// patch tx EVM issue temporarily
RTUSBReadMACRegister(pAd, LDO_CFG0, &data);
data = ((data & 0xE0FFFFFF) | 0x0D000000);
RTUSBWriteMACRegister(pAd, LDO_CFG0, data);
}
else
{
RTMP_IO_READ32(pAd, LDO_CFG0, &data);
data = ((data & 0xE0FFFFFF) | 0x01000000);
RTMP_IO_WRITE32(pAd, LDO_CFG0, data);
}
// patch LNA_PE_G1 failed issue
RTUSBReadMACRegister(pAd, GPIO_SWITCH, &data);
data &= ~(0x20);
RTUSBWriteMACRegister(pAd, GPIO_SWITCH, data);
}
//For RF filter Calibration
RTMPFilterCalibration(pAd);
// Initialize RF R27 register, set RF R27 must be behind RTMPFilterCalibration()
//
// TX to RX IQ glitch(RF_R27) has been fixed in RT3070(F).
// Raising RF voltage is no longer needed for RT3070(F)
//
if ((IS_RT3070(pAd)) && ((pAd->MACVersion & 0xffff) < 0x0201))
{
RT30xxWriteRFRegister(pAd, RF_R27, 0x3);
}
else if ((IS_RT3071(pAd)) && ((pAd->MACVersion & 0xffff) < 0x0211))
{
RT30xxWriteRFRegister(pAd, RF_R27, 0x3);
}
// set led open drain enable
RTUSBReadMACRegister(pAd, OPT_14, &data);
data |= 0x01;
RTUSBWriteMACRegister(pAd, OPT_14, data);
// move from RT30xxLoadRFNormalModeSetup because it's needed for both RT3070 and RT3071
// TX_LO1_en, RF R17 register Bit 3 to 0
RT30xxReadRFRegister(pAd, RF_R17, &RFValue);
RFValue &= (~0x08);
// to fix rx long range issue
if (pAd->NicConfig2.field.ExternalLNAForG == 0)
{
if ((IS_RT3071(pAd) && ((pAd->MACVersion & 0xffff) >= 0x0211)) || IS_RT3070(pAd))
{
RFValue |= 0x20;
}
}
// set RF_R17_bit[2:0] equal to EEPROM setting at 0x48h
if (pAd->TxMixerGain24G >= 1)
{
RFValue &= (~0x7); // clean bit [2:0]
RFValue |= pAd->TxMixerGain24G;
}
RT30xxWriteRFRegister(pAd, RF_R17, RFValue);
if (IS_RT3071(pAd))
{
// add by johnli, RF power sequence setup, load RF normal operation-mode setup
RT30xxLoadRFNormalModeSetup(pAd);
}
else if (IS_RT3070(pAd))
{
/* add by johnli, reset RF_R27 when interface down & up to fix throughput problem*/
// LDORF_VC, RF R27 register Bit 2 to 0
RT30xxReadRFRegister(pAd, RF_R27, &RFValue);
// TX to RX IQ glitch(RF_R27) has been fixed in RT3070(F).
// Raising RF voltage is no longer needed for RT3070(F)
if ((pAd->MACVersion & 0xffff) < 0x0201)
RFValue = (RFValue & (~0x77)) | 0x3;
else
RFValue = (RFValue & (~0x77));
RT30xxWriteRFRegister(pAd, RF_R27, RFValue);
/* end johnli */
}
}
}
#endif // RT3070 //
This diff is collapsed.
This diff is collapsed.
......@@ -150,7 +150,9 @@ VOID MlmeADDBAAction(
MakeOutgoingFrame(pOutBuffer, &FrameLen,
sizeof(FRAME_ADDBA_REQ), &Frame,
END_OF_ARGS);
MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen);
MiniportMMRequest(pAd, (MGMT_USE_QUEUE_FLAG | MapUserPriorityToAccessCategory[pInfo->TID]), pOutBuffer, FrameLen);
MlmeFreeMemory(pAd, pOutBuffer);
DBGPRINT(RT_DEBUG_TRACE, ("BA - Send ADDBA request. StartSeq = %x, FrameLen = %ld. BufSize = %d\n", Frame.BaStartSeq.field.StartSeq, FrameLen, Frame.BaParm.BufSize));
......@@ -527,9 +529,13 @@ VOID SendRefreshBAR(
MakeOutgoingFrame(pOutBuffer, &FrameLen,
sizeof(FRAME_BAR), &FrameBar,
END_OF_ARGS);
//if (!(CLIENT_STATUS_TEST_FLAG(pEntry, fCLIENT_STATUS_RALINK_CHIPSET)))
if (1) // Now we always send BAR.
{
//MiniportMMRequestUnlock(pAd, 0, pOutBuffer, FrameLen);
MiniportMMRequest(pAd, (MGMT_USE_QUEUE_FLAG | MapUserPriorityToAccessCategory[TID]), pOutBuffer, FrameLen);
MiniportMMRequest(pAd, QID_AC_BE, pOutBuffer, FrameLen);
}
MlmeFreeMemory(pAd, pOutBuffer);
}
}
......
This diff is collapsed.
This diff is collapsed.
/*
*************************************************************************
* Ralink Tech Inc.
* 5F., No.36, Taiyuan St., Jhubei City,
* Hsinchu County 302,
* Taiwan, R.O.C.
*
* (c) Copyright 2002-2007, Ralink Technology, Inc.
*
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
*************************************************************************
Module Name:
cmm_cfg.c
Abstract:
Ralink WiFi Driver configuration related subroutines
Revision History:
Who When What
--------- ---------- ----------------------------------------------
*/
#include "../rt_config.h"
char* GetPhyMode(
int Mode)
{
switch(Mode)
{
case MODE_CCK:
return "CCK";
case MODE_OFDM:
return "OFDM";
case MODE_HTMIX:
return "HTMIX";
case MODE_HTGREENFIELD:
return "GREEN";
default:
return "N/A";
}
}
char* GetBW(
int BW)
{
switch(BW)
{
case BW_10:
return "10M";
case BW_20:
return "20M";
case BW_40:
return "40M";
default:
return "N/A";
}
}
/*
==========================================================================
Description:
Set Country Region to pAd->CommonCfg.CountryRegion.
This command will not work, if the field of CountryRegion in eeprom is programmed.
Return:
TRUE if all parameters are OK, FALSE otherwise
==========================================================================
*/
INT RT_CfgSetCountryRegion(
IN PRTMP_ADAPTER pAd,
IN PSTRING arg,
IN INT band)
{
LONG region, regionMax;
UCHAR *pCountryRegion;
region = simple_strtol(arg, 0, 10);
if (band == BAND_24G)
{
pCountryRegion = &pAd->CommonCfg.CountryRegion;
regionMax = REGION_MAXIMUM_BG_BAND;
}
else
{
pCountryRegion = &pAd->CommonCfg.CountryRegionForABand;
regionMax = REGION_MAXIMUM_A_BAND;
}
// TODO: Is it neccesay for following check???
// Country can be set only when EEPROM not programmed
if (*pCountryRegion & 0x80)
{
DBGPRINT(RT_DEBUG_ERROR, ("CfgSetCountryRegion():CountryRegion in eeprom was programmed\n"));
return FALSE;
}
if((region >= 0) && (region <= REGION_MAXIMUM_BG_BAND))
{
*pCountryRegion= (UCHAR) region;
}
else if ((region == REGION_31_BG_BAND) && (band == BAND_24G))
{
*pCountryRegion = (UCHAR) region;
}
else
{
DBGPRINT(RT_DEBUG_ERROR, ("CfgSetCountryRegion():region(%ld) out of range!\n", region));
return FALSE;
}
return TRUE;
}
/*
==========================================================================
Description:
Set Wireless Mode
Return:
TRUE if all parameters are OK, FALSE otherwise
==========================================================================
*/
INT RT_CfgSetWirelessMode(
IN PRTMP_ADAPTER pAd,
IN PSTRING arg)
{
INT MaxPhyMode = PHY_11G;
LONG WirelessMode;
MaxPhyMode = PHY_11N_5G;
WirelessMode = simple_strtol(arg, 0, 10);
if (WirelessMode <= MaxPhyMode)
{
pAd->CommonCfg.PhyMode = WirelessMode;
return TRUE;
}
return FALSE;
}
INT RT_CfgSetShortSlot(
IN PRTMP_ADAPTER pAd,
IN PSTRING arg)
{
LONG ShortSlot;
ShortSlot = simple_strtol(arg, 0, 10);
if (ShortSlot == 1)
pAd->CommonCfg.bUseShortSlotTime = TRUE;
else if (ShortSlot == 0)
pAd->CommonCfg.bUseShortSlotTime = FALSE;
else
return FALSE; //Invalid argument
return TRUE;
}
/*
==========================================================================
Description:
Set WEP KEY base on KeyIdx
Return:
TRUE if all parameters are OK, FALSE otherwise
==========================================================================
*/
INT RT_CfgSetWepKey(
IN PRTMP_ADAPTER pAd,
IN PSTRING keyString,
IN CIPHER_KEY *pSharedKey,
IN INT keyIdx)
{
INT KeyLen;
INT i;
UCHAR CipherAlg = CIPHER_NONE;
BOOLEAN bKeyIsHex = FALSE;
// TODO: Shall we do memset for the original key info??
memset(pSharedKey, 0, sizeof(CIPHER_KEY));
KeyLen = strlen(keyString);
switch (KeyLen)
{
case 5: //wep 40 Ascii type
case 13: //wep 104 Ascii type
bKeyIsHex = FALSE;
pSharedKey->KeyLen = KeyLen;
NdisMoveMemory(pSharedKey->Key, keyString, KeyLen);
break;
case 10: //wep 40 Hex type
case 26: //wep 104 Hex type
for(i=0; i < KeyLen; i++)
{
if( !isxdigit(*(keyString+i)) )
return FALSE; //Not Hex value;
}
bKeyIsHex = TRUE;
pSharedKey->KeyLen = KeyLen/2 ;
AtoH(keyString, pSharedKey->Key, pSharedKey->KeyLen);
break;
default: //Invalid argument
DBGPRINT(RT_DEBUG_TRACE, ("RT_CfgSetWepKey(keyIdx=%d):Invalid argument (arg=%s)\n", keyIdx, keyString));
return FALSE;
}
pSharedKey->CipherAlg = ((KeyLen % 5) ? CIPHER_WEP128 : CIPHER_WEP64);
DBGPRINT(RT_DEBUG_TRACE, ("RT_CfgSetWepKey:(KeyIdx=%d,type=%s, Alg=%s)\n",
keyIdx, (bKeyIsHex == FALSE ? "Ascii" : "Hex"), CipherName[CipherAlg]));
return TRUE;
}
/*
==========================================================================
Description:
Set WPA PSK key
Arguments:
pAdapter Pointer to our adapter
keyString WPA pre-shared key string
pHashStr String used for password hash function
hashStrLen Lenght of the hash string
pPMKBuf Output buffer of WPAPSK key
Return:
TRUE if all parameters are OK, FALSE otherwise
==========================================================================
*/
INT RT_CfgSetWPAPSKKey(
IN RTMP_ADAPTER *pAd,
IN PSTRING keyString,
IN UCHAR *pHashStr,
IN INT hashStrLen,
OUT PUCHAR pPMKBuf)
{
int keyLen;
UCHAR keyMaterial[40];
keyLen = strlen(keyString);
if ((keyLen < 8) || (keyLen > 64))
{
DBGPRINT(RT_DEBUG_TRACE, ("WPAPSK Key length(%d) error, required 8 ~ 64 characters!(keyStr=%s)\n",
keyLen, keyString));
return FALSE;
}
memset(pPMKBuf, 0, 32);
if (keyLen == 64)
{
AtoH(keyString, pPMKBuf, 32);
}
else
{
PasswordHash(keyString, pHashStr, hashStrLen, keyMaterial);
NdisMoveMemory(pPMKBuf, keyMaterial, 32);
}
return TRUE;
}
This diff is collapsed.
This diff is collapsed.
......@@ -24,12 +24,17 @@
* *
*************************************************************************
*/
/*
All functions in this file must be USB-depended, or you should out your function
in other files.
*/
#include "../rt_config.h"
#ifdef RTMP_MAC_USB
#include "../rt_config.h"
/*
......@@ -41,7 +46,7 @@
static inline NDIS_STATUS RtmpUSBCanDoWrite(
IN RTMP_ADAPTER *pAd,
IN UCHAR QueIdx,
IN HT_TX_CONTEXT *pHTTXContext)
IN HT_TX_CONTEXT *pHTTXContext)
{
NDIS_STATUS canWrite = NDIS_STATUS_RESOURCES;
......@@ -292,7 +297,6 @@ USHORT RtmpUSB_WriteSingleTxResource(
pTxBlk->Priv = (TXINFO_SIZE + USBDMApktLen);
// For TxInfo, the length of USBDMApktLen = TXWI_SIZE + 802.11 header + payload
//PS packets use HCCA queue when dequeue from PS unicast queue (WiFi WPA2 MA9_DT1 for Marvell B STA)
RTMPWriteTxInfo(pAd, pTxInfo, (USHORT)(USBDMApktLen), FALSE, FIFO_EDCA, FALSE /*NextValid*/, FALSE);
if ((pHTTXContext->CurWritePosition + 3906 + pTxBlk->Priv) > MAX_TXBULK_LIMIT)
......@@ -583,11 +587,11 @@ VOID RtmpUSBDataKickOut(
This function handle RT2870 specific TxDesc and cpu index update and kick the packet out.
*/
int RtmpUSBMgmtKickOut(
IN RTMP_ADAPTER *pAd,
IN UCHAR QueIdx,
IN RTMP_ADAPTER *pAd,
IN UCHAR QueIdx,
IN PNDIS_PACKET pPacket,
IN PUCHAR pSrcBufVA,
IN UINT SrcBufLen)
IN UINT SrcBufLen)
{
PTXINFO_STRUC pTxInfo;
ULONG BulkOutSize;
......@@ -679,6 +683,7 @@ VOID RtmpUSBNullFrameKickOut(
pTxWI = (PTXWI_STRUC)&pWirelessPkt[TXINFO_SIZE];
RTMPWriteTxWI(pAd, pTxWI, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, 0, BSSID_WCID, (sizeof(HEADER_802_11)),
0, 0, (UCHAR)pAd->CommonCfg.MlmeTransmit.field.MCS, IFS_HTTXOP, FALSE, &pAd->CommonCfg.MlmeTransmit);
RTMPMoveMemory(&pWirelessPkt[TXWI_SIZE+TXINFO_SIZE], &pAd->NullFrame, sizeof(HEADER_802_11));
pAd->NullContext.BulkOutSize = TXINFO_SIZE + TXWI_SIZE + sizeof(pAd->NullFrame) + 4;
......@@ -693,6 +698,109 @@ VOID RtmpUSBNullFrameKickOut(
}
/*
========================================================================
Routine Description:
Get a received packet.
Arguments:
pAd device control block
pSaveRxD receive descriptor information
*pbReschedule need reschedule flag
*pRxPending pending received packet flag
Return Value:
the recieved packet
Note:
========================================================================
*/
PNDIS_PACKET GetPacketFromRxRing(
IN PRTMP_ADAPTER pAd,
OUT PRT28XX_RXD_STRUC pSaveRxD,
OUT BOOLEAN *pbReschedule,
IN OUT UINT32 *pRxPending)
{
PRX_CONTEXT pRxContext;
PNDIS_PACKET pSkb;
PUCHAR pData;
ULONG ThisFrameLen;
ULONG RxBufferLength;
PRXWI_STRUC pRxWI;
pRxContext = &pAd->RxContext[pAd->NextRxBulkInReadIndex];
if ((pRxContext->Readable == FALSE) || (pRxContext->InUse == TRUE))
return NULL;
RxBufferLength = pRxContext->BulkInOffset - pAd->ReadPosition;
if (RxBufferLength < (RT2870_RXDMALEN_FIELD_SIZE + sizeof(RXWI_STRUC) + sizeof(RXINFO_STRUC)))
{
goto label_null;
}
pData = &pRxContext->TransferBuffer[pAd->ReadPosition]; /* 4KB */
// The RXDMA field is 4 bytes, now just use the first 2 bytes. The Length including the (RXWI + MSDU + Padding)
ThisFrameLen = *pData + (*(pData+1)<<8);
if (ThisFrameLen == 0)
{
DBGPRINT(RT_DEBUG_TRACE, ("BIRIdx(%d): RXDMALen is zero.[%ld], BulkInBufLen = %ld)\n",
pAd->NextRxBulkInReadIndex, ThisFrameLen, pRxContext->BulkInOffset));
goto label_null;
}
if ((ThisFrameLen&0x3) != 0)
{
DBGPRINT(RT_DEBUG_ERROR, ("BIRIdx(%d): RXDMALen not multiple of 4.[%ld], BulkInBufLen = %ld)\n",
pAd->NextRxBulkInReadIndex, ThisFrameLen, pRxContext->BulkInOffset));
goto label_null;
}
if ((ThisFrameLen + 8)> RxBufferLength) // 8 for (RT2870_RXDMALEN_FIELD_SIZE + sizeof(RXINFO_STRUC))
{
DBGPRINT(RT_DEBUG_TRACE,("BIRIdx(%d):FrameLen(0x%lx) outranges. BulkInLen=0x%lx, remaining RxBufLen=0x%lx, ReadPos=0x%lx\n",
pAd->NextRxBulkInReadIndex, ThisFrameLen, pRxContext->BulkInOffset, RxBufferLength, pAd->ReadPosition));
// error frame. finish this loop
goto label_null;
}
// skip USB frame length field
pData += RT2870_RXDMALEN_FIELD_SIZE;
pRxWI = (PRXWI_STRUC)pData;
if (pRxWI->MPDUtotalByteCount > ThisFrameLen)
{
DBGPRINT(RT_DEBUG_ERROR, ("%s():pRxWIMPDUtotalByteCount(%d) large than RxDMALen(%ld)\n",
__FUNCTION__, pRxWI->MPDUtotalByteCount, ThisFrameLen));
goto label_null;
}
// allocate a rx packet
pSkb = dev_alloc_skb(ThisFrameLen);
if (pSkb == NULL)
{
DBGPRINT(RT_DEBUG_ERROR,("%s():Cannot Allocate sk buffer for this Bulk-In buffer!\n", __FUNCTION__));
goto label_null;
}
// copy the rx packet
memcpy(skb_put(pSkb, ThisFrameLen), pData, ThisFrameLen);
RTPKT_TO_OSPKT(pSkb)->dev = get_netdev_from_bssid(pAd, BSS0);
RTMP_SET_PACKET_SOURCE(OSPKT_TO_RTPKT(pSkb), PKTSRC_NDIS);
// copy RxD
*pSaveRxD = *(PRXINFO_STRUC)(pData + ThisFrameLen);
// update next packet read position.
pAd->ReadPosition += (ThisFrameLen + RT2870_RXDMALEN_FIELD_SIZE + RXINFO_SIZE); // 8 for (RT2870_RXDMALEN_FIELD_SIZE + sizeof(RXINFO_STRUC))
return pSkb;
label_null:
return NULL;
}
/*
========================================================================
......@@ -775,6 +883,11 @@ NDIS_STATUS RTMPCheckRxError(
if (pRxINFO->Decrypted && pRxINFO->CipherErr)
{
if (((pRxINFO->CipherErr & 1) == 1) && pAd->CommonCfg.bWirelessEvent && INFRA_ON(pAd))
RTMPSendWirelessEvent(pAd, IW_ICV_ERROR_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0);
if (((pRxINFO->CipherErr & 2) == 2) && pAd->CommonCfg.bWirelessEvent && INFRA_ON(pAd))
RTMPSendWirelessEvent(pAd, IW_MIC_ERROR_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0);
//
// MIC Error
//
......@@ -801,14 +914,32 @@ NDIS_STATUS RTMPCheckRxError(
return(NDIS_STATUS_SUCCESS);
}
VOID RtmpUsbStaAsicForceWakeupTimeout(
IN PVOID SystemSpecific1,
IN PVOID FunctionContext,
IN PVOID SystemSpecific2,
IN PVOID SystemSpecific3)
{
RTMP_ADAPTER *pAd = (RTMP_ADAPTER *)FunctionContext;
if (pAd && pAd->Mlme.AutoWakeupTimerRunning)
{
AsicSendCommandToMcu(pAd, 0x31, 0xff, 0x00, 0x02);
OPSTATUS_CLEAR_FLAG(pAd, fOP_STATUS_DOZE);
pAd->Mlme.AutoWakeupTimerRunning = FALSE;
}
}
VOID RT28xxUsbStaAsicForceWakeup(
IN PRTMP_ADAPTER pAd,
IN BOOLEAN bFromTx)
{
AUTO_WAKEUP_STRUC AutoWakeupCfg;
BOOLEAN Canceled;
AutoWakeupCfg.word = 0;
RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word);
if (pAd->Mlme.AutoWakeupTimerRunning)
RTMPCancelTimer(&pAd->Mlme.AutoWakeupTimer, &Canceled);
AsicSendCommandToMcu(pAd, 0x31, 0xff, 0x00, 0x02);
......@@ -819,19 +950,14 @@ VOID RT28xxUsbStaAsicSleepThenAutoWakeup(
IN PRTMP_ADAPTER pAd,
IN USHORT TbttNumToNextWakeUp)
{
AUTO_WAKEUP_STRUC AutoWakeupCfg;
// we have decided to SLEEP, so at least do it for a BEACON period.
if (TbttNumToNextWakeUp == 0)
TbttNumToNextWakeUp = 1;
AutoWakeupCfg.word = 0;
RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word);
AutoWakeupCfg.field.NumofSleepingTbtt = TbttNumToNextWakeUp - 1;
AutoWakeupCfg.field.EnableAutoWakeup = 1;
AutoWakeupCfg.field.AutoLeadTime = 5;
RTMP_IO_WRITE32(pAd, AUTO_WAKEUP_CFG, AutoWakeupCfg.word);
RTMPSetTimer(&pAd->Mlme.AutoWakeupTimer, AUTO_WAKEUP_TIMEOUT);
pAd->Mlme.AutoWakeupTimerRunning = TRUE;
AsicSendCommandToMcu(pAd, 0x30, 0xff, 0xff, 0x02); // send POWER-SAVE command to MCU. Timeout 40us.
......@@ -839,98 +965,4 @@ VOID RT28xxUsbStaAsicSleepThenAutoWakeup(
}
VOID RT28xxUsbMlmeRadioOn(
IN PRTMP_ADAPTER pAd)
{
DBGPRINT(RT_DEBUG_TRACE,("RT28xxUsbMlmeRadioOn()\n"));
if (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF))
return;
AsicSendCommandToMcu(pAd, 0x31, 0xff, 0x00, 0x02);
RTMPusecDelay(10000);
NICResetFromError(pAd);
// Enable Tx/Rx
RTMPEnableRxTx(pAd);
#ifdef RT3070
if (IS_RT3071(pAd))
{
RT30xxReverseRFSleepModeSetup(pAd);
}
#endif // RT3070 //
// Clear Radio off flag
RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF);
RTUSBBulkReceive(pAd);
// Set LED
RTMPSetLED(pAd, LED_RADIO_ON);
}
VOID RT28xxUsbMlmeRadioOFF(
IN PRTMP_ADAPTER pAd)
{
WPDMA_GLO_CFG_STRUC GloCfg;
UINT32 Value, i;
DBGPRINT(RT_DEBUG_TRACE,("RT28xxUsbMlmeRadioOFF()\n"));
if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF))
return;
// Set LED
RTMPSetLED(pAd, LED_RADIO_OFF);
// Set Radio off flag
RTMP_SET_FLAG(pAd, fRTMP_ADAPTER_RADIO_OFF);
{
// Link down first if any association exists
if (INFRA_ON(pAd) || ADHOC_ON(pAd))
LinkDown(pAd, FALSE);
RTMPusecDelay(10000);
//==========================================
// Clean up old bss table
BssTableInit(&pAd->ScanTab);
}
if (pAd->CommonCfg.BBPCurrentBW == BW_40)
{
// Must using 40MHz.
AsicTurnOffRFClk(pAd, pAd->CommonCfg.CentralChannel);
}
else
{
// Must using 20MHz.
AsicTurnOffRFClk(pAd, pAd->CommonCfg.Channel);
}
// Disable Tx/Rx DMA
RTUSBReadMACRegister(pAd, WPDMA_GLO_CFG, &GloCfg.word); // disable DMA
GloCfg.field.EnableTxDMA = 0;
GloCfg.field.EnableRxDMA = 0;
RTUSBWriteMACRegister(pAd, WPDMA_GLO_CFG, GloCfg.word); // abort all TX rings
// Waiting for DMA idle
i = 0;
do
{
RTMP_IO_READ32(pAd, WPDMA_GLO_CFG, &GloCfg.word);
if ((GloCfg.field.TxDMABusy == 0) && (GloCfg.field.RxDMABusy == 0))
break;
RTMPusecDelay(1000);
}while (i++ < 100);
// Disable MAC Tx/Rx
RTMP_IO_READ32(pAd, MAC_SYS_CTRL, &Value);
Value &= (0xfffffff3);
RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, Value);
AsicSendCommandToMcu(pAd, 0x30, 0xff, 0xff, 0x02);
}
#endif // RTMP_MAC_USB //
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -25,7 +25,7 @@
*************************************************************************
Module Name:
sync.c
cmm_sync.c
Abstract:
......@@ -64,11 +64,16 @@ UCHAR A_BAND_REGION_3_CHANNEL_LIST[]={52, 56, 60, 64, 149, 153, 157, 161};
UCHAR A_BAND_REGION_4_CHANNEL_LIST[]={149, 153, 157, 161, 165};
UCHAR A_BAND_REGION_5_CHANNEL_LIST[]={149, 153, 157, 161};
UCHAR A_BAND_REGION_6_CHANNEL_LIST[]={36, 40, 44, 48};
UCHAR A_BAND_REGION_7_CHANNEL_LIST[]={36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165};
UCHAR A_BAND_REGION_7_CHANNEL_LIST[]={36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, 169, 173};
UCHAR A_BAND_REGION_8_CHANNEL_LIST[]={52, 56, 60, 64};
UCHAR A_BAND_REGION_9_CHANNEL_LIST[]={36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165};
UCHAR A_BAND_REGION_10_CHANNEL_LIST[]={36, 40, 44, 48, 149, 153, 157, 161, 165};
UCHAR A_BAND_REGION_11_CHANNEL_LIST[]={36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 149, 153, 157, 161};
UCHAR A_BAND_REGION_12_CHANNEL_LIST[]={36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140};
UCHAR A_BAND_REGION_13_CHANNEL_LIST[]={52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161};
UCHAR A_BAND_REGION_14_CHANNEL_LIST[]={36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 136, 140, 149, 153, 157, 161, 165};
UCHAR A_BAND_REGION_15_CHANNEL_LIST[]={149, 153, 157, 161, 165, 169, 173};
//BaSizeArray follows the 802.11n definition as MaxRxFactor. 2^(13+factor) bytes. When factor =0, it's about Ba buffer size =8.
UCHAR BaSizeArray[4] = {8,16,32,64};
......@@ -200,7 +205,22 @@ VOID BuildChannelList(
num = sizeof(A_BAND_REGION_11_CHANNEL_LIST)/sizeof(UCHAR);
pChannelList = A_BAND_REGION_11_CHANNEL_LIST;
break;
case REGION_12_A_BAND:
num = sizeof(A_BAND_REGION_12_CHANNEL_LIST)/sizeof(UCHAR);
pChannelList = A_BAND_REGION_12_CHANNEL_LIST;
break;
case REGION_13_A_BAND:
num = sizeof(A_BAND_REGION_13_CHANNEL_LIST)/sizeof(UCHAR);
pChannelList = A_BAND_REGION_13_CHANNEL_LIST;
break;
case REGION_14_A_BAND:
num = sizeof(A_BAND_REGION_14_CHANNEL_LIST)/sizeof(UCHAR);
pChannelList = A_BAND_REGION_14_CHANNEL_LIST;
break;
case REGION_15_A_BAND:
num = sizeof(A_BAND_REGION_15_CHANNEL_LIST)/sizeof(UCHAR);
pChannelList = A_BAND_REGION_15_CHANNEL_LIST;
break;
default: // Error. should never happen
DBGPRINT(RT_DEBUG_WARN,("countryregion=%d not support", pAd->CommonCfg.CountryRegionForABand));
break;
......@@ -383,8 +403,11 @@ VOID ScanNextChannel(
PHEADER_802_11 pHdr80211;
UINT ScanTimeIn5gChannel = SHORT_CHANNEL_TIME;
{
if (MONITOR_ON(pAd))
return;
}
if (pAd->MlmeAux.Channel == 0)
{
......@@ -409,6 +432,19 @@ VOID ScanNextChannel(
}
{
#ifdef RT2860
/*
If all peer Ad-hoc clients leave, driver would do LinkDown and LinkUp.
In LinkUp, CommonCfg.Ssid would copy SSID from MlmeAux.
To prevent SSID is zero or wrong in Beacon, need to recover MlmeAux.SSID here.
*/
if (ADHOC_ON(pAd))
{
NdisZeroMemory(pAd->MlmeAux.Ssid, MAX_LEN_OF_SSID);
pAd->MlmeAux.SsidLen = pAd->CommonCfg.SsidLen;
NdisMoveMemory(pAd->MlmeAux.Ssid, pAd->CommonCfg.Ssid, pAd->CommonCfg.SsidLen);
}
#endif // RT2860 //
//
// To prevent data lost.
// Send an NULL data with turned PSM bit on to current associated AP before SCAN progress.
......@@ -438,29 +474,26 @@ VOID ScanNextChannel(
MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_SCAN_CONF, 2, &Status);
}
RTMP_CLEAR_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS);
}
#ifdef RT2870
#ifdef RTMP_MAC_USB
else if (RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST) && (pAd->OpMode == OPMODE_STA))
{
pAd->Mlme.SyncMachine.CurrState = SYNC_IDLE;
MlmeCntlConfirm(pAd, MT2_SCAN_CONF, MLME_FAIL_NO_RESOURCE);
}
#endif // RT2870 //
#endif // RTMP_MAC_USB //
else
{
{
// BBP and RF are not accessible in PS mode, we has to wake them up first
if (OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_DOZE))
#ifdef RT2860
AsicForceWakeup(pAd, FROM_TX);
#endif
#ifdef RT2870
AsicForceWakeup(pAd, TRUE);
#endif
// leave PSM during scanning. otherwise we may lost ProbeRsp & BEACON
if (pAd->StaCfg.Psm == PWR_SAVE)
MlmeSetPsmBit(pAd, PWR_ACTIVE);
RTMP_SET_PSM_BIT(pAd, PWR_ACTIVE);
}
AsicSwitchChannel(pAd, pAd->MlmeAux.Channel, TRUE);
......@@ -487,16 +520,6 @@ VOID ScanNextChannel(
// Chnage the channel scan time for CISCO stuff based on its IAPP announcement
if (ScanType == FAST_SCAN_ACTIVE)
RTMPSetTimer(&pAd->MlmeAux.ScanTimer, FAST_ACTIVE_SCAN_TIME);
else if (((ScanType == SCAN_CISCO_ACTIVE) ||
(ScanType == SCAN_CISCO_PASSIVE) ||
(ScanType == SCAN_CISCO_CHANNEL_LOAD) ||
(ScanType == SCAN_CISCO_NOISE)) && (pAd->OpMode == OPMODE_STA))
{
if (pAd->StaCfg.CCXScanTime < 25)
RTMPSetTimer(&pAd->MlmeAux.ScanTimer, pAd->StaCfg.CCXScanTime * 2);
else
RTMPSetTimer(&pAd->MlmeAux.ScanTimer, pAd->StaCfg.CCXScanTime);
}
else // must be SCAN_PASSIVE or SCAN_ACTIVE
{
if ((pAd->CommonCfg.PhyMode == PHY_11ABG_MIXED)
......@@ -512,8 +535,9 @@ VOID ScanNextChannel(
RTMPSetTimer(&pAd->MlmeAux.ScanTimer, MAX_CHANNEL_TIME);
}
if ((ScanType == SCAN_ACTIVE) || (ScanType == FAST_SCAN_ACTIVE) ||
(ScanType == SCAN_CISCO_ACTIVE))
if ((ScanType == SCAN_ACTIVE)
|| (ScanType == FAST_SCAN_ACTIVE)
)
{
NStatus = MlmeAllocateMemory(pAd, &pOutBuffer); //Get an unused nonpaged memory
if (NStatus != NDIS_STATUS_SUCCESS)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -43,7 +43,7 @@
/* AUTO GEN PLEASE DO NOT MODIFY IT */
UCHAR FirmwareImage [] = {
UCHAR FirmwareImage_2860 [] = {
0x02, 0x03, 0x5e, 0x02, 0x02, 0xb1, 0x22, 0x22, 0xff, 0xff, 0xff, 0x02, 0x01, 0x82, 0xff, 0xff,
0xff, 0xff, 0xff, 0x02, 0x00, 0x1e, 0xff, 0xff, 0xff, 0xff, 0xff, 0x02, 0x01, 0x33, 0xc0, 0xe0,
0xc0, 0xf0, 0xc0, 0x83, 0xc0, 0x82, 0xc0, 0xd0, 0x75, 0xd0, 0x18, 0xc2, 0xaf, 0x30, 0x45, 0x03,
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
#include "../../rt2860/chips/rt3070.c"
#include "../../rt2860/chips/rt30xx.c"
#include "../../rt2860/common/action.c"
#include "../../rt2860/common/cmm_aes.c"
#include "../../rt2860/common/cmm_asic.c"
#include "../../rt2860/common/cmm_cfg.c"
#include "../../rt2860/common/cmm_data_usb.c"
#include "../../rt2860/common/cmm_mac_usb.c"
#include "../../rt2860/common/cmm_profile.c"
#include "../../rt2860/common/cmm_tkip.c"
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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