您的位置:首页 > 其它

hi3518e移植USB-WiFi RT3070 STA驱动

2015-01-29 11:50 239 查看
/**************************************************************************************************/
                                       步骤    1    (USB PHY被禁用)
/**************************************************************************************************/

热插拔usb无反应(没有打印一下信息):
# usb 1-1: new high speed USB device number 3 using hiusb-ehci


1、查看你是否加载了hi3518e的驱动。
2、查看hi3518e的驱动脚本
insert_ko()
{
# low power control
source ./lowpower.sh > /dev/null
。。。。

3、查看是否是驱动脚本中的lowpower.sh,禁止了热插拔。
#!/bin/sh
#....USB PHY..........0x20050080 [12]bit......0
himm 0x20050080 0x000121a8
#....USB PHY............0x20050084 [22]bit......1
himm 0x20050084 0x005d2188
#....NANDC..0x200300D0 [1:0]......2'b01
himm 0x200300D0 0x5
。。。


4、果然禁用了USB
PHY,这里我们只需要注释掉,做如下更改:
#....USB PHY..........0x20050080 [12]bit......0
#himm 0x20050080 0x000121a8
#....USB PHY............0x20050084 [22]bit......1
#himm 0x20050084 0x005d2188
#....NANDC..0x200300D0 [1:0]......2'b01
himm 0x200300D0 0x5
。。。


/**************************************************************************************************/

                                       步骤    2  (内核配置)

/**************************************************************************************************/
复制hi3518e的配置文件到.config
#cp arch/arm/configs/hi3518e_mini_defconfig ./.config

配置内核参数
#make menuconfig
[*] Networking support  --->
-*-   Wireless  --->
<*>   cfg80211 - wireless configuration API
[*]     enable powersave by default
[*]     cfg80211 wireless extensions compatibility
[*]   Wireless extensions sysfs files
<*>   Common routines for IEEE802.11 drivers
<*>   Generic IEEE 802.11 Networking Stack (mac80211)
[ ]   PID controller based rate control algorithm
[*]   Minstrel
[*]     Minstrel 802.11n support
Default rate control algorithm (Minstrel)  --->
[ ]   Select mac80211 debugging features  --->

Device Drivers  --->
[*] Network device support  --->
[*]   Wireless LAN  --->
<*>   USB ZD1201 based Wireless device support
[*] USB support  --->
-*-   Support for Host-si
[*]hiusb(ehci/ohci) family usb host device support  --->
<*>   EHCI HCD (USB 2.0) support
[*]     Root Hub Transaction Translators
<*>   OHCI HCD support
#make uImage


/**************************************************************************************************/

                                       步骤   3  (编译RT3070驱动)

/**************************************************************************************************/

1、修改Makfile,如下:
ifeq ($(TARGET),)
TARGET = LINUX        / /目标平台
endif
ifeq ($(CHIPSET),)
CHIPSET = 3070        //使用芯片
endif
.....
#PLATFORM = PC
PLATFORM = 5VT        //选择平台
....
ifeq ($(PLATFORM),5VT)
LINUX_SRC = /root/hi3518/linux-3.0.y            //刚刚编译好的内核的目录(一定要编译好内核才行)
CROSS_COMPILE = arm-hisiv100nptl-linux-        //HI编译工具链
#LINUX_SRC = /home/ralink-2860-sdk-5vt-distribution/linux-2.6.17
#CROSS_COMPILE = /opt/crosstool/uClibc_v5te_le_gcc_4_1_1/bin/arm-linux-
endif
....


2、修改os/linux/config.mk

 
   修改参数

# Support Wpa_Supplicant
#HAS_WPA_SUPPLICANT=n
HAS_WPA_SUPPLICANT=y
# Support Native WpaSupplicant for Network Maganger
#HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=n
HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=y


    搜索5VT

ifeq ($(PLATFORM),5VT)
#WFLAGS += -DCONFIG_5VT_ENHANCE   //屏蔽flags参数,hi3518e引脚是3.3v
endif
。。。
ifeq ($(PLATFORM),5VT)
#CFLAGS := -D__KERNEL__ -I$(LINUX_SRC)/include -I$(RT28xx_DIR)/include -mlittle-endian -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -O3 -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-omit-frame-pointer -mapcs -mno-sched-prolog -mabi=apcs-gnu -mno-thumb-interwork -D__LINUX_ARM_ARCH__=5 -march=armv5te -mtune=arm926ej-s --param max-inline-insns-single=40000  -Uarm -Wdeclaration-after-statement -Wno-pointer-sign -DMODULE $(WFLAGS)
EXTRA_CFLAGS := -D__KERNEL__ -I$(LINUX_SRC)/include -I$(RT28xx_DIR)/include -mlittle-endian -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -O3 -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-omit-frame-pointer -mapcs -mno-sched-prolog -mno-thumb-interwork -D__LINUX_ARM_ARCH__=5 -march=armv5te -mtune=arm926ej-s --param max-inline-insns-single=40000  -Uarm -Wdeclaration-after-statement -DMODULE $(WFLAGS) //参数和cflags一样,但是要去掉 -mabi=apcs-gnu和 -Wno-pointer-sign 两个参数
#export CFLAGS
export EXTRA_CFLAGS        //将cflags 修改为 extra_cflags, 不然编译不通过。


3、修改  ./chips/rtmp_chip.c 文件,如下:

...
#ifdef RT30xx
if (IS_RT30xx(pAd))
{
/*
if (IS_RT3390(pAd))
RT33xx_Init(pAd);
else
*/
RT30xx_Init(pAd);
}
#endif /* RT30xx */
...


4、修改./include/iface/rtmp_usb.h文件,如下:
...
//#define RXBULKAGGRE_SIZE 12
#define RXBULKAGGRE_SIZE 6
...


5、编译

 
#make


6、生成os/linux/rt3070sta.ko

7、复制运行配置文件(可自己修改配置),到板端文件系统

 
#cp RT2870STA.dat  /etc/Wireless/RT2870STA/RT2870STA.dat


8、加载驱动
#insmod   rt3070sta.ko
rtusb init rt2870 --->
=== pAd = c2a78000, size = 509944 ===
<-- RTMPAllocTxRxRingMemory, Status=0
<-- RTMPAllocAdapterBlock, Status=0
usbcore: registered new interface driver rt2870


注:

    1、请严格按照步骤进行,因为两步之间相互有影响。

    2、如果重新编译内核后,驱动不可用,可以尝试重新编译驱动。

    3、邮箱网卡不可用,可修改内核,如下:        

Device Drivers  --->
[*] Network device support  --->
[*]   Ethernet (10 or 100Mbit)  --->
<*>   hieth(switch fabric) family network device support  --->
(1)   hieth mii/rmii mode for up port (mii:0/rmii:1)
(1)   hieth mii/rmii mode for down port (mii:0/rmii:1)


       
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息