Commit e3f5b4cf authored by Diego Pasqualin's avatar Diego Pasqualin

le-pregao-712010: Using dkms to compile wireless module

Signed-off-by: 's avatarDiego Pasqualin <dpasqualin@c3sl.ufpr.br>
parent facad9c5
Package: le-pregao-712010
Version: 0.0.12
Priority: important
Version:
Maintainer: LE Maintainer <le-maintainer@c3sl.ufpr.br>
Architecture: i386
Section: main
Priority: important
Depends: linux-image-2.6.32-29-generic-pae
Pre-Depends: dkms
Description: Especific changes to make LE4.0 work on "Pregao 71/2010"
......@@ -20,8 +20,35 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
echo "Running depmod..."
/sbin/depmod -a 2.6.32-29-generic-pae
PACKAGE_NAME="lepregao712010"
PACKAGE_VERSION="2.3.0.0-Alpha-v2"
KERNEL_VERSION="$(uname -r)"
# Put conflicting modules at /etc/modprobe.d/blacklist.conf
echo "# replaced by rt3562sta" >> /etc/modprobe.d/blacklist.conf
echo "blacklist rt2800pci" >> /etc/modprobe.d/blacklist.conf
# Function to set selections
setselections() {
selfile=$1
# Wait until it works
while ! dpkg --set-selections < ${selfile} &>/dev/null ; do
sleep 1
done
rm -f ${selfile}
}
# Hold Kernel
sels=$(mktemp)
auxfile=$(mktemp)
dpkg --get-selections \* > ${sels}
awk '{if (($1 ~ /^linux-image-generic-pae/) || ($1 ~ /^linux-headers-generic-pae/)) {print $1"\thold"} else { print $0} }' ${sels} >\
${auxfile}
rm -f ${sels}
setselections ${auxfile} & disown
echo "Building module for all installed kernels using dkms..."
/usr/lib/dkms/common.postinst $PACKAGE_NAME $PACKAGE_VERSION
echo "Loading module rt3562sta"
modprobe rt3562sta || true
......@@ -33,4 +60,5 @@ echo "Restarting network interfaces"
aa-complain cupsd
/etc/init.d/cups start
echo $KERNEL_VERSION > /var/log/le-oldkernelversion
exit 0
......@@ -20,6 +20,10 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
# removing conflicting modules from blacklist
sed -i s/'# replaced by rt3562sta'/''/ /etc/modprobe.d/blacklist.conf
sed -i s/'blacklist rt2800pci'/''/ /etc/modprobe.d/blacklist.conf
echo "Running depmod..."
/sbin/depmod -a 2.6.32-29-generic-pae
......
......@@ -20,7 +20,17 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
PACKAGE_NAME="lepregao712010"
PACKAGE_VERSION="2.3.0.0-Alpha-v2"
echo "Unloading module rt3562sta"
rmmod rt3562sta || true
if test "$1" != "upgrade"; then
dkms uninstall -m $PACKAGE_NAME -v $PACKAGE_VERSION
fi
echo "Restarting network interfaces"
/etc/init.d/networking restart || true
exit 0
#! /bin/sh
if dpkg -l le-pregao-712010 | grep -q ^ii; then
if test -f "/var/log/le-oldkernelversion"; then
# if we know old kernel version
old_version=$(cat "/var/log/le-oldkernelversion")
actual_version=$(uname -r)
if test ${old_version} != ${actual_version}; then
# if kernel was upgraded
/usr/lib/dkms/common.postinst lepregao712010 2.3.0.0-Alpha-v2
fi
else
# if we don't know old kernel version
/usr/lib/dkms/common.postinst lepregao712010 2.3.0.0-Alpha-v2
fi
# set kernel version for next upgrade
uname -r > "/var/log/le-oldkernelversion"
# if modprobe fail, will not have problem, this mean that
# the driver is already on kernel (I hope)
#test -n "`cat /proc/modules | grep rt3562sta`" && rmmod rt3562sta
modprobe rt3562sta
fi
# Verify if the kernel is in hold state
if test $(dpkg --get-selections | grep linux-image-generic-pae | tr -s [:blank:] | cut -f2) != "hold"; then
echo "linux-image-generic-pae hold" | dpkg --set-selections
echo "linux-headers-generic-pae hold" | dpkg --set-selections
fi
../init.d/pregao71
\ No newline at end of file
../init.d/pregao71
\ No newline at end of file
../init.d/pregao71
\ No newline at end of file
../init.d/pregao71
\ No newline at end of file
../init.d/pregao71
\ No newline at end of file
Copyright (c) 2009, Ralink Technology Corporation
All rights reserved.
Redistribution. Redistribution and use in binary form, without
modification, are permitted provided that the following conditions are
met:
* Redistributions must reproduce the above copyright notice and the
following disclaimer in the documentation and/or other materials
provided with the distribution.
* Neither the name of Ralink Technology Corporation nor the names of its
suppliers may be used to endorse or promote products derived from this
software without specific prior written permission.
* No reverse engineering, decompilation, or disassembly of this software
is permitted.
Limited patent license. Ralink Technology Corporation grants a world-wide,
royalty-free, non-exclusive license under patents it now or hereafter
owns or controls to make, have made, use, import, offer to sell and
sell ("Utilize") this software, but solely to the extent that any
such patent is necessary to Utilize the software alone, or in
combination with an operating system licensed under an approved Open
Source license as listed by the Open Source Initiative at
http://opensource.org/licenses. The patent license shall not apply to
any other combinations which include this software. No hardware per
se is licensed hereunder.
DISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
RT28xx_MODE = STA
TARGET = LINUX
CHIPSET = 3562
OSABL = NO
#RT28xx_DIR = home directory of RT28xx source code
RT28xx_DIR = $(shell pwd)
RTMP_SRC_DIR = $(RT28xx_DIR)/RT$(CHIPSET)
#PLATFORM: Target platform
PLATFORM = PC
#PLATFORM = 5VT
#PLATFORM = IKANOS_V160
#PLATFORM = IKANOS_V180
#PLATFORM = SIGMA
#PLATFORM = SIGMA_8622
#PLATFORM = INIC
#PLATFORM = STAR
#PLATFORM = IXP
#PLATFORM = INF_TWINPASS
#PLATFORM = INF_DANUBE
#PLATFORM = INF_AR9
#PLATFORM = BRCM_6358
#PLATFORM = INF_AMAZON_SE
#PLATFORM = CAVM_OCTEON
#PLATFORM = CMPC
#PLATFORM = RALINK_2880
#PLATFORM = RALINK_3052
#PLATFORM = SMDK
#PLATFORM = KODAK_DC
#PLATFORM = DM6446
#PLATFORM = FREESCALE8377
ifeq ($(TARGET),LINUX)
MAKE = make
endif
ifeq ($(PLATFORM),5VT)
LINUX_SRC = /project/stable/5vt/ralink-2860-sdk/linux-2.6.17
CROSS_COMPILE = /opt/crosstool/uClibc_v5te_le_gcc_4_1_1/bin/arm-linux-
endif
ifeq ($(PLATFORM),IKANOS_V160)
LINUX_SRC = /home/sample/projects/LX_2618_RG_5_3_00r4_SRC/linux-2.6.18
CROSS_COMPILE = mips-linux-
endif
ifeq ($(PLATFORM),IKANOS_V180)
LINUX_SRC = /home/sample/projects/LX_BSP_VX180_5_4_0r1_ALPHA_26DEC07/linux-2.6.18
CROSS_COMPILE = mips-linux-
endif
ifeq ($(PLATFORM),SIGMA)
LINUX_SRC = /root/sigma/smp86xx_kernel_source_2.7.172.0/linux-2.6.15
CROSS_COMPILE = /root/sigma/smp86xx_toolchain_2.7.172.0/build_mipsel_nofpu/staging_dir/bin/mipsel-linux-
endif
ifeq ($(PLATFORM),SIGMA_8622)
LINUX_SRC = /home/snowpin/armutils_2.5.120.1/build_arm/linux-2.4.22-em86xx
CROSS_COMPILE = /home/snowpin/armutils_2.5.120.1/toolchain/bin/arm-elf-
CROSS_COMPILE_INCLUDE = /home/snowpin/armutils_2.5.120.1/toolchain/lib/gcc-lib/arm-elf/2.95.3
endif
ifeq ($(PLATFORM),STAR)
LINUX_SRC = /opt/star/kernel/linux-2.4.27-star
CROSS_COMPILE = /opt/star/tools/arm-linux/bin/arm-linux-
endif
ifeq ($(PLATFORM), RALINK_2880)
LINUX_SRC = /project/stable/RT288x/RT288x_SDK/source/linux-2.4.x
CROSS_COMPILE = /opt/buildroot-gdb/bin/mipsel-linux-
endif
ifeq ($(PLATFORM),RALINK_3052)
LINUX_SRC = /home/peter/ap_soc/SDK_3_3_0_0/RT288x_SDK/source/linux-2.6.21.x
CROSS_COMPILE = /opt/buildroot-gcc342/bin/mipsel-linux-uclibc-
endif
ifeq ($(PLATFORM),FREESCALE8377)
LINUX_SRC = /opt/ltib-mpc8377_rds-20090309/rpm/BUILD/linux-2.6.25
CROSS_COMPILE = /opt/freescale/usr/local/gcc-4.2.187-eglibc-2.5.187/powerpc-linux-gnu/bin/powerpc-linux-gnu-
endif
ifeq ($(PLATFORM),PC)
# Linux 2.6
LINUX_SRC = /lib/modules/$(shell uname -r)/build
# Linux 2.4 Change to your local setting
#LINUX_SRC = /usr/src/linux-2.4
LINUX_SRC_MODULE = /lib/modules/$(shell uname -r)/kernel/drivers/net/wireless/
CROSS_COMPILE =
endif
ifeq ($(PLATFORM),IXP)
LINUX_SRC = /project/stable/Gmtek/snapgear-uclibc/linux-2.6.x
CROSS_COMPILE = arm-linux-
endif
ifeq ($(PLATFORM),INF_TWINPASS)
# Linux 2.6
#LINUX_SRC = /lib/modules/$(shell uname -r)/build
# Linux 2.4 Change to your local setting
LINUX_SRC = /project/stable/twinpass/release/2.0.1/source/kernel/opensource/linux-2.4.31/
CROSS_COMPILE = mips-linux-
endif
ifeq ($(PLATFORM),INF_DANUBE)
LINUX_SRC = /opt/danube/sdk/linux-2.6.16.x
CROSS_COMPILE = mips-linux-
ROOTDIR = /opt/danube/sdk
export ROOTDIR
endif
ifeq ($(PLATFORM),INF_AR9)
LINUX_SRC = /root/ar9/xR9_BSP1.2.2.0/source/kernel/opensource/linux-2.6.20/
CROSS_COMPILE = /root/ar9/ifx-lxdb26-1.0.2/gcc-3.4.4/toolchain-mips/bin/
endif
ifeq ($(PLATFORM),BRCM_6358)
LINUX_SRC =
CROSS_COMPILE =
endif
ifeq ($(PLATFORM),INF_AMAZON_SE)
# Linux 2.6
#LINUX_SRC = /lib/modules/$(shell uname -r)/build
# Linux 2.4 Change to your local setting
LINUX_SRC = /backup/ifx/3.6.2.2/source/kernel/opensource/linux-2.4.31
#CROSS_COMPILE = mips-linux-
#LINUX_SRC = /project/Infineon/3.6.2.2/source/kernel/opensource/linux-2.4.31
CROSS_COMPILE = /opt/uclibc-toolchain/ifx-lxdb-1-2-3-external/gcc-3.3.6/toolchain-mips/R0208V35/mips-linux-uclibc/bin/
endif
ifeq ($(PLATFORM),ST)
LINUX_SRC = /opt/STM/STLinux-2.2/devkit/sources/kernel/linux0039
CROSS_COMPILE = /opt/STM/STLinux-2.2/devkit/sh4/bin/sh4-linux-
ARCH := sh
export ARCH
endif
ifeq ($(PLATFORM),CAVM_OCTEON)
OCTEON_ROOT = /usr/local/Cavium_Networks/OCTEON-SDK
LINUX_SRC = $(OCTEON_ROOT)/linux/kernel_2.6/linux
CROSS_COMPILE = mips64-octeon-linux-gnu-
endif
ifeq ($(PLATFORM),CMPC)
LINUX_SRC = /opt/fvt_11N_SDK_0807/fvt131x_SDK_11n/linux-2.6.17
CROSS_COMPILE =
endif
ifeq ($(PLATFORM),SMDK)
LINUX_SRC = /home/bhushan/itcenter/may28/linux-2.6-samsung
CROSS_COMPILE = /usr/local/arm/4.2.2-eabi/usr/bin/arm-linux-
endif
ifeq ($(PLATFORM),KODAK_DC)
SKD_SRC = C:/SigmaTel/DC1250_SDK_v1-9/sdk
CROSS_COMPILE = $(cc)
endif
ifeq ($(PLATFORM),DM6446)
LINUX_SRC = /home/fonchi/work/soc/ti-davinci
endif
export OSABL RT28xx_DIR RT28xx_MODE LINUX_SRC CROSS_COMPILE CROSS_COMPILE_INCLUDE PLATFORM RELEASE CHIPSET RTMP_SRC_DIR LINUX_SRC_MODULE TARGET
all: build_tools $(TARGET)
build_tools:
$(MAKE) -C tools
$(RT28xx_DIR)/tools/bin2h
test:
$(MAKE) -C tools test
LINUX:
ifneq (,$(findstring 2.4,$(LINUX_SRC)))
cp -f os/linux/Makefile.4 $(RT28xx_DIR)/os/linux/Makefile
$(MAKE) -C $(RT28xx_DIR)/os/linux/
# cp -f $(RT28xx_DIR)/os/linux/rt$(CHIPSET)sta.o /tftpboot
else
cp -f os/linux/Makefile.6 $(RT28xx_DIR)/os/linux/Makefile
ifeq ($(PLATFORM),DM6446)
$(MAKE) ARCH=arm CROSS_COMPILE=arm_v5t_le- -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
else
ifeq ($(PLATFORM),FREESCALE8377)
$(MAKE) ARCH=powerpc CROSS_COMPILE=$(CROSS_COMPILE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
else
$(MAKE) -C $(LINUX_SRC) SUBDIRS=$(RT28xx_DIR)/os/linux modules
endif
endif
endif
clean:
ifeq ($(TARGET), LINUX)
ifneq (,$(findstring 2.4,$(LINUX_SRC)))
cp -f os/linux/Makefile.4 os/linux/Makefile
else
cp -f os/linux/Makefile.6 os/linux/Makefile
endif
$(MAKE) -C os/linux clean
rm -rf os/linux/Makefile
endif
uninstall:
ifeq ($(TARGET), LINUX)
ifneq (,$(findstring 2.4,$(LINUX_SRC)))
$(MAKE) -C $(RT28xx_DIR)/os/linux -f Makefile.4 uninstall
else
$(MAKE) -C $(RT28xx_DIR)/os/linux -f Makefile.6 uninstall
endif
endif
install:
ifeq ($(TARGET), LINUX)
ifneq (,$(findstring 2.4,$(LINUX_SRC)))
$(MAKE) -C $(RT28xx_DIR)/os/linux -f Makefile.4 install
else
$(MAKE) -C $(RT28xx_DIR)/os/linux -f Makefile.6 install
endif
endif
#The word of "Default" must not be removed
Default
CountryRegion=5
CountryRegionABand=7
CountryCode=
ChannelGeography=1
SSID=Dennis2860AP
NetworkType=Infra
WirelessMode=5
Channel=0
BeaconPeriod=100
TxPower=100
BGProtection=0
TxPreamble=0
RTSThreshold=2347
FragThreshold=2346
TxBurst=1
PktAggregate=0
WmmCapable=1
AckPolicy=0;0;0;0
AuthMode=OPEN
EncrypType=NONE
WPAPSK=
DefaultKeyID=1
Key1Type=0
Key1Str=
Key2Type=0
Key2Str=
Key3Type=0
Key3Str=
Key4Type=0
Key4Str=
PSMode=CAM
AutoRoaming=0
RoamThreshold=70
APSDCapable=0
APSDAC=0;0;0;0
HT_RDG=1
HT_EXTCHA=0
HT_OpMode=0
HT_MpduDensity=4
HT_BW=1
HT_AutoBA=1
HT_BADecline=0
HT_AMSDU=0
HT_BAWinSize=64
HT_GI=1
HT_MCS=33
HT_MIMOPSMode=3
HT_DisallowTKIP=1
HT_STBC=0
IEEE80211H=0
TGnWifiTest=0
WirelessEvent=0
CarrierDetect=0
AntDiversity=0
BeaconLostTime=4
PSP_XLINK_MODE=0
#The word of "Default" must not be removed, maximum 32 cards, 00 ~ 31
Default
#CARDID, MAC, CARDTYPE
SELECT=CARDTYPE
00CARDID=/etc/Wireless/RT2860STA/RT2860STA1.dat
01CARDID=/etc/Wireless/RT2860STA/RT2860STA2.dat
02CARDID=/etc/Wireless/RT2860STA/RT2860STA3.dat
00MAC00:0E:2E:C3:D0:48=/etc/Wireless/RT2860STA/RT2860STA1.dat
01MAC00:40:F4:FF:AA:40=/etc/Wireless/RT2860STA/RT2860STA2.dat
02MAC00:0C:43:10:11:5C=/etc/Wireless/RT2860STA/RT2860STA3.dat
00CARDTYPEbgn=/etc/Wireless/RT2860STA/RT2860STA1.dat
01CARDTYPEbgn=/etc/Wireless/RT2860STA/RT2860STA2.dat
02CARDTYPEabgn=/etc/Wireless/RT2860STA/RT2860STA3.dat
/*
*************************************************************************
* Ralink Tech Inc.
* 5F., No.36, Taiyuan St., Jhubei City,
* Hsinchu County 302,
* Taiwan, R.O.C.
*
* (c) Copyright 2002-2010, 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:
rt35xx.c
Abstract:
Specific funcitons and variables for
RT3062
RT3562
RT3572
RT3592
Revision History:
Who When What
-------- ---------- ----------------------------------------------
*/
#ifdef RT35xx
#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 //
REG_PAIR RF3572_RFRegTable[] = {
{RF_R00, 0x70},
{RF_R01, 0x81},
{RF_R02, 0xF1},
{RF_R03, 0x02},
{RF_R04, 0x4C},
{RF_R05, 0x05},
{RF_R06, 0x4A},
{RF_R07, 0xD8},
// {RF_R08, 0x80},
{RF_R09, 0xC3},
{RF_R10, 0xF1},
{RF_R11, 0xB9},
{RF_R12, 0x70},
{RF_R13, 0x65},
{RF_R14, 0xA0},
{RF_R15, 0x53},
{RF_R16, 0x4C},
{RF_R17, 0x23},
{RF_R18, 0xAC},
{RF_R19, 0x93},
{RF_R20, 0xB3},
{RF_R21, 0xD0},
{RF_R22, 0x00},
{RF_R23, 0x3C},
{RF_R24, 0x16},
{RF_R25, 0x15},
{RF_R26, 0x85},
{RF_R27, 0x00},
{RF_R28, 0x00},
{RF_R29, 0x9B},
{RF_R30, 0x09},
{RF_R31, 0x10},
};
#define NUM_RF_3572REG_PARMS (sizeof(RF3572_RFRegTable) / sizeof(REG_PAIR))
VOID NICInitRT3572RFRegisters(IN PRTMP_ADAPTER pAd)
{
INT i;
UINT32 RfReg = 0;
UINT32 data;
/*
Driver must read EEPROM to get RfIcType before initial RF registers
Initialize RF register to default value
Init RF calibration
Driver should toggle RF R30 bit7 before init RF registers
*/
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_3572REG_PARMS; i++)
{
RT30xxWriteRFRegister(pAd, RF3572_RFRegTable[i].Register, RF3572_RFRegTable[i].Value);
}
/* 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);
if ((pAd->NicConfig2.field.DACTestBit == 1) && ((pAd->MACVersion & 0xffff) < 0x0211))
{
/* patch tx EVM issue temporarily */
RTMP_IO_READ32(pAd, LDO_CFG0, &data);
data = ((data & 0xF0FFFFFF) | 0x0D000000);