I.MX6 AW-NB177NF WIFi 驱动移植问题

Posted zengjf

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了I.MX6 AW-NB177NF WIFi 驱动移植问题相关的知识,希望对你有一定的参考价值。

/********************************************************************************
 *                  I.MX6 AW-NB177NF WIFi 驱动移植问题
 * 说明:
 *     之前驱动移植,但看不到有wlan设备产生,于是感觉是wifi驱动出了问题,于是开始
 * 分析厂家提供的wifi驱动,发现id对应的信息不对,经过与FAE确认之后并验证,确实是
 * 这个问题导致的。
 *
 *                                              2016-6-20 深圳 南山平山村 曾剑锋
 *******************************************************************************/

一、参考文档:
    AW-NB177NF-DS-BC-Rev0.3_single Ant.pdf

二、wifi 驱动注册设备驱动的id相关代码:
    ......
    static const struct sdio_device_id sdio_ids[] =
    {
    #ifdef CONFIG_RTL8723B
        { SDIO_DEVICE(0x024c, 0xB723),.driver_data = RTL8723B},
    #endif
    #ifdef CONFIG_RTL8188E
        { SDIO_DEVICE(0x024c, 0x8179),.driver_data = RTL8188E},
    #endif //CONFIG_RTL8188E
    
    #ifdef CONFIG_RTL8821A
        { SDIO_DEVICE(0x024c, 0x8821),.driver_data = RTL8821},
    #endif //CONFIG_RTL8821A
    
    #ifdef CONFIG_RTL8192E
        { SDIO_DEVICE(0x024c, 0x818B),.driver_data = RTL8192E},
    #endif //CONFIG_RTL8192E
    
    #if defined(RTW_ENABLE_WIFI_CONTROL_FUNC) /* temporarily add this to accept all sdio wlan id */
        { SDIO_DEVICE_CLASS(SDIO_CLASS_WLAN) },
    #endif
        { /* end: all zeroes */             },
    };
    ......
    #define SDIO_DEVICE(vend,dev) \
        .class = SDIO_ANY_ID,         .vendor = (vend), .device = (dev)
    ......
    #define SDIO_ANY_ID (~0)
    ......

三、获取SDIO设备信息代码位置如下:
    static int sdio_init_func(struct mmc_card *card, unsigned int fn)
    {
        int ret;
        struct sdio_func *func;

        BUG_ON(fn > SDIO_MAX_FUNCS);

        func = sdio_alloc_func(card);
        if (IS_ERR(func))
            return PTR_ERR(func);

        func->num = fn;

        if (!(card->quirks & MMC_QUIRK_NONSTD_SDIO)) {
            ret = sdio_read_fbr(func);
            if (ret)
                goto fail;

            ret = sdio_read_func_cis(func);
            if (ret)
                goto fail;
        } else {
            func->vendor = func->card->cis.vendor;
            func->device = func->card->cis.device;
            func->max_blksize = func->card->cis.blksize;
        }

        card->sdio_func[fn - 1] = func;

        printk("check sdio, func->vendor: 0x%x, func->device: 0x%x, func->max_blksize: 0x%x.\n", func->vendor, func->device, func-       >max_blksize);
        return 0;

    fail:
        /*
         * It is okay to remove the function here even though we hold
         * the host lock as we haven‘t registered the device yet.
         */
        sdio_remove_func(func);
        return ret;
    }
        
四、SDIO驱动获取到的信息:
    func->vendor: 0x24c, func->device: 0x626, func->max_blksize: 0x200.

五、解决办法:
    { SDIO_DEVICE(0x024c, 0x626),.driver_data = RTL8723B},

六、查看结果:
    [email protected]:/ # busybox ifconfig -a
    can0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
              NOARP  MTU:16  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:10 
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
              Interrupt:142 

    can1      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
              NOARP  MTU:16  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:10 
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
              Interrupt:143 

    ip6tnl0   Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
              NOARP  MTU:1452  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0 
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

    lo        Link encap:Local Loopback  
              inet addr:127.0.0.1  Mask:255.0.0.0
              inet6 addr: ::1/128 Scope:Host
              UP LOOPBACK RUNNING  MTU:16436  Metric:1
              RX packets:4683 errors:0 dropped:0 overruns:0 frame:0
              TX packets:4683 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0 
              RX bytes:703477 (686.9 KiB)  TX bytes:703477 (686.9 KiB)

    sit0      Link encap:IPv6-in-IPv4  
              NOARP  MTU:1480  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0 
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

    tunl0     Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-10-00-00-00-00-00-00-00-00-00  
              NOARP  MTU:1480  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0 
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

    wlan0     Link encap:Ethernet  HWaddr 80:A5:89:49:6E:81  
              BROADCAST MULTICAST  MTU:1500  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

    [email protected]:/ #

七、Linux kernel log:
    RTL871X: module init start
    RTL871X: rtl8723bs v4.3.16_13854.20150410_BTCOEX20150119-5844
    RTL871X: build time: Jun 20 2016 09:05:58
    RTL871X: rtl8723bs BT-Coex version = BTCOEX20150119-5844
    RTL871X: module init ret=0
    ......
    check sdio, func->vendor: 0x24c, func->device: 0x626, func->max_blksize: 0x200.
    mmc2: new high speed SDIO card at address 0001
    ......
    RTL871X: register rtw_netdev_ops to netdev_ops
    RTL871X: rtw_hal_config_rftype RF_Type is 3 TotalTxPath is 1 
    RTL871X: Chip Version Info: CHIP_8723B_Normal_Chip_TSMC_B_CUT_1T1R_RomVer(0)
    RTL871X: EEPROM type is E-FUSE
    RTL871X: SetHwReg8723B: bMacPwrCtrlOn=1
    RTL871X: PowerOnCheck: val_mix:0x0000063f, res:0x0000063f
    RTL871X: PowerOnCheck: 0x100 the result of cmd52 and cmd53 is the same.
    RTL871X: PowerOnCheck: 0x1B8 test Pass.
    RTL871X: _ReadAdapterInfo8723BS, 0x4e=0xe2
    RTL871X: hal_EfuseSwitchToBank: Efuse switch bank to 0
    RTL871X: hal_ReadEFuse_WiFi: data end at address=0xad
    RTL871X: Efuse Realmap:
    08 28 00 62 07 0D 45 10 02 00 00 
    29 29 29 29 28 28 2F 2F 2F 2E 2E E0 FF FF FF FF 
    FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
    FF FF FF FF FF FF FF FF FF FF 2D 2D 2D 2D 2D 2D 
    2D 2D 2D 2D 2D E0 FF FF FF FF FF FF FF FF FF FF 
    FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
    FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
    FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
    FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
    FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
    FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
    FF FF FF FF FF FF FF FF 20 2C 20 00 00 00 FF FF 
    FF 29 20 11 00 00 00 FF 00 FF 12 FF FF FF FF FF 
    3E 10 01 02 23 00 00 FF 20 04 4C 02 26 06 21 02 
    0C 00 22 04 00 08 00 32 FF 21 02 0C 00 22 2A 01 
    01 00 00 00 00 00 00 00 00 00 00 00 02 00 FF FF 
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
    00 EB 00 6E 01 00 00 00 00 FF 80 A5 89 49 6E 81 
    FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
    FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
    FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
    FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
    FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
    FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
    FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
    FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
    FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
    FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
    FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
    FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
    FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
    FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
    RTL871X: Hal_EfuseParseBTCoexistInfo_8723B: Enable BT-coex, ant_num=1
    RTL871X: Hal_EfuseParsePackageType_8723B phy efuse read 0x1FB =fc 
    RTL871X: PackageType = 0x4
    RTL871X: Hal_EfuseParseVoltage_8723B hwinfo[EEPROM_Voltage_ADDR_8723B] =62 
    EXT4-fs (mmcblk0p5): mounted filesystem with ordered data mode. Opts: (null)
    RTL871X: Hal_EfuseParseVoltage_8723B pHalData->adjuseVoltageVal =6 
    RTL871X: AutoloadFail =0,
    RTL871X: pHalData->EEPROMRFGainVal=f0
    RTL871X: EEPRORFGainOffset = 0x29
    RTL871X: SetHwReg8723B: bMacPwrCtrlOn=0
    RTL871X: <==== _ReadAdapterInfo8723BS in 300 ms
    RTL871X: Hal_ChannelPlanToRegulation ChannelPlan:0x20,Regulation(2_4G/5G):0x03,0x03
    RTL871X: init_channel_set ChannelPlan ID 20 Chan num:13  
    EXT4-fs (mmcblk0p4): warning: checktime reached, running e2fsck is recommended
    RTL871X: rtw_alloc_macid(eth%d) if1, hwaddr:ff:ff:ff:ff:ff:ff macid:1
    RTL871X: rtw_register_early_suspend
    RTL871X: Init_ODM_ComInfo_8723b(): fab_ver=0 cut_ver=0
    RTL871X: rtw_macaddr_cfg mac addr:80:a5:89:49:6e:81
    RTL871X: bDriverStopped:1, bSurpriseRemoved:0, bup:0, hw_init_completed:0
    RTL871X: rtw_ndev_init(wlan0)
    RTL871X: _rtw_drv_register_netdev, MAC Address (if1) = 80:a5:89:49:6e:81
    ......

 

以上是关于I.MX6 AW-NB177NF WIFi 驱动移植问题的主要内容,如果未能解决你的问题,请参考以下文章

I.MX6 AW-NB177NF wifi reset

I.MX6 AW-NB177NF p2p support

I.MX6 WIFI wireless_tools 移植

i.MX6ULL驱动开发 | 29 - 使用USB WIFI网卡(RTL8188EU)

i.MX6ULL驱动开发 | 29 - 使用USB WIFI网卡(RTL8188EU)

i.MX6ULL驱动开发 | 30 - 使用EC20 4G网卡(移植移远GobiNet驱动)