tiny210针对USI_WM-BN-BM-04的wifi的配置过程

时间:2022-08-29 06:54:28

2tiny210针对USI_WM-BN-BM-04wifi的配置过程

(参看TINY210_wifi调试过程.doc by joqian 2013-3-13

2.1 硬件配置

USI_WM-BN-BM-04涉及到的主要针脚为:

SDIO_D0, SDIO_D1, SDIO_D2, SDIO_D3,SDIO_VDD,SDIO_CMD,SDIO_CLK均为标准的SDIO接口对接;

SDIO_HOST_WAKE为向主机发起唤醒中断针脚;

WL_REG_ON为主机对wifi模块电源和reset控制针脚。

另外还有SPISDIO模式选择针脚,接地为SDIO模式。

 

2.2内核配置

2.2.1源码替换:

\linux-3.0.8\drivers\net\wireless\bcmdhd替换为usi提供的bcmdhd文件

       需要注意的是,该文件夹下的驱动之注册了驱动,而没有注册设备,所以加一个源文件device_04_wlan.c用于注册设备的。

 

2.2.2源码修改:

需要针对SDIO_HOST_WAKEWL_REG_ON两个针脚进行配置:

1) SDIO_HOST_WAKE:用于主机中断,在cpu端为输入,起中断作用。

device_04_wlan.c源码中有针已经做了配置

static struct resource brcm_wlan_resources[] = {

        [0] = {

                .name   = "bcmdhd_wlan_irq",

                .start  =  40,

                .end    = 40,

                .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,

        },

};

需要根据实际针脚重新配置。(40eint[8]

 

2WL_REG_ON为电源控制和reset脚:

需要在cpu端,配置为输出,以控制usi模块的wifi功能的reset

这个可以在bcmdhd文件加下(即drivers\net\wireless\bcmdhd):

Dhd_custom_gpio.c源码中的dhd_customer_gpio_wlan_ctrl(int onoff)函数对WL_REG_ON针脚的电平高低控制。

 

#define RST_GPIO_PIN S5PV210_GPH0(5)

static int brcm_wlan_power_off_test()

{

    printk(KERN_INFO"%s Enter: power off\n", __func__);

    /* setup the outputs and init values */

       s3c_gpio_cfgpin(RST_GPIO_PIN, 0x1);

       gpio_direction_output(RST_GPIO_PIN, 0);

       gpio_set_value(RST_GPIO_PIN, 0);

       msleep(10);

      

       return 0;

}

 

static int brcm_wlan_power_on_test()

{

   printk(KERN_INFO"%s Enter: power on\n", __func__);

    /* setup the outputs and init values */

       s3c_gpio_cfgpin(RST_GPIO_PIN, 0x1);

       gpio_direction_output(RST_GPIO_PIN, 1);

       gpio_set_value(RST_GPIO_PIN, 1);

       msleep(10);

      

       return 0;

}

 

/* Customer function to control hw specific wlan gpios */

void

dhd_customer_gpio_wlan_ctrl(int onoff)

{

       switch (onoff) {

              case WLAN_RESET_OFF:

                     WL_TRACE(("%s: call customer specific GPIO to insert WLAN RESET\n",

                            __FUNCTION__));

#ifdef CUSTOMER_HW

                     bcm_wlan_power_off(2);

#endif /* CUSTOMER_HW */

#ifdef CUSTOMER_HW2

                     wifi_set_power(0, 0);

#endif

                     brcm_wlan_power_off_test();

                     WL_ERROR(("=========== WLAN placed in RESET ========\n"));

              break;

 

              case WLAN_RESET_ON:

                     WL_TRACE(("%s: callc customer specific GPIO to remove WLAN RESET\n",

                            __FUNCTION__));

#ifdef CUSTOMER_HW

                     bcm_wlan_power_on(2);

#endif /* CUSTOMER_HW */

#ifdef CUSTOMER_HW2

                     wifi_set_power(1, 0);

#endif

                     brcm_wlan_power_on_test();

                     WL_ERROR(("=========== WLAN going back to live  ========\n"));

              break;

 

              case WLAN_POWER_OFF:

                     WL_TRACE(("%s: call customer specific GPIO to turn off WL_REG_ON\n",

                            __FUNCTION__));

#ifdef CUSTOMER_HW

                     bcm_wlan_power_off(1);

#endif /* CUSTOMER_HW */

              brcm_wlan_power_off_test();

              break;

 

              case WLAN_POWER_ON:

                     WL_TRACE(("%s: call customer specific GPIO to turn on WL_REG_ON\n",

                            __FUNCTION__));

#ifdef CUSTOMER_HW

                     bcm_wlan_power_on(1);

                     /* Lets customer power to get stable */

                     OSL_DELAY(200);

#endif /* CUSTOMER_HW */

              brcm_wlan_power_on_test();

              OSL_DELAY(200);

              break;

       }

}

2.2.3内核配置

make menuconfig

1Networking support --->

       Wireless --->

tiny210针对USI_WM-BN-BM-04的wifi的配置过程

2Device Drivers --->

       Network device support --->

              Wireless LAN --->

tiny210针对USI_WM-BN-BM-04的wifi的配置过程

3Device Drivers --->

       MMC/SD/SDIO card support --->

 tiny210针对USI_WM-BN-BM-04的wifi的配置过程

 

 

2.3系统配置

2.3.1固件的打包:

1)需要将usi给的两个固件fw_bcmdhd.binbcmdhd.cal打包进系统中:

内核配置给定的路径为:

/system/etc/firmware/fw_bcmdhd.bin

/system/etc/wifi/bcmdhd.cal

 但实际调试之后,路径为如下:其中bcmdhd.cal需要改名为nvram.txt

system/vendor/firmware/bcm43xx/fw_bcmdhd.bin

system/vendor/firmware/bcm43xx/nvram.txt

 

2)因为友善纸对tiny210加了一些wifi库文件,所以需要把它们去掉,路径为:

./system/lib/modules/3.0.8-FriendlyARM

3.0.8-FriendlyARM重命名,或者删除。

 

2.3.2NL80211的配置:

tiny210wpa_supplicant用的是wext,而usiwifi采用的是NL80211。所以需要修改系统的配置:

1init.mini210.rc中的

service wpa_supplicant /system/bin/wpa_supplicant -Dwext -iwlan0

    class main

    socket wpa_wlan0 dgram 0660 wifi wifi

    disabled

    oneshot

改为:

service wpa_supplicant /system/bin/wpa_supplicant -Dnl80211-iwlan0

    class main

    socket wpa_wlan0 dgram 0660 wifi wifi

    disabled

oneshot

 

2)在android-4.0.3_r1\device\friendly-arm\mini210下的

BoardConfigCommon.mk中的

# Connectivity - Wi-Fi

WPA_SUPPLICANT_VERSION := VER_0_8_X

BOARD_WPA_SUPPLICANT_DRIVER := WEXT

BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_fawext

BOARD_WIFIHW_PRIVATE_LIB := lib_wifihw_fa

改成:

# Connectivity - Wi-Fi

WPA_SUPPLICANT_VERSION := VER_0_8_X

BOARD_WLAN_DEVICE := bcmdhd

#BOARD_HOSTAPD_DRIVER := NL80211

BOARD_WPA_SUPPLICANT_DRIVER := NL80211

BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_bcmdhd

#BOARD_WIFIHW_PRIVATE_LIB := lib_wifihw_fa

 

3)将\android-4.0.3_r1\vendor\friendly-arm\mini210\下的wifi文件夹删掉。

并删除相关库文件(具体没测试,因为我是直接make clean的,下班了,让他在晚上编译),重新编译生成。

 

经过以上的配置整个系统应该就支持USI_WM-BN-BM-04wifi了。