net: wireless: rockchip_wlan: add rtl8723cs support
authorzzc <zzc@rock-chips.com>
Wed, 5 Apr 2017 08:16:34 +0000 (16:16 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Thu, 6 Apr 2017 04:01:56 +0000 (12:01 +0800)
update rtl8723cs wifi driver to version v5.2.1_21569.20170329_COEX20170214-1500

Change-Id: Iee0c342b4fb44a30be0004a2dcee40dea5e67269
Signed-off-by: zzc <zzc@rock-chips.com>
478 files changed:
drivers/net/wireless/rockchip_wlan/Kconfig
drivers/net/wireless/rockchip_wlan/Makefile
drivers/net/wireless/rockchip_wlan/rtl8723cs/Kconfig [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/Makefile [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/clean [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/core/efuse/rtw_efuse.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_ap.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_beamforming.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_br_ext.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_bt_mp.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_btcoex.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_btcoex_wifionly.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_cmd.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_debug.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_eeprom.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_ieee80211.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_io.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_ioctl_query.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_ioctl_rtl.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_ioctl_set.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_iol.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_mem.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_mi.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_mlme.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_mlme_ext.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_mp.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_mp_ioctl.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_odm.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_p2p.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_pwrctrl.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_recv.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_rf.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_sdio.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_security.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_sreset.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_sta_mgt.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_tdls.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_vht.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_wapi.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_wapi_sms4.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_wlan_util.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_xmit.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/HalPwrSeqCmd.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/btc/halbtc8192e1ant.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/btc/halbtc8192e1ant.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/btc/halbtc8192e2ant.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/btc/halbtc8192e2ant.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/btc/halbtc8703b1ant.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/btc/halbtc8703b1ant.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/btc/halbtc8723b1ant.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/btc/halbtc8723b1ant.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/btc/halbtc8723b2ant.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/btc/halbtc8723b2ant.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/btc/halbtc8723bwifionly.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/btc/halbtc8723bwifionly.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/btc/halbtc8723d1ant.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/btc/halbtc8723d1ant.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/btc/halbtc8723d2ant.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/btc/halbtc8723d2ant.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/btc/halbtc8812a1ant.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/btc/halbtc8812a1ant.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/btc/halbtc8812a2ant.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/btc/halbtc8812a2ant.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/btc/halbtc8821a1ant.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/btc/halbtc8821a1ant.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/btc/halbtc8821a2ant.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/btc/halbtc8821a2ant.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/btc/halbtc8821c1ant.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/btc/halbtc8821c1ant.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/btc/halbtc8821c2ant.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/btc/halbtc8821c2ant.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/btc/halbtc8821cwifionly.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/btc/halbtc8821cwifionly.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/btc/halbtc8822b1ant.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/btc/halbtc8822b1ant.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/btc/halbtc8822b2ant.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/btc/halbtc8822b2ant.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/btc/halbtc8822bwifionly.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/btc/halbtc8822bwifionly.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/btc/halbtcoutsrc.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/btc/mp_precomp.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/efuse/efuse_mask.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/efuse/rtl8703b/HalEfuseMask8703B_PCIE.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/efuse/rtl8703b/HalEfuseMask8703B_PCIE.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/efuse/rtl8703b/HalEfuseMask8703B_SDIO.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/efuse/rtl8703b/HalEfuseMask8703B_SDIO.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/efuse/rtl8703b/HalEfuseMask8703B_USB.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/efuse/rtl8703b/HalEfuseMask8703B_USB.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/hal_btcoex.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/hal_btcoex_wifionly.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/hal_com.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/hal_com_c2h.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/hal_com_phycfg.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/hal_dm.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/hal_dm.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/hal_halmac.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/hal_halmac.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/hal_hci/hal_sdio.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/hal_intf.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/hal_mcc.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/hal_mp.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/hal_phy.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/led/hal_sdio_led.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/halhwimg.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/halphyrf_ap.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/halphyrf_ap.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/halphyrf_ce.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/halphyrf_ce.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/halphyrf_win.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/halphyrf_win.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/mp_precomp.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_acs.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_acs.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_adaptivity.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_adaptivity.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_adc_sampling.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_adc_sampling.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_antdect.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_antdect.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_antdiv.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_antdiv.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_beamforming.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_beamforming.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_ccx.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_ccx.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_cfotracking.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_cfotracking.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_debug.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_debug.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_dfs.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_dfs.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_dig.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_dig.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_dynamic_rx_path.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_dynamic_rx_path.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_dynamicbbpowersaving.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_dynamicbbpowersaving.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_dynamictxpower.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_dynamictxpower.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_edcaturbocheck.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_edcaturbocheck.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_features.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_hwconfig.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_hwconfig.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_interface.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_interface.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_iqk.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_kfree.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_kfree.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_noisemonitor.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_noisemonitor.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_pathdiv.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_pathdiv.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_powertracking_ap.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_powertracking_ap.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_powertracking_ce.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_powertracking_ce.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_powertracking_win.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_powertracking_win.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_pre_define.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_precomp.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_psd.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_psd.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_rainfo.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_rainfo.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_reg.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_regdefine11ac.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_regdefine11n.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/phydm_types.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/rtchnlplan.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/rtchnlplan.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/rtl8703b/halhwimg8703b_bb.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/rtl8703b/halhwimg8703b_bb.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/rtl8703b/halhwimg8703b_fw.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/rtl8703b/halhwimg8703b_fw.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/rtl8703b/halhwimg8703b_mac.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/rtl8703b/halhwimg8703b_mac.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/rtl8703b/halhwimg8703b_rf.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/rtl8703b/halhwimg8703b_rf.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/rtl8703b/halphyrf_8703b.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/rtl8703b/halphyrf_8703b.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/rtl8703b/phydm_regconfig8703b.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/rtl8703b/phydm_regconfig8703b.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/rtl8703b/version_rtl8703b.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/txbf/halcomtxbf.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/txbf/halcomtxbf.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/txbf/haltxbf8192e.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/txbf/haltxbf8192e.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/txbf/haltxbf8814a.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/txbf/haltxbf8814a.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/txbf/haltxbf8822b.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/txbf/haltxbf8822b.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/txbf/haltxbfinterface.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/txbf/haltxbfinterface.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/txbf/haltxbfjaguar.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/txbf/haltxbfjaguar.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/txbf/phydm_hal_txbf_api.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/phydm/txbf/phydm_hal_txbf_api.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/rtl8703b/Hal8703BPwrSeq.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/rtl8703b/hal8703b_fw.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/rtl8703b/hal8703b_fw.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/rtl8703b/rtl8703b_cmd.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/rtl8703b/rtl8703b_dm.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/rtl8703b/rtl8703b_hal_init.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/rtl8703b/rtl8703b_phycfg.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/rtl8703b/rtl8703b_rf6052.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/rtl8703b/rtl8703b_rxdesc.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/rtl8703b/rtl8703b_sreset.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/rtl8703b/sdio/rtl8703bs_led.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/rtl8703b/sdio/rtl8703bs_recv.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/rtl8703b/sdio/rtl8703bs_xmit.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/rtl8703b/sdio/sdio_halinit.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/hal/rtl8703b/sdio/sdio_ops.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/ifcfg-wlan0 [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/Hal8188EPhyCfg.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/Hal8188EPhyReg.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/Hal8188EPwrSeq.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/Hal8188FPhyCfg.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/Hal8188FPhyReg.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/Hal8188FPwrSeq.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/Hal8192EPhyCfg.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/Hal8192EPhyReg.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/Hal8192EPwrSeq.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/Hal8703BPhyCfg.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/Hal8703BPhyReg.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/Hal8703BPwrSeq.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/Hal8723BPhyCfg.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/Hal8723BPhyReg.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/Hal8723BPwrSeq.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/Hal8723DPhyCfg.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/Hal8723DPhyReg.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/Hal8723DPwrSeq.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/Hal8723PwrSeq.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/Hal8812PhyCfg.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/Hal8812PhyReg.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/Hal8812PwrSeq.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/Hal8814PhyCfg.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/Hal8814PhyReg.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/Hal8814PwrSeq.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/Hal8821APwrSeq.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/HalPwrSeqCmd.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/HalVerDef.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/autoconf.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/basic_types.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/byteorder/big_endian.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/byteorder/generic.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/byteorder/little_endian.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/byteorder/swab.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/byteorder/swabb.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/circ_buf.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/cmd_osdep.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/custom_gpio.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/drv_conf.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/drv_types.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/drv_types_ce.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/drv_types_gspi.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/drv_types_linux.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/drv_types_pci.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/drv_types_sdio.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/drv_types_xp.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/ethernet.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/gspi_hal.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/gspi_ops.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/gspi_ops_linux.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/gspi_osintf.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/h2clbk.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/hal_btcoex.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/hal_btcoex_wifionly.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/hal_com.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/hal_com_h2c.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/hal_com_led.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/hal_com_phycfg.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/hal_com_reg.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/hal_data.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/hal_gspi.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/hal_ic_cfg.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/hal_intf.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/hal_pg.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/hal_phy.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/hal_phy_reg.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/hal_sdio.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/ieee80211.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/ieee80211_ext.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/if_ether.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/ip.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/linux/wireless.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/mlme_osdep.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/mp_custom_oid.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/nic_spec.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/osdep_intf.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/osdep_service.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/osdep_service_bsd.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/osdep_service_ce.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/osdep_service_linux.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/osdep_service_xp.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/pci_hal.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/pci_ops.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/pci_osintf.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/recv_osdep.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8188e_cmd.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8188e_dm.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8188e_hal.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8188e_led.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8188e_recv.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8188e_rf.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8188e_spec.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8188e_sreset.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8188e_xmit.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8188f_cmd.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8188f_dm.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8188f_hal.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8188f_led.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8188f_recv.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8188f_rf.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8188f_spec.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8188f_sreset.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8188f_xmit.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8192e_cmd.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8192e_dm.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8192e_hal.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8192e_led.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8192e_recv.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8192e_rf.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8192e_spec.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8192e_sreset.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8192e_xmit.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8703b_cmd.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8703b_dm.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8703b_hal.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8703b_led.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8703b_recv.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8703b_rf.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8703b_spec.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8703b_sreset.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8703b_xmit.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8723b_cmd.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8723b_dm.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8723b_hal.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8723b_led.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8723b_recv.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8723b_rf.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8723b_spec.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8723b_sreset.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8723b_xmit.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8723d_cmd.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8723d_dm.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8723d_hal.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8723d_led.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8723d_lps_poff.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8723d_recv.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8723d_rf.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8723d_spec.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8723d_sreset.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8723d_xmit.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8812a_cmd.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8812a_dm.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8812a_hal.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8812a_led.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8812a_recv.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8812a_rf.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8812a_spec.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8812a_sreset.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8812a_xmit.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8814a_cmd.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8814a_dm.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8814a_hal.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8814a_led.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8814a_recv.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8814a_rf.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8814a_spec.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8814a_sreset.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8814a_xmit.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8821a_spec.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8821a_xmit.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8821c_dm.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8821c_hal.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8821c_spec.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8821ce_hal.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8821cs_hal.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8821cu_hal.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8822b_hal.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8822be_hal.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8822bs_hal.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtl8822bu_hal.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_android.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_ap.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_beamforming.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_br_ext.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_bt_mp.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_btcoex.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_btcoex_wifionly.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_byteorder.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_cmd.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_debug.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_eeprom.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_efuse.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_event.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_ht.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_io.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_ioctl.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_ioctl_query.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_ioctl_rtl.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_ioctl_set.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_iol.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_mcc.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_mem.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_mi.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_mlme.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_mlme_ext.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_mp.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_mp_ioctl.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_mp_phy_regdef.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_odm.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_p2p.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_pwrctrl.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_qos.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_recv.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_rf.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_sdio.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_security.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_sreset.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_tdls.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_version.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_vht.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_wapi.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_wifi_regd.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/rtw_xmit.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/sdio_hal.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/sdio_ops.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/sdio_ops_ce.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/sdio_ops_linux.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/sdio_ops_xp.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/sdio_osintf.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/sta_info.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/usb_hal.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/usb_ops.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/usb_ops_linux.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/usb_osintf.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/usb_vendor_req.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/wifi.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/wlan_bssdef.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/include/xmit_osdep.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/os_dep/linux/custom_gpio_linux.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/os_dep/linux/ioctl_cfg80211.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/os_dep/linux/ioctl_cfg80211.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/os_dep/linux/ioctl_linux.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/os_dep/linux/ioctl_mp.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/os_dep/linux/mlme_linux.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/os_dep/linux/os_intfs.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/os_dep/linux/recv_linux.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/os_dep/linux/rtw_android.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/os_dep/linux/rtw_cfgvendor.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/os_dep/linux/rtw_cfgvendor.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/os_dep/linux/rtw_proc.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/os_dep/linux/rtw_proc.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/os_dep/linux/sdio_intf.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/os_dep/linux/sdio_ops_linux.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/os_dep/linux/wifi_regd.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/os_dep/linux/xmit_linux.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/os_dep/osdep_service.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/platform/custom_country_chplan.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/platform/platform_ARM_SUN50IW1P1_sdio.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/platform/platform_ARM_SUNnI_sdio.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/platform/platform_ARM_SUNxI_sdio.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/platform/platform_ARM_SUNxI_usb.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/platform/platform_ARM_WMT_sdio.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/platform/platform_RTK_DMP_usb.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/platform/platform_arm_act_sdio.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/platform/platform_ops.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/platform/platform_ops.h [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/platform/platform_sprd_sdio.c [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/runwpa [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/rtl8723cs/wlan0dhcp [new file with mode: 0644]
drivers/net/wireless/rockchip_wlan/wifi_sys/rkwifi_sys_iface.c
include/linux/rfkill-wlan.h
net/rfkill/rfkill-wlan.c

index 29d9b76..9d219b6 100644 (file)
@@ -19,7 +19,7 @@ menuconfig RTL_WIRELESS_SOLUTION
 
 source "drivers/net/wireless/rockchip_wlan/rtl8188eu/Kconfig"
 source "drivers/net/wireless/rockchip_wlan/rtl8188fu/Kconfig"
+source "drivers/net/wireless/rockchip_wlan/rtl8723cs/Kconfig"
 source "drivers/net/wireless/rockchip_wlan/rtl8822be/Kconfig"
 
-
 endif # WL_ROCKCHIP
index edf0c6c..36be0ae 100644 (file)
@@ -1,6 +1,7 @@
 obj-$(CONFIG_AP6XXX)   += rkwifi/
 obj-$(CONFIG_RTL8188EU)        += rtl8188eu/
 obj-$(CONFIG_RTL8188FU)        += rtl8188fu/
+obj-$(CONFIG_RTL8723CS)        += rtl8723cs/
 obj-$(CONFIG_RTL8822BE)        += rtl8822be/
 obj-$(CONFIG_WL_ROCKCHIP)      += wifi_sys/rkwifi_sys_iface.o
 obj-$(CONFIG_WL_ROCKCHIP)      += rkwifi/rk_wifi_config.o
diff --git a/drivers/net/wireless/rockchip_wlan/rtl8723cs/Kconfig b/drivers/net/wireless/rockchip_wlan/rtl8723cs/Kconfig
new file mode 100644 (file)
index 0000000..4986677
--- /dev/null
@@ -0,0 +1,4 @@
+config RTL8723CS
+       tristate "Realtek 8723C SDIO or SPI WiFi"
+       ---help---
+         Help message of RTL8723CS
diff --git a/drivers/net/wireless/rockchip_wlan/rtl8723cs/Makefile b/drivers/net/wireless/rockchip_wlan/rtl8723cs/Makefile
new file mode 100644 (file)
index 0000000..c5e0b63
--- /dev/null
@@ -0,0 +1,1911 @@
+EXTRA_CFLAGS += $(USER_EXTRA_CFLAGS)
+EXTRA_CFLAGS += -O1
+#EXTRA_CFLAGS += -O3
+#EXTRA_CFLAGS += -Wall
+#EXTRA_CFLAGS += -Wextra
+#EXTRA_CFLAGS += -Werror
+#EXTRA_CFLAGS += -pedantic
+#EXTRA_CFLAGS += -Wshadow -Wpointer-arith -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes
+
+EXTRA_CFLAGS += -Wno-unused-variable
+EXTRA_CFLAGS += -Wno-unused-value
+EXTRA_CFLAGS += -Wno-unused-label
+EXTRA_CFLAGS += -Wno-unused-parameter
+EXTRA_CFLAGS += -Wno-unused-function
+EXTRA_CFLAGS += -Wno-unused
+#EXTRA_CFLAGS += -Wno-uninitialized
+
+GCC_VER_49 := $(shell echo `$(CC) -dumpversion | cut -f1-2 -d.` \>= 4.9 | bc )
+ifeq ($(GCC_VER_49),1)
+EXTRA_CFLAGS += -Wno-date-time # Fix compile error && warning on gcc 4.9 and later
+endif
+
+EXTRA_CFLAGS += -I$(src)/include
+EXTRA_CFLAGS += -I$(src)/hal/phydm
+
+EXTRA_LDFLAGS += --strip-debug
+
+CONFIG_AUTOCFG_CP = n
+
+########################## WIFI IC ############################
+CONFIG_MULTIDRV = n
+CONFIG_RTL8188E = n
+CONFIG_RTL8812A = n
+CONFIG_RTL8821A = n
+CONFIG_RTL8192E = n
+CONFIG_RTL8723B = n
+CONFIG_RTL8814A = n
+CONFIG_RTL8723C = y
+CONFIG_RTL8188F = n
+CONFIG_RTL8822B = n
+CONFIG_RTL8723D = n
+CONFIG_RTL8821C = n
+######################### Interface ###########################
+CONFIG_USB_HCI = n
+CONFIG_PCI_HCI = n
+CONFIG_SDIO_HCI = y
+CONFIG_GSPI_HCI = n
+########################## Features ###########################
+CONFIG_MP_INCLUDED = y
+CONFIG_POWER_SAVING = y
+CONFIG_USB_AUTOSUSPEND = n
+CONFIG_HW_PWRP_DETECTION = n
+CONFIG_WIFI_TEST = n
+CONFIG_BT_COEXIST = y
+CONFIG_INTEL_WIDI = n
+CONFIG_WAPI_SUPPORT = n
+CONFIG_EFUSE_CONFIG_FILE = y
+CONFIG_EXT_CLK = n
+CONFIG_TRAFFIC_PROTECT = y
+CONFIG_LOAD_PHY_PARA_FROM_FILE = y
+CONFIG_TXPWR_BY_RATE_EN = n
+CONFIG_TXPWR_LIMIT_EN = n
+CONFIG_RTW_ADAPTIVITY_EN = disable
+CONFIG_RTW_ADAPTIVITY_MODE = normal
+CONFIG_SIGNAL_SCALE_MAPPING = n
+CONFIG_80211W = n
+CONFIG_REDUCE_TX_CPU_LOADING = n
+CONFIG_BR_EXT = y
+CONFIG_TDLS = n
+CONFIG_WIFI_MONITOR = n
+CONFIG_MCC_MODE = n
+CONFIG_APPEND_VENDOR_IE_ENABLE = n
+CONFIG_RTW_NAPI = y
+CONFIG_RTW_GRO = y
+########################## Debug ###########################
+CONFIG_RTW_DEBUG = n
+# default log level is _DRV_INFO_ = 4,
+# please refer to "How_to_set_driver_debug_log_level.doc" to set the available level.
+CONFIG_RTW_LOG_LEVEL = 4
+######################## Wake On Lan ##########################
+CONFIG_WOWLAN = n
+CONFIG_GPIO_WAKEUP = n
+CONFIG_DEFAULT_PATTERNS_EN = n
+CONFIG_WAKEUP_GPIO_IDX = default
+CONFIG_HIGH_ACTIVE = n
+CONFIG_PNO_SUPPORT = n
+CONFIG_PNO_SET_DEBUG = n
+CONFIG_AP_WOWLAN = n
+######### Notify SDIO Host Keep Power During Syspend ##########
+CONFIG_RTW_SDIO_PM_KEEP_POWER = y
+###################### MP HW TX MODE FOR VHT #######################
+CONFIG_MP_VHT_HW_TX_MODE = n
+###################### Platform Related #######################
+CONFIG_PLATFORM_I386_PC = n
+CONFIG_PLATFORM_ANDROID_X86 = n
+CONFIG_PLATFORM_ANDROID_INTEL_X86 = n
+CONFIG_PLATFORM_JB_X86 = n
+CONFIG_PLATFORM_ARM_S3C2K4 = n
+CONFIG_PLATFORM_ARM_PXA2XX = n
+CONFIG_PLATFORM_ARM_S3C6K4 = n
+CONFIG_PLATFORM_MIPS_RMI = n
+CONFIG_PLATFORM_RTD2880B = n
+CONFIG_PLATFORM_MIPS_AR9132 = n
+CONFIG_PLATFORM_RTK_DMP = n
+CONFIG_PLATFORM_MIPS_PLM = n
+CONFIG_PLATFORM_MSTAR389 = n
+CONFIG_PLATFORM_MT53XX = n
+CONFIG_PLATFORM_ARM_MX51_241H = n
+CONFIG_PLATFORM_FS_MX61 = n
+CONFIG_PLATFORM_ACTIONS_ATJ227X = n
+CONFIG_PLATFORM_TEGRA3_CARDHU = n
+CONFIG_PLATFORM_TEGRA4_DALMORE = n
+CONFIG_PLATFORM_ARM_TCC8900 = n
+CONFIG_PLATFORM_ARM_TCC8920 = n
+CONFIG_PLATFORM_ARM_TCC8920_JB42 = n
+CONFIG_PLATFORM_ARM_TCC8930_JB42 = n
+CONFIG_PLATFORM_ARM_RK2818 = n
+CONFIG_PLATFORM_ARM_RK3066 = n
+CONFIG_PLATFORM_ARM_RK3188 = y
+CONFIG_PLATFORM_ARM_URBETTER = n
+CONFIG_PLATFORM_ARM_TI_PANDA = n
+CONFIG_PLATFORM_MIPS_JZ4760 = n
+CONFIG_PLATFORM_DMP_PHILIPS = n
+CONFIG_PLATFORM_MSTAR_TITANIA12 = n
+CONFIG_PLATFORM_MSTAR = n
+CONFIG_PLATFORM_SZEBOOK = n
+CONFIG_PLATFORM_ARM_SUNxI = n
+CONFIG_PLATFORM_ARM_SUN6I = n
+CONFIG_PLATFORM_ARM_SUN7I = n
+CONFIG_PLATFORM_ARM_SUN8I_W3P1 = n
+CONFIG_PLATFORM_ARM_SUN8I_W5P1 = n
+CONFIG_PLATFORM_ACTIONS_ATM702X = n
+CONFIG_PLATFORM_ACTIONS_ATV5201 = n
+CONFIG_PLATFORM_ACTIONS_ATM705X = n
+CONFIG_PLATFORM_ARM_SUN50IW1P1 = n
+CONFIG_PLATFORM_ARM_RTD299X = n
+CONFIG_PLATFORM_ARM_SPREADTRUM_6820 = n
+CONFIG_PLATFORM_ARM_SPREADTRUM_8810 = n
+CONFIG_PLATFORM_ARM_WMT = n
+CONFIG_PLATFORM_TI_DM365 = n
+CONFIG_PLATFORM_MOZART = n
+CONFIG_PLATFORM_RTK119X = n
+CONFIG_PLATFORM_RTK129X = n
+CONFIG_PLATFORM_NOVATEK_NT72668 = n
+CONFIG_PLATFORM_HISILICON = n
+CONFIG_PLATFORM_NV_TK1 = n
+###############################################################
+
+CONFIG_DRVEXT_MODULE = n
+
+export TopDIR ?= $(shell pwd)
+
+########### COMMON  #################################
+ifeq ($(CONFIG_GSPI_HCI), y)
+HCI_NAME = gspi
+endif
+
+ifeq ($(CONFIG_SDIO_HCI), y)
+HCI_NAME = sdio
+endif
+
+ifeq ($(CONFIG_USB_HCI), y)
+HCI_NAME = usb
+endif
+
+ifeq ($(CONFIG_PCI_HCI), y)
+HCI_NAME = pci
+endif
+
+
+_OS_INTFS_FILES :=     os_dep/osdep_service.o \
+                       os_dep/linux/os_intfs.o \
+                       os_dep/linux/$(HCI_NAME)_intf.o \
+                       os_dep/linux/$(HCI_NAME)_ops_linux.o \
+                       os_dep/linux/ioctl_linux.o \
+                       os_dep/linux/xmit_linux.o \
+                       os_dep/linux/mlme_linux.o \
+                       os_dep/linux/recv_linux.o \
+                       os_dep/linux/ioctl_cfg80211.o \
+                       os_dep/linux/rtw_cfgvendor.o \
+                       os_dep/linux/wifi_regd.o \
+                       os_dep/linux/rtw_android.o \
+                       os_dep/linux/rtw_proc.o
+
+ifeq ($(CONFIG_MP_INCLUDED), y)
+_OS_INTFS_FILES += os_dep/linux/ioctl_mp.o
+endif
+
+ifeq ($(CONFIG_SDIO_HCI), y)
+_OS_INTFS_FILES += os_dep/linux/custom_gpio_linux.o
+_OS_INTFS_FILES += os_dep/linux/$(HCI_NAME)_ops_linux.o
+endif
+
+ifeq ($(CONFIG_GSPI_HCI), y)
+_OS_INTFS_FILES += os_dep/linux/custom_gpio_linux.o
+_OS_INTFS_FILES += os_dep/linux/$(HCI_NAME)_ops_linux.o
+endif
+
+
+_HAL_INTFS_FILES :=    hal/hal_intf.o \
+                       hal/hal_com.o \
+                       hal/hal_com_phycfg.o \
+                       hal/hal_phy.o \
+                       hal/hal_dm.o \
+                       hal/hal_btcoex_wifionly.o \
+                       hal/hal_btcoex.o \
+                       hal/hal_mp.o \
+                       hal/hal_mcc.o \
+                       hal/hal_hci/hal_$(HCI_NAME).o \
+                       hal/led/hal_$(HCI_NAME)_led.o
+
+                       
+_OUTSRC_FILES := hal/phydm/phydm_debug.o       \
+               hal/phydm/phydm_antdiv.o\
+               hal/phydm/phydm_antdect.o\
+               hal/phydm/phydm_interface.o\
+               hal/phydm/phydm_hwconfig.o\
+               hal/phydm/phydm.o\
+               hal/phydm/halphyrf_ce.o\
+               hal/phydm/phydm_edcaturbocheck.o\
+               hal/phydm/phydm_dig.o\
+               hal/phydm/phydm_pathdiv.o\
+               hal/phydm/phydm_rainfo.o\
+               hal/phydm/phydm_dynamicbbpowersaving.o\
+               hal/phydm/phydm_powertracking_ce.o\
+               hal/phydm/phydm_dynamictxpower.o\
+               hal/phydm/phydm_adaptivity.o\
+               hal/phydm/phydm_cfotracking.o\
+               hal/phydm/phydm_noisemonitor.o\
+               hal/phydm/phydm_acs.o\
+               hal/phydm/phydm_beamforming.o\
+               hal/phydm/phydm_dfs.o\
+               hal/phydm/txbf/halcomtxbf.o\
+               hal/phydm/txbf/haltxbfinterface.o\
+               hal/phydm/txbf/phydm_hal_txbf_api.o\
+               hal/phydm/phydm_adc_sampling.o\
+               hal/phydm/phydm_kfree.o\
+               hal/phydm/phydm_ccx.o\
+               hal/phydm/phydm_psd.o
+
+EXTRA_CFLAGS += -I$(src)/platform
+_PLATFORM_FILES := platform/platform_ops.o
+
+EXTRA_CFLAGS += -I$(src)/hal/btc
+_OUTSRC_FILES += hal/btc/halbtc8723bwifionly.o \
+                               hal/btc/halbtc8822bwifionly.o \
+                               hal/btc/halbtc8821cwifionly.o
+ifeq ($(CONFIG_BT_COEXIST), y)
+_OUTSRC_FILES += hal/btc/halbtc8192e1ant.o \
+                               hal/btc/halbtc8192e2ant.o \
+                               hal/btc/halbtc8723b1ant.o \
+                               hal/btc/halbtc8723b2ant.o \
+                               hal/btc/halbtc8812a1ant.o \
+                               hal/btc/halbtc8812a2ant.o \
+                               hal/btc/halbtc8821a1ant.o \
+                               hal/btc/halbtc8821a2ant.o \
+                               hal/btc/halbtc8703b1ant.o \
+                               hal/btc/halbtc8723d1ant.o \
+                               hal/btc/halbtc8723d2ant.o \
+                               hal/btc/halbtc8822b1ant.o \
+                               hal/btc/halbtc8822b2ant.o \
+                               hal/btc/halbtc8821c1ant.o \
+                               hal/btc/halbtc8821c2ant.o
+endif
+
+
+########### HAL_RTL8188E #################################
+ifeq ($(CONFIG_RTL8188E), y)
+
+RTL871X = rtl8188e
+ifeq ($(CONFIG_SDIO_HCI), y)
+MODULE_NAME = 8189es
+endif
+
+ifeq ($(CONFIG_GSPI_HCI), y)
+MODULE_NAME = 8189es
+endif
+
+ifeq ($(CONFIG_USB_HCI), y)
+MODULE_NAME = 8188eu
+endif
+
+ifeq ($(CONFIG_PCI_HCI), y)
+MODULE_NAME = 8188ee
+endif
+EXTRA_CFLAGS += -DCONFIG_RTL8188E
+
+_HAL_INTFS_FILES +=    hal/HalPwrSeqCmd.o \
+                                       hal/$(RTL871X)/Hal8188EPwrSeq.o\
+                                       hal/$(RTL871X)/$(RTL871X)_xmit.o\
+                                       hal/$(RTL871X)/$(RTL871X)_sreset.o
+
+_HAL_INTFS_FILES +=    hal/$(RTL871X)/$(RTL871X)_hal_init.o \
+                       hal/$(RTL871X)/$(RTL871X)_phycfg.o \
+                       hal/$(RTL871X)/$(RTL871X)_rf6052.o \
+                       hal/$(RTL871X)/$(RTL871X)_dm.o \
+                       hal/$(RTL871X)/$(RTL871X)_rxdesc.o \
+                       hal/$(RTL871X)/$(RTL871X)_cmd.o \
+                       hal/$(RTL871X)/hal8188e_s_fw.o \
+                       hal/$(RTL871X)/hal8188e_t_fw.o \
+                       hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_halinit.o \
+                       hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_led.o \
+                       hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_xmit.o \
+                       hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_recv.o
+
+ifeq ($(CONFIG_SDIO_HCI), y)
+_HAL_INTFS_FILES += hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_ops.o
+else
+ifeq ($(CONFIG_GSPI_HCI), y)
+_HAL_INTFS_FILES += hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_ops.o
+else
+_HAL_INTFS_FILES += hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_ops_linux.o
+endif
+endif
+
+ifeq ($(CONFIG_USB_HCI), y)
+_HAL_INTFS_FILES +=hal/efuse/$(RTL871X)/HalEfuseMask8188E_USB.o
+endif
+ifeq ($(CONFIG_PCI_HCI), y)
+_HAL_INTFS_FILES +=hal/efuse/$(RTL871X)/HalEfuseMask8188E_PCIE.o
+endif
+ifeq ($(CONFIG_SDIO_HCI), y)
+_HAL_INTFS_FILES +=hal/efuse/$(RTL871X)/HalEfuseMask8188E_SDIO.o
+endif
+
+#hal/OUTSRC/$(RTL871X)/Hal8188EFWImg_CE.o
+_OUTSRC_FILES += hal/phydm/$(RTL871X)/halhwimg8188e_mac.o\
+               hal/phydm/$(RTL871X)/halhwimg8188e_bb.o\
+               hal/phydm/$(RTL871X)/halhwimg8188e_rf.o\
+               hal/phydm/$(RTL871X)/halphyrf_8188e_ce.o\
+               hal/phydm/$(RTL871X)/phydm_regconfig8188e.o\
+               hal/phydm/$(RTL871X)/hal8188erateadaptive.o\
+               hal/phydm/$(RTL871X)/phydm_rtl8188e.o
+
+endif
+
+########### HAL_RTL8192E #################################
+ifeq ($(CONFIG_RTL8192E), y)
+
+RTL871X = rtl8192e
+ifeq ($(CONFIG_SDIO_HCI), y)
+MODULE_NAME = 8192es
+endif
+
+ifeq ($(CONFIG_USB_HCI), y)
+MODULE_NAME = 8192eu
+endif
+
+ifeq ($(CONFIG_PCI_HCI), y)
+MODULE_NAME = 8192ee
+endif
+EXTRA_CFLAGS += -DCONFIG_RTL8192E
+_HAL_INTFS_FILES += hal/HalPwrSeqCmd.o \
+                                       hal/$(RTL871X)/Hal8192EPwrSeq.o\
+                                       hal/$(RTL871X)/$(RTL871X)_xmit.o\
+                                       hal/$(RTL871X)/$(RTL871X)_sreset.o
+
+_HAL_INTFS_FILES +=    hal/$(RTL871X)/$(RTL871X)_hal_init.o \
+                       hal/$(RTL871X)/$(RTL871X)_phycfg.o \
+                       hal/$(RTL871X)/$(RTL871X)_rf6052.o \
+                       hal/$(RTL871X)/$(RTL871X)_dm.o \
+                       hal/$(RTL871X)/$(RTL871X)_rxdesc.o \
+                       hal/$(RTL871X)/$(RTL871X)_cmd.o \
+                       hal/$(RTL871X)/hal8192e_fw.o \
+                       hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_halinit.o \
+                       hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_led.o \
+                       hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_xmit.o \
+                       hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_recv.o
+
+ifeq ($(CONFIG_SDIO_HCI), y)
+_HAL_INTFS_FILES += hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_ops.o
+else
+ifeq ($(CONFIG_GSPI_HCI), y)
+_HAL_INTFS_FILES += hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_ops.o
+else
+_HAL_INTFS_FILES += hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_ops_linux.o
+endif
+endif
+
+ifeq ($(CONFIG_USB_HCI), y)
+_HAL_INTFS_FILES +=hal/efuse/$(RTL871X)/HalEfuseMask8192E_USB.o
+endif
+ifeq ($(CONFIG_PCI_HCI), y)
+_HAL_INTFS_FILES +=hal/efuse/$(RTL871X)/HalEfuseMask8192E_PCIE.o
+endif
+
+#hal/OUTSRC/$(RTL871X)/HalHWImg8188E_FW.o
+_OUTSRC_FILES += hal/phydm/$(RTL871X)/halhwimg8192e_mac.o\
+               hal/phydm/$(RTL871X)/halhwimg8192e_bb.o\
+               hal/phydm/$(RTL871X)/halhwimg8192e_rf.o\
+               hal/phydm/$(RTL871X)/halphyrf_8192e_ce.o\
+               hal/phydm/$(RTL871X)/phydm_regconfig8192e.o\
+               hal/phydm/$(RTL871X)/phydm_rtl8192e.o
+
+endif
+
+########### HAL_RTL8812A_RTL8821A #################################
+
+ifneq ($(CONFIG_RTL8812A)_$(CONFIG_RTL8821A), n_n)
+
+RTL871X = rtl8812a
+ifeq ($(CONFIG_USB_HCI), y)
+MODULE_NAME = 8812au
+endif
+ifeq ($(CONFIG_PCI_HCI), y)
+MODULE_NAME = 8812ae
+endif
+ifeq ($(CONFIG_SDIO_HCI), y)
+MODULE_NAME = 8812as
+endif
+
+_HAL_INTFS_FILES +=  hal/HalPwrSeqCmd.o \
+                                       hal/$(RTL871X)/Hal8812PwrSeq.o \
+                                       hal/$(RTL871X)/Hal8821APwrSeq.o\
+                                       hal/$(RTL871X)/$(RTL871X)_xmit.o\
+                                       hal/$(RTL871X)/$(RTL871X)_sreset.o
+
+_HAL_INTFS_FILES +=    hal/$(RTL871X)/$(RTL871X)_hal_init.o \
+                       hal/$(RTL871X)/$(RTL871X)_phycfg.o \
+                       hal/$(RTL871X)/$(RTL871X)_rf6052.o \
+                       hal/$(RTL871X)/$(RTL871X)_dm.o \
+                       hal/$(RTL871X)/$(RTL871X)_rxdesc.o \
+                       hal/$(RTL871X)/$(RTL871X)_cmd.o \
+                       hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_halinit.o \
+                       hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_led.o \
+                       hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_xmit.o \
+                       hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_recv.o
+
+ifeq ($(CONFIG_SDIO_HCI), y)
+_HAL_INTFS_FILES += hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_ops.o
+else
+ifeq ($(CONFIG_GSPI_HCI), y)
+_HAL_INTFS_FILES += hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_ops.o
+else
+_HAL_INTFS_FILES += hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_ops_linux.o
+endif
+endif
+
+ifeq ($(CONFIG_RTL8812A), y)
+ifeq ($(CONFIG_USB_HCI), y)
+_HAL_INTFS_FILES +=hal/efuse/$(RTL871X)/HalEfuseMask8812A_USB.o
+endif
+ifeq ($(CONFIG_PCI_HCI), y)
+_HAL_INTFS_FILES +=hal/efuse/$(RTL871X)/HalEfuseMask8812A_PCIE.o
+endif
+endif
+ifeq ($(CONFIG_RTL8821A), y)
+ifeq ($(CONFIG_USB_HCI), y)
+_HAL_INTFS_FILES +=hal/efuse/$(RTL871X)/HalEfuseMask8821A_USB.o
+endif
+ifeq ($(CONFIG_PCI_HCI), y)
+_HAL_INTFS_FILES +=hal/efuse/$(RTL871X)/HalEfuseMask8821A_PCIE.o
+endif
+endif
+
+ifeq ($(CONFIG_RTL8812A), y)
+EXTRA_CFLAGS += -DCONFIG_RTL8812A
+_HAL_INTFS_FILES +=    hal/rtl8812a/hal8812a_fw.o
+
+_OUTSRC_FILES += hal/phydm/$(RTL871X)/halhwimg8812a_mac.o\
+               hal/phydm/$(RTL871X)/halhwimg8812a_bb.o\
+               hal/phydm/$(RTL871X)/halhwimg8812a_rf.o\
+               hal/phydm/$(RTL871X)/halphyrf_8812a_ce.o\
+               hal/phydm/$(RTL871X)/phydm_regconfig8812a.o\
+               hal/phydm/$(RTL871X)/phydm_rtl8812a.o\
+               hal/phydm/txbf/haltxbfjaguar.o
+endif
+
+ifeq ($(CONFIG_RTL8821A), y)
+
+ifeq ($(CONFIG_RTL8812A), n)
+
+RTL871X = rtl8821a
+ifeq ($(CONFIG_USB_HCI), y)
+ifeq ($(CONFIG_BT_COEXIST), y)
+MODULE_NAME := 8821au
+else
+MODULE_NAME := 8811au
+endif
+endif
+ifeq ($(CONFIG_PCI_HCI), y)
+MODULE_NAME := 8821ae
+endif
+ifeq ($(CONFIG_SDIO_HCI), y)
+MODULE_NAME := 8821as
+endif
+
+endif
+
+EXTRA_CFLAGS += -DCONFIG_RTL8821A
+
+_HAL_INTFS_FILES +=    hal/rtl8812a/hal8821a_fw.o
+_OUTSRC_FILES += hal/phydm/rtl8821a/halhwimg8821a_mac.o\
+               hal/phydm/rtl8821a/halhwimg8821a_bb.o\
+               hal/phydm/rtl8821a/halhwimg8821a_rf.o\
+               hal/phydm/rtl8812a/halphyrf_8812a_ce.o\
+               hal/phydm/rtl8821a/halphyrf_8821a_ce.o\
+               hal/phydm/rtl8821a/phydm_regconfig8821a.o\
+               hal/phydm/rtl8821a/phydm_rtl8821a.o\
+               hal/phydm/rtl8821a/phydm_iqk_8821a_ce.o\
+               hal/phydm/txbf/haltxbfjaguar.o
+               
+endif
+
+endif
+
+########### HAL_RTL8723B #################################
+ifeq ($(CONFIG_RTL8723B), y)
+
+RTL871X = rtl8723b
+ifeq ($(CONFIG_USB_HCI), y)
+MODULE_NAME = 8723bu
+endif
+ifeq ($(CONFIG_PCI_HCI), y)
+MODULE_NAME = 8723be
+endif
+ifeq ($(CONFIG_SDIO_HCI), y)
+MODULE_NAME = 8723bs
+endif
+
+EXTRA_CFLAGS += -DCONFIG_RTL8723B
+
+_HAL_INTFS_FILES += hal/HalPwrSeqCmd.o \
+                                       hal/$(RTL871X)/Hal8723BPwrSeq.o\
+                                       hal/$(RTL871X)/$(RTL871X)_sreset.o
+
+_HAL_INTFS_FILES +=    hal/$(RTL871X)/$(RTL871X)_hal_init.o \
+                       hal/$(RTL871X)/$(RTL871X)_phycfg.o \
+                       hal/$(RTL871X)/$(RTL871X)_rf6052.o \
+                       hal/$(RTL871X)/$(RTL871X)_dm.o \
+                       hal/$(RTL871X)/$(RTL871X)_rxdesc.o \
+                       hal/$(RTL871X)/$(RTL871X)_cmd.o \
+                       hal/$(RTL871X)/hal8723b_fw.o
+
+_HAL_INTFS_FILES +=    \
+                       hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_halinit.o \
+                       hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_led.o \
+                       hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_xmit.o \
+                       hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_recv.o
+
+ifeq ($(CONFIG_PCI_HCI), y)
+_HAL_INTFS_FILES += hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_ops_linux.o
+else
+_HAL_INTFS_FILES += hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_ops.o
+endif
+
+ifeq ($(CONFIG_USB_HCI), y)
+_HAL_INTFS_FILES +=hal/efuse/$(RTL871X)/HalEfuseMask8723B_USB.o
+endif
+ifeq ($(CONFIG_PCI_HCI), y)
+_HAL_INTFS_FILES +=hal/efuse/$(RTL871X)/HalEfuseMask8723B_PCIE.o
+endif
+
+_OUTSRC_FILES += hal/phydm/$(RTL871X)/halhwimg8723b_bb.o\
+                                                               hal/phydm/$(RTL871X)/halhwimg8723b_mac.o\
+                                                               hal/phydm/$(RTL871X)/halhwimg8723b_rf.o\
+                                                               hal/phydm/$(RTL871X)/halhwimg8723b_mp.o\
+                                                               hal/phydm/$(RTL871X)/phydm_regconfig8723b.o\
+                                                               hal/phydm/$(RTL871X)/halphyrf_8723b_ce.o\
+                                                               hal/phydm/$(RTL871X)/phydm_rtl8723b.o
+
+endif
+
+########### HAL_RTL8814A #################################
+ifeq ($(CONFIG_RTL8814A), y)
+## ADD NEW VHT MP HW TX MODE ##
+#EXTRA_CFLAGS += -DCONFIG_MP_VHT_HW_TX_MODE
+#CONFIG_MP_VHT_HW_TX_MODE = y
+##########################################
+RTL871X = rtl8814a
+ifeq ($(CONFIG_USB_HCI), y)
+MODULE_NAME = 8814au
+endif
+ifeq ($(CONFIG_PCI_HCI), y)
+MODULE_NAME = 8814ae
+endif
+ifeq ($(CONFIG_SDIO_HCI), y)
+MODULE_NAME = 8814as
+endif
+
+EXTRA_CFLAGS += -DCONFIG_RTL8814A
+
+_HAL_INTFS_FILES +=  hal/HalPwrSeqCmd.o \
+                                       hal/$(RTL871X)/Hal8814PwrSeq.o \
+                                       hal/$(RTL871X)/$(RTL871X)_xmit.o\
+                                       hal/$(RTL871X)/$(RTL871X)_sreset.o
+
+_HAL_INTFS_FILES +=    hal/$(RTL871X)/$(RTL871X)_hal_init.o \
+                       hal/$(RTL871X)/$(RTL871X)_phycfg.o \
+                       hal/$(RTL871X)/$(RTL871X)_rf6052.o \
+                       hal/$(RTL871X)/$(RTL871X)_dm.o \
+                       hal/$(RTL871X)/$(RTL871X)_rxdesc.o \
+                       hal/$(RTL871X)/$(RTL871X)_cmd.o \
+                       hal/$(RTL871X)/hal8814a_fw.o
+
+
+_HAL_INTFS_FILES +=    \
+                       hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_halinit.o \
+                       hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_led.o \
+                       hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_xmit.o \
+                       hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_recv.o
+
+ifeq ($(CONFIG_SDIO_HCI), y)
+_HAL_INTFS_FILES += hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_ops.o
+else
+ifeq ($(CONFIG_GSPI_HCI), y)
+_HAL_INTFS_FILES += hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_ops.o
+else
+_HAL_INTFS_FILES += hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_ops_linux.o
+endif
+endif
+
+ifeq ($(CONFIG_USB_HCI), y)
+_HAL_INTFS_FILES +=hal/efuse/$(RTL871X)/HalEfuseMask8814A_USB.o
+endif
+ifeq ($(CONFIG_PCI_HCI), y)
+_HAL_INTFS_FILES +=hal/efuse/$(RTL871X)/HalEfuseMask8814A_PCIE.o
+endif
+
+_OUTSRC_FILES += hal/phydm/$(RTL871X)/halhwimg8814a_bb.o\
+                                                               hal/phydm/$(RTL871X)/halhwimg8814a_mac.o\
+                                                               hal/phydm/$(RTL871X)/halhwimg8814a_rf.o\
+                                                               hal/phydm/$(RTL871X)/phydm_iqk_8814a.o\
+                                                               hal/phydm/$(RTL871X)/phydm_regconfig8814a.o\
+                                                               hal/phydm/$(RTL871X)/halphyrf_8814a_ce.o\
+                                                               hal/phydm/$(RTL871X)/phydm_rtl8814a.o\
+                                                               hal/phydm/txbf/haltxbf8814a.o
+
+endif
+
+########### HAL_RTL8723C #################################
+ifeq ($(CONFIG_RTL8723C), y)
+
+RTL871X = rtl8703b
+ifeq ($(CONFIG_USB_HCI), y)
+MODULE_NAME = 8723cu
+MODULE_SUB_NAME = 8703bu
+endif
+ifeq ($(CONFIG_PCI_HCI), y)
+MODULE_NAME = 8723ce
+MODULE_SUB_NAME = 8703be
+endif
+ifeq ($(CONFIG_SDIO_HCI), y)
+MODULE_NAME = 8723cs
+MODULE_SUB_NAME = 8703bs
+endif
+
+EXTRA_CFLAGS += -DCONFIG_RTL8703B
+
+_HAL_INTFS_FILES += hal/HalPwrSeqCmd.o \
+                                       hal/$(RTL871X)/Hal8703BPwrSeq.o\
+                                       hal/$(RTL871X)/$(RTL871X)_sreset.o
+
+_HAL_INTFS_FILES +=    hal/$(RTL871X)/$(RTL871X)_hal_init.o \
+                       hal/$(RTL871X)/$(RTL871X)_phycfg.o \
+                       hal/$(RTL871X)/$(RTL871X)_rf6052.o \
+                       hal/$(RTL871X)/$(RTL871X)_dm.o \
+                       hal/$(RTL871X)/$(RTL871X)_rxdesc.o \
+                       hal/$(RTL871X)/$(RTL871X)_cmd.o \
+                       hal/$(RTL871X)/hal8703b_fw.o
+
+_HAL_INTFS_FILES +=    \
+                       hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_halinit.o \
+                       hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_SUB_NAME)_led.o \
+                       hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_SUB_NAME)_xmit.o \
+                       hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_SUB_NAME)_recv.o
+
+ifeq ($(CONFIG_PCI_HCI), y)
+_HAL_INTFS_FILES += hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_ops_linux.o
+else
+_HAL_INTFS_FILES += hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_ops.o
+endif
+
+ifeq ($(CONFIG_USB_HCI), y)
+_HAL_INTFS_FILES +=hal/efuse/$(RTL871X)/HalEfuseMask8703B_USB.o
+endif
+ifeq ($(CONFIG_PCI_HCI), y)
+_HAL_INTFS_FILES +=hal/efuse/$(RTL871X)/HalEfuseMask8703B_PCIE.o
+endif
+
+_OUTSRC_FILES += hal/phydm/$(RTL871X)/halhwimg8703b_bb.o\
+                                                               hal/phydm/$(RTL871X)/halhwimg8703b_mac.o\
+                                                               hal/phydm/$(RTL871X)/halhwimg8703b_rf.o\
+                                                               hal/phydm/$(RTL871X)/phydm_regconfig8703b.o\
+                                                               hal/phydm/$(RTL871X)/halphyrf_8703b.o
+endif
+
+########### HAL_RTL8723D #################################
+ifeq ($(CONFIG_RTL8723D), y)
+
+RTL871X = rtl8723d
+ifeq ($(CONFIG_USB_HCI), y)
+MODULE_NAME = 8723du
+MODULE_SUB_NAME = 8723du
+endif
+ifeq ($(CONFIG_PCI_HCI), y)
+MODULE_NAME = 8723de
+MODULE_SUB_NAME = 8723de
+endif
+ifeq ($(CONFIG_SDIO_HCI), y)
+MODULE_NAME = 8723ds
+MODULE_SUB_NAME = 8723ds
+endif
+
+EXTRA_CFLAGS += -DCONFIG_RTL8723D
+
+_HAL_INTFS_FILES += hal/HalPwrSeqCmd.o \
+                                       hal/$(RTL871X)/Hal8723DPwrSeq.o\
+                                       hal/$(RTL871X)/$(RTL871X)_sreset.o
+
+_HAL_INTFS_FILES +=    hal/$(RTL871X)/$(RTL871X)_hal_init.o \
+                       hal/$(RTL871X)/$(RTL871X)_phycfg.o \
+                       hal/$(RTL871X)/$(RTL871X)_rf6052.o \
+                       hal/$(RTL871X)/$(RTL871X)_dm.o \
+                       hal/$(RTL871X)/$(RTL871X)_rxdesc.o \
+                       hal/$(RTL871X)/$(RTL871X)_cmd.o \
+                       hal/$(RTL871X)/hal8723d_fw.o \
+                       hal/$(RTL871X)/$(RTL871X)_lps_poff.o
+
+
+_HAL_INTFS_FILES +=    \
+                       hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_halinit.o \
+                       hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_SUB_NAME)_led.o \
+                       hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_SUB_NAME)_xmit.o \
+                       hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_SUB_NAME)_recv.o
+
+ifeq ($(CONFIG_PCI_HCI), y)
+_HAL_INTFS_FILES += hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_ops_linux.o
+else
+_HAL_INTFS_FILES += hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_ops.o
+endif
+
+ifeq ($(CONFIG_USB_HCI), y)
+_HAL_INTFS_FILES +=hal/efuse/$(RTL871X)/HalEfuseMask8723D_USB.o
+endif
+ifeq ($(CONFIG_PCI_HCI), y)
+_HAL_INTFS_FILES +=hal/efuse/$(RTL871X)/HalEfuseMask8723D_PCIE.o
+endif
+
+_OUTSRC_FILES += hal/phydm/$(RTL871X)/halhwimg8723d_bb.o\
+                                                               hal/phydm/$(RTL871X)/halhwimg8723d_mac.o\
+                                                               hal/phydm/$(RTL871X)/halhwimg8723d_rf.o\
+                                                               hal/phydm/$(RTL871X)/phydm_regconfig8723d.o\
+                                                               hal/phydm/$(RTL871X)/phydm_rtl8723d.o\
+                                                               hal/phydm/$(RTL871X)/halphyrf_8723d.o
+endif
+
+########### HAL_RTL8188F #################################
+ifeq ($(CONFIG_RTL8188F), y)
+
+RTL871X = rtl8188f
+ifeq ($(CONFIG_USB_HCI), y)
+MODULE_NAME = 8188fu
+endif
+ifeq ($(CONFIG_PCI_HCI), y)
+MODULE_NAME = 8188fe
+endif
+ifeq ($(CONFIG_SDIO_HCI), y)
+MODULE_NAME = 8189fs
+endif
+
+EXTRA_CFLAGS += -DCONFIG_RTL8188F
+
+_HAL_INTFS_FILES += hal/HalPwrSeqCmd.o \
+                                       hal/$(RTL871X)/Hal8188FPwrSeq.o\
+                                       hal/$(RTL871X)/$(RTL871X)_sreset.o
+
+_HAL_INTFS_FILES +=    hal/$(RTL871X)/$(RTL871X)_hal_init.o \
+                       hal/$(RTL871X)/$(RTL871X)_phycfg.o \
+                       hal/$(RTL871X)/$(RTL871X)_rf6052.o \
+                       hal/$(RTL871X)/$(RTL871X)_dm.o \
+                       hal/$(RTL871X)/$(RTL871X)_rxdesc.o \
+                       hal/$(RTL871X)/$(RTL871X)_cmd.o \
+                       hal/$(RTL871X)/hal8188f_fw.o
+
+_HAL_INTFS_FILES +=    \
+                       hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_halinit.o \
+                       hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_led.o \
+                       hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_xmit.o \
+                       hal/$(RTL871X)/$(HCI_NAME)/rtl$(MODULE_NAME)_recv.o
+
+ifeq ($(CONFIG_PCI_HCI), y)
+_HAL_INTFS_FILES += hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_ops_linux.o
+else
+_HAL_INTFS_FILES += hal/$(RTL871X)/$(HCI_NAME)/$(HCI_NAME)_ops.o
+endif
+
+ifeq ($(CONFIG_USB_HCI), y)
+_HAL_INTFS_FILES +=hal/efuse/$(RTL871X)/HalEfuseMask8188F_USB.o
+endif
+
+ifeq ($(CONFIG_SDIO_HCI), y)
+_HAL_INTFS_FILES +=hal/efuse/$(RTL871X)/HalEfuseMask8188F_SDIO.o
+endif
+
+_OUTSRC_FILES += hal/phydm/$(RTL871X)/halhwimg8188f_bb.o\
+                                                               hal/phydm/$(RTL871X)/halhwimg8188f_mac.o\
+                                                               hal/phydm/$(RTL871X)/halhwimg8188f_rf.o\
+                                                               hal/phydm/$(RTL871X)/phydm_regconfig8188f.o\
+                                                               hal/phydm/$(RTL871X)/halphyrf_8188f.o \
+                                                               hal/phydm/$(RTL871X)/phydm_rtl8188f.o
+
+endif
+
+########### HAL_RTL8822B #################################
+ifeq ($(CONFIG_RTL8822B), y)
+include $(TopDIR)/rtl8822b.mk
+endif
+
+########### HAL_RTL8821C #################################
+ifeq ($(CONFIG_RTL8821C), y)
+include $(TopDIR)/rtl8821c.mk
+
+_OUTSRC_FILES +=       hal/phydm/rtl8821c/halhwimg8821c_bb.o \
+                       hal/phydm/rtl8821c/halhwimg8821c_mac.o \
+                       hal/phydm/rtl8821c/halhwimg8821c_rf.o \
+                       hal/phydm/rtl8821c/phydm_hal_api8821c.o \
+                       hal/phydm/rtl8821c/phydm_regconfig8821c.o\
+                       hal/phydm/rtl8821c/halphyrf_8821c.o\
+                       hal/phydm/rtl8821c/phydm_iqk_8821c.o
+endif
+
+########### AUTO_CFG  #################################
+
+ifeq ($(CONFIG_AUTOCFG_CP), y)
+
+ifeq ($(CONFIG_MULTIDRV), y)
+$(shell cp $(TopDIR)/autoconf_multidrv_$(HCI_NAME)_linux.h $(TopDIR)/include/autoconf.h)
+else
+ifeq ($(CONFIG_RTL8188E)$(CONFIG_SDIO_HCI),yy)
+$(shell cp $(TopDIR)/autoconf_rtl8189e_$(HCI_NAME)_linux.h $(TopDIR)/include/autoconf.h)
+else ifeq ($(CONFIG_RTL8188F)$(CONFIG_SDIO_HCI),yy)
+$(shell cp $(TopDIR)/autoconf_rtl8189f_$(HCI_NAME)_linux.h $(TopDIR)/include/autoconf.h)
+else ifeq ($(CONFIG_RTL8723C),y)
+$(shell cp $(TopDIR)/autoconf_rtl8723c_$(HCI_NAME)_linux.h $(TopDIR)/include/autoconf.h)
+else
+$(shell cp $(TopDIR)/autoconf_$(RTL871X)_$(HCI_NAME)_linux.h $(TopDIR)/include/autoconf.h)
+endif
+endif
+
+endif
+
+########### END OF PATH  #################################
+
+ifeq ($(CONFIG_USB_HCI), y)
+ifeq ($(CONFIG_USB_AUTOSUSPEND), y)
+EXTRA_CFLAGS += -DCONFIG_USB_AUTOSUSPEND
+endif
+endif
+
+ifeq ($(CONFIG_MP_INCLUDED), y)
+#MODULE_NAME := $(MODULE_NAME)_mp
+EXTRA_CFLAGS += -DCONFIG_MP_INCLUDED
+endif
+
+ifeq ($(CONFIG_POWER_SAVING), y)
+EXTRA_CFLAGS += -DCONFIG_POWER_SAVING
+endif
+
+ifeq ($(CONFIG_HW_PWRP_DETECTION), y)
+EXTRA_CFLAGS += -DCONFIG_HW_PWRP_DETECTION
+endif
+
+ifeq ($(CONFIG_WIFI_TEST), y)
+EXTRA_CFLAGS += -DCONFIG_WIFI_TEST
+endif
+
+ifeq ($(CONFIG_BT_COEXIST), y)
+EXTRA_CFLAGS += -DCONFIG_BT_COEXIST
+endif
+
+ifeq ($(CONFIG_INTEL_WIDI), y)
+EXTRA_CFLAGS += -DCONFIG_INTEL_WIDI
+endif
+
+ifeq ($(CONFIG_WAPI_SUPPORT), y)
+EXTRA_CFLAGS += -DCONFIG_WAPI_SUPPORT
+endif
+
+
+ifeq ($(CONFIG_EFUSE_CONFIG_FILE), y)
+EXTRA_CFLAGS += -DCONFIG_EFUSE_CONFIG_FILE
+
+#EFUSE_MAP_PATH
+USER_EFUSE_MAP_PATH ?=
+ifneq ($(USER_EFUSE_MAP_PATH),)
+EXTRA_CFLAGS += -DEFUSE_MAP_PATH=\"$(USER_EFUSE_MAP_PATH)\"
+else ifeq ($(MODULE_NAME), 8189es)
+EXTRA_CFLAGS += -DEFUSE_MAP_PATH=\"/system/etc/wifi/wifi_efuse_8189e.map\"
+else ifeq ($(MODULE_NAME), 8723bs)
+EXTRA_CFLAGS += -DEFUSE_MAP_PATH=\"/system/etc/wifi/wifi_efuse_8723bs.map\"
+else
+EXTRA_CFLAGS += -DEFUSE_MAP_PATH=\"/system/etc/wifi/wifi_efuse_$(MODULE_NAME).map\"
+endif
+
+#WIFIMAC_PATH
+USER_WIFIMAC_PATH ?=
+ifneq ($(USER_WIFIMAC_PATH),)
+EXTRA_CFLAGS += -DWIFIMAC_PATH=\"$(USER_WIFIMAC_PATH)\"
+else
+EXTRA_CFLAGS += -DWIFIMAC_PATH=\"/data/wifimac.txt\"
+endif
+
+endif
+
+ifeq ($(CONFIG_EXT_CLK), y)
+EXTRA_CFLAGS += -DCONFIG_EXT_CLK
+endif
+
+ifeq ($(CONFIG_TRAFFIC_PROTECT), y)
+EXTRA_CFLAGS += -DCONFIG_TRAFFIC_PROTECT
+endif
+
+ifeq ($(CONFIG_LOAD_PHY_PARA_FROM_FILE), y)
+EXTRA_CFLAGS += -DCONFIG_LOAD_PHY_PARA_FROM_FILE
+#EXTRA_CFLAGS += -DREALTEK_CONFIG_PATH_WITH_IC_NAME_FOLDER
+#EXTRA_CFLAGS += -DREALTEK_CONFIG_PATH=\"/lib/firmware/\"
+EXTRA_CFLAGS += -DREALTEK_CONFIG_PATH=\"\"
+endif
+
+ifeq ($(CONFIG_TXPWR_BY_RATE_EN), n)
+EXTRA_CFLAGS += -DCONFIG_TXPWR_BY_RATE_EN=0
+else ifeq ($(CONFIG_TXPWR_BY_RATE_EN), y)
+EXTRA_CFLAGS += -DCONFIG_TXPWR_BY_RATE_EN=1
+else ifeq ($(CONFIG_TXPWR_BY_RATE_EN), auto)
+EXTRA_CFLAGS += -DCONFIG_TXPWR_BY_RATE_EN=2
+endif
+
+ifeq ($(CONFIG_TXPWR_LIMIT_EN), n)
+EXTRA_CFLAGS += -DCONFIG_TXPWR_LIMIT_EN=0
+else ifeq ($(CONFIG_TXPWR_LIMIT_EN), y)
+EXTRA_CFLAGS += -DCONFIG_TXPWR_LIMIT_EN=1
+else ifeq ($(CONFIG_TXPWR_LIMIT_EN), auto)
+EXTRA_CFLAGS += -DCONFIG_TXPWR_LIMIT_EN=2
+endif
+
+ifeq ($(CONFIG_CALIBRATE_TX_POWER_BY_REGULATORY), y)
+EXTRA_CFLAGS += -DCONFIG_CALIBRATE_TX_POWER_BY_REGULATORY
+endif
+
+ifeq ($(CONFIG_CALIBRATE_TX_POWER_TO_MAX), y)
+EXTRA_CFLAGS += -DCONFIG_CALIBRATE_TX_POWER_TO_MAX
+endif
+
+ifeq ($(CONFIG_RTW_ADAPTIVITY_EN), disable)
+EXTRA_CFLAGS += -DCONFIG_RTW_ADAPTIVITY_EN=0
+else ifeq ($(CONFIG_RTW_ADAPTIVITY_EN), enable)
+EXTRA_CFLAGS += -DCONFIG_RTW_ADAPTIVITY_EN=1
+endif
+
+ifeq ($(CONFIG_RTW_ADAPTIVITY_MODE), normal)
+EXTRA_CFLAGS += -DCONFIG_RTW_ADAPTIVITY_MODE=0
+else ifeq ($(CONFIG_RTW_ADAPTIVITY_MODE), carrier_sense)
+EXTRA_CFLAGS += -DCONFIG_RTW_ADAPTIVITY_MODE=1
+endif
+
+ifeq ($(CONFIG_SIGNAL_SCALE_MAPPING), y)
+EXTRA_CFLAGS += -DCONFIG_SIGNAL_SCALE_MAPPING
+endif
+
+ifeq ($(CONFIG_80211W), y)
+EXTRA_CFLAGS += -DCONFIG_IEEE80211W
+endif
+
+ifeq ($(CONFIG_WOWLAN), y)
+EXTRA_CFLAGS += -DCONFIG_WOWLAN
+ifeq ($(CONFIG_SDIO_HCI), y)
+EXTRA_CFLAGS += -DCONFIG_RTW_SDIO_PM_KEEP_POWER
+endif
+ifeq ($(CONFIG_DEFAULT_PATTERNS_EN), y)
+EXTRA_CFLAGS += -DCONFIG_DEFAULT_PATTERNS_EN
+endif
+endif
+
+ifeq ($(CONFIG_AP_WOWLAN), y)
+EXTRA_CFLAGS += -DCONFIG_AP_WOWLAN
+ifeq ($(CONFIG_SDIO_HCI), y)
+EXTRA_CFLAGS += -DCONFIG_RTW_SDIO_PM_KEEP_POWER
+endif
+endif
+
+ifeq ($(CONFIG_PNO_SUPPORT), y)
+EXTRA_CFLAGS += -DCONFIG_PNO_SUPPORT
+ifeq ($(CONFIG_PNO_SET_DEBUG), y)
+EXTRA_CFLAGS += -DCONFIG_PNO_SET_DEBUG
+endif
+endif
+
+ifeq ($(CONFIG_GPIO_WAKEUP), y)
+EXTRA_CFLAGS += -DCONFIG_GPIO_WAKEUP
+ifeq ($(CONFIG_HIGH_ACTIVE), y)
+EXTRA_CFLAGS += -DHIGH_ACTIVE=1
+else
+EXTRA_CFLAGS += -DHIGH_ACTIVE=0
+endif
+endif
+
+ifneq ($(CONFIG_WAKEUP_GPIO_IDX), default)
+EXTRA_CFLAGS += -DWAKEUP_GPIO_IDX=$(CONFIG_WAKEUP_GPIO_IDX)
+endif
+
+ifeq ($(CONFIG_RTW_SDIO_PM_KEEP_POWER), y)
+ifeq ($(CONFIG_SDIO_HCI), y)
+EXTRA_CFLAGS += -DCONFIG_RTW_SDIO_PM_KEEP_POWER
+endif
+endif
+
+ifeq ($(CONFIG_REDUCE_TX_CPU_LOADING), y)
+EXTRA_CFLAGS += -DCONFIG_REDUCE_TX_CPU_LOADING
+endif
+
+ifeq ($(CONFIG_BR_EXT), y)
+BR_NAME = br0
+EXTRA_CFLAGS += -DCONFIG_BR_EXT
+EXTRA_CFLAGS += '-DCONFIG_BR_EXT_BRNAME="'$(BR_NAME)'"'
+endif
+
+
+ifeq ($(CONFIG_TDLS), y)
+EXTRA_CFLAGS += -DCONFIG_TDLS
+endif
+
+ifeq ($(CONFIG_WIFI_MONITOR), y)
+EXTRA_CFLAGS += -DCONFIG_WIFI_MONITOR
+endif
+
+ifeq ($(CONFIG_MCC_MODE), y)
+EXTRA_CFLAGS += -DCONFIG_MCC_MODE
+endif
+
+ifeq ($(CONFIG_RTW_NAPI), y)
+EXTRA_CFLAGS += -DCONFIG_RTW_NAPI
+endif
+
+ifeq ($(CONFIG_RTW_GRO), y)
+EXTRA_CFLAGS += -DCONFIG_RTW_GRO
+endif
+
+ifeq ($(CONFIG_MP_VHT_HW_TX_MODE), y)
+EXTRA_CFLAGS += -DCONFIG_MP_VHT_HW_TX_MODE
+ifeq ($(CONFIG_PLATFORM_I386_PC), y)
+## For I386 X86 ToolChain use Hardware FLOATING
+EXTRA_CFLAGS += -mhard-float
+else
+## For ARM ToolChain use Hardware FLOATING
+EXTRA_CFLAGS += -mfloat-abi=hard
+endif
+endif
+
+ifeq ($(CONFIG_APPEND_VENDOR_IE_ENABLE), y)
+EXTRA_CFLAGS += -DCONFIG_APPEND_VENDOR_IE_ENABLE
+endif
+
+ifeq ($(CONFIG_RTW_DEBUG), y)
+EXTRA_CFLAGS += -DCONFIG_RTW_DEBUG
+EXTRA_CFLAGS += -DRTW_LOG_LEVEL=$(CONFIG_RTW_LOG_LEVEL)
+endif
+
+EXTRA_CFLAGS += -DDM_ODM_SUPPORT_TYPE=0x04
+
+ifeq ($(CONFIG_PLATFORM_I386_PC), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
+EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
+SUBARCH := $(shell uname -m | sed -e s/i.86/i386/)
+ARCH ?= $(SUBARCH)
+CROSS_COMPILE ?=
+KVER  := $(shell uname -r)
+KSRC := /lib/modules/$(KVER)/build
+MODDESTDIR := /lib/modules/$(KVER)/kernel/drivers/net/wireless/
+INSTALL_PREFIX :=
+endif
+
+ifeq ($(CONFIG_PLATFORM_NV_TK1), y)
+EXTRA_CFLAGS += -DCONFIG_PLATFORM_NV_TK1
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
+EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
+EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
+ARCH ?= arm
+CROSS_COMPILE ?=
+KVER := $(shell uname -r)
+KSRC := /lib/modules/$(KVER)/build
+MODDESTDIR := /lib/modules/$(KVER)/kernel/drivers/net/wireless/
+INSTALL_PREFIX :=
+endif
+
+ifeq ($(CONFIG_PLATFORM_ACTIONS_ATM702X), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_ANDROID -DCONFIG_PLATFORM_ACTIONS_ATM702X
+#ARCH := arm
+ARCH := $(R_ARCH)
+#CROSS_COMPILE := arm-none-linux-gnueabi-
+CROSS_COMPILE := $(R_CROSS_COMPILE)
+KVER:= 3.4.0
+#KSRC := ../../../../build/out/kernel
+KSRC := $(KERNEL_BUILD_PATH)
+MODULE_NAME :=wlan
+endif
+
+
+ifeq ($(CONFIG_PLATFORM_ACTIONS_ATM705X), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
+#EXTRA_CFLAGS += -DRTW_ENABLE_WIFI_CONTROL_FUNC
+# default setting for Android 4.1, 4.2, 4.3, 4.4
+EXTRA_CFLAGS += -DCONFIG_PLATFORM_ACTIONS_ATM705X
+EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
+EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
+
+# Enable this for Android 5.0
+EXTRA_CFLAGS += -DCONFIG_RADIO_WORK
+
+ifeq ($(CONFIG_SDIO_HCI), y)
+EXTRA_CFLAGS += -DCONFIG_PLATFORM_OPS
+_PLATFORM_FILES += platform/platform_arm_act_sdio.o
+endif
+
+ARCH := arm
+CROSS_COMPILE := /opt/arm-2011.09/bin/arm-none-linux-gnueabi-
+KSRC := /home/android_sdk/Action-semi/705a_android_L/android/kernel
+endif
+
+ifeq ($(CONFIG_PLATFORM_ARM_SUN50IW1P1), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
+EXTRA_CFLAGS += -DCONFIG_PLATFORM_ARM_SUN50IW1P1
+EXTRA_CFLAGS += -DCONFIG_TRAFFIC_PROTECT
+# default setting for Android 4.1, 4.2
+EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
+EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
+EXTRA_CFLAGS += -DCONFIG_RESUME_IN_WORKQUEUE
+EXTRA_CFLAGS += -DCONFIG_PLATFORM_OPS
+
+# Enable this for Android 5.0
+EXTRA_CFLAGS += -DCONFIG_RADIO_WORK
+
+ifeq ($(CONFIG_USB_HCI), y)
+EXTRA_CFLAGS += -DCONFIG_USE_USB_BUFFER_ALLOC_TX
+_PLATFORM_FILES += platform/platform_ARM_SUNxI_usb.o
+endif
+ifeq ($(CONFIG_SDIO_HCI), y)
+_PLATFORM_FILES += platform/platform_ARM_SUN50IW1P1_sdio.o
+endif
+
+ARCH := arm64
+# ===Cross compile setting for Android 5.1(64) SDK ===
+CROSS_COMPILE := /home/android_sdk/Allwinner/a64/android-51/lichee/out/sun50iw1p1/android/common/buildroot/external-toolchain/bin/aarch64-linux-gnu-
+KSRC :=/home/android_sdk/Allwinner/a64/android-51/lichee/linux-3.10/
+endif
+
+ifeq ($(CONFIG_PLATFORM_TI_AM3517), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_ANDROID -DCONFIG_PLATFORM_SHUTTLE
+CROSS_COMPILE := arm-eabi-
+KSRC := $(shell pwd)/../../../Android/kernel
+ARCH := arm
+endif
+
+ifeq ($(CONFIG_PLATFORM_MSTAR_TITANIA12), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_MSTAR -DCONFIG_PLATFORM_MSTAR_TITANIA12
+ARCH:=mips
+CROSS_COMPILE:= /usr/src/Mstar_kernel/mips-4.3/bin/mips-linux-gnu-
+KVER:= 2.6.28.9
+KSRC:= /usr/src/Mstar_kernel/2.6.28.9/
+endif
+
+ifeq ($(CONFIG_PLATFORM_MSTAR), y)
+EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
+EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_MSTAR -DCONFIG_USE_USB_BUFFER_ALLOC_TX -DCONFIG_FIX_NR_BULKIN_BUFFER
+EXTRA_CFLAGS += -DCONFIG_PLATFORM_MSTAR_HIGH
+ARCH:=arm
+CROSS_COMPILE:= /usr/src/bin/arm-none-linux-gnueabi-
+KVER:= 3.1.10
+KSRC:= /usr/src/Mstar_kernel/3.1.10/
+endif
+
+ifeq ($(CONFIG_PLATFORM_ANDROID_X86), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
+SUBARCH := $(shell uname -m | sed -e s/i.86/i386/)
+ARCH := $(SUBARCH)
+CROSS_COMPILE := /media/DATA-2/android-x86/ics-x86_20120130/prebuilt/linux-x86/toolchain/i686-unknown-linux-gnu-4.2.1/bin/i686-unknown-linux-gnu-
+KSRC := /media/DATA-2/android-x86/ics-x86_20120130/out/target/product/generic_x86/obj/kernel
+MODULE_NAME :=wlan
+endif
+
+ifeq ($(CONFIG_PLATFORM_ANDROID_INTEL_X86), y)
+EXTRA_CFLAGS += -DCONFIG_PLATFORM_ANDROID_INTEL_X86
+EXTRA_CFLAGS += -DCONFIG_PLATFORM_INTEL_BYT
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_ANDROID
+EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
+EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
+EXTRA_CFLAGS += -DCONFIG_SKIP_SIGNAL_SCALE_MAPPING
+ifeq ($(CONFIG_SDIO_HCI), y)
+EXTRA_CFLAGS += -DCONFIG_RESUME_IN_WORKQUEUE
+endif
+endif
+
+ifeq ($(CONFIG_PLATFORM_JB_X86), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
+EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
+EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
+SUBARCH := $(shell uname -m | sed -e s/i.86/i386/)
+ARCH := $(SUBARCH)
+CROSS_COMPILE := /home/android_sdk/android-x86_JB/prebuilts/gcc/linux-x86/x86/i686-linux-android-4.7/bin/i686-linux-android-
+KSRC := /home/android_sdk/android-x86_JB/out/target/product/x86/obj/kernel/
+MODULE_NAME :=wlan
+endif
+
+ifeq ($(CONFIG_PLATFORM_ARM_PXA2XX), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
+ARCH := arm
+CROSS_COMPILE := arm-none-linux-gnueabi-
+KVER  := 2.6.34.1
+KSRC ?= /usr/src/linux-2.6.34.1
+endif
+
+ifeq ($(CONFIG_PLATFORM_ARM_S3C2K4), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
+ARCH := arm
+CROSS_COMPILE := arm-linux-
+KVER  := 2.6.24.7_$(ARCH)
+KSRC := /usr/src/kernels/linux-$(KVER)
+endif
+
+ifeq ($(CONFIG_PLATFORM_ARM_S3C6K4), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
+ARCH := arm
+CROSS_COMPILE := arm-none-linux-gnueabi-
+KVER  := 2.6.34.1
+KSRC ?= /usr/src/linux-2.6.34.1
+endif
+
+ifeq ($(CONFIG_PLATFORM_RTD2880B), y)
+EXTRA_CFLAGS += -DCONFIG_BIG_ENDIAN -DCONFIG_PLATFORM_RTD2880B
+ARCH:=
+CROSS_COMPILE:=
+KVER:=
+KSRC:=
+endif
+
+ifeq ($(CONFIG_PLATFORM_MIPS_RMI), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
+ARCH:=mips
+CROSS_COMPILE:=mipsisa32r2-uclibc-
+KVER:=
+KSRC:= /root/work/kernel_realtek
+endif
+
+ifeq ($(CONFIG_PLATFORM_MIPS_PLM), y)
+EXTRA_CFLAGS += -DCONFIG_BIG_ENDIAN
+ARCH:=mips
+CROSS_COMPILE:=mipsisa32r2-uclibc-
+KVER:=
+KSRC:= /root/work/kernel_realtek
+endif
+
+ifeq ($(CONFIG_PLATFORM_MSTAR389), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_MSTAR389
+ARCH:=mips
+CROSS_COMPILE:= mips-linux-gnu-
+KVER:= 2.6.28.10
+KSRC:= /home/mstar/mstar_linux/2.6.28.9/
+endif
+
+ifeq ($(CONFIG_PLATFORM_MIPS_AR9132), y)
+EXTRA_CFLAGS += -DCONFIG_BIG_ENDIAN
+ARCH := mips
+CROSS_COMPILE := mips-openwrt-linux-
+KSRC := /home/alex/test_openwrt/tmp/linux-2.6.30.9
+endif
+
+ifeq ($(CONFIG_PLATFORM_DMP_PHILIPS), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DRTK_DMP_PLATFORM
+ARCH := mips
+#CROSS_COMPILE:=/usr/local/msdk-4.3.6-mips-EL-2.6.12.6-0.9.30.3/bin/mipsel-linux-
+CROSS_COMPILE:=/usr/local/toolchain_mipsel/bin/mipsel-linux-
+KSRC ?=/usr/local/Jupiter/linux-2.6.12
+endif
+
+ifeq ($(CONFIG_PLATFORM_RTK_DMP), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DRTK_DMP_PLATFORM  -DCONFIG_WIRELESS_EXT
+EXTRA_CFLAGS += -DCONFIG_PLATFORM_OPS
+ifeq ($(CONFIG_USB_HCI), y)
+_PLATFORM_FILES += platform/platform_RTK_DMP_usb.o
+endif
+ARCH:=mips
+CROSS_COMPILE:=mipsel-linux-
+KVER:=
+KSRC ?= /usr/src/DMP_Kernel/jupiter/linux-2.6.12
+endif
+
+ifeq ($(CONFIG_PLATFORM_MT53XX), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_MT53XX
+ARCH:= arm
+CROSS_COMPILE:= arm11_mtk_le-
+KVER:= 2.6.27
+KSRC?= /proj/mtk00802/BD_Compare/BDP/Dev/BDP_V301/BDP_Linux/linux-2.6.27
+endif
+
+ifeq ($(CONFIG_PLATFORM_ARM_MX51_241H), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_WISTRON_PLATFORM
+ARCH := arm
+CROSS_COMPILE := /opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-
+KVER  := 2.6.31
+KSRC ?= /lib/modules/2.6.31-770-g0e46b52/source
+endif
+
+ifeq ($(CONFIG_PLATFORM_FS_MX61), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
+ARCH := arm
+CROSS_COMPILE := /home/share/CusEnv/FreeScale/arm-eabi-4.4.3/bin/arm-eabi-
+KSRC ?= /home/share/CusEnv/FreeScale/FS_kernel_env
+endif
+
+
+
+ifeq ($(CONFIG_PLATFORM_ACTIONS_ATJ227X), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_ACTIONS_ATJ227X
+ARCH := mips
+CROSS_COMPILE := /home/cnsd4/project/actions/tools-2.6.27/bin/mipsel-linux-gnu-
+KVER  := 2.6.27
+KSRC := /home/cnsd4/project/actions/linux-2.6.27.28
+endif
+
+ifeq ($(CONFIG_PLATFORM_TI_DM365), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_TI_DM365
+EXTRA_CFLAGS += -DCONFIG_USE_USB_BUFFER_ALLOC_RX
+EXTRA_CFLAGS += -DCONFIG_SINGLE_XMIT_BUF -DCONFIG_SINGLE_RECV_BUF
+ARCH := arm
+#CROSS_COMPILE := /home/cnsd4/Appro/mv_pro_5.0/montavista/pro/devkit/arm/v5t_le/bin/arm_v5t_le-
+#KSRC := /home/cnsd4/Appro/mv_pro_5.0/montavista/pro/devkit/lsp/ti-davinci/linux-dm365
+CROSS_COMPILE := /opt/montavista/pro5.0/devkit/arm/v5t_le/bin/arm-linux-
+KSRC:= /home/vivotek/lsp/DM365/kernel_platform/kernel/linux-2.6.18
+KERNELOUTPUT := ${PRODUCTDIR}/tmp
+KVER  := 2.6.18
+endif
+
+ifeq ($(CONFIG_PLATFORM_MOZART), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_MOZART
+ARCH := arm
+CROSS_COMPILE := /home/vivotek/lsp/mozart3v2/Mozart3e_Toolchain/build_arm_nofpu/usr/bin/arm-linux-
+KVER  := $(shell uname -r)
+KSRC:= /opt/Vivotek/lsp/mozart3v2/kernel_platform/kernel/mozart_kernel-1.17
+KERNELOUTPUT := /home/pink/sample/ODM/IP8136W-VINT/tmp/kernel
+endif
+
+ifeq ($(CONFIG_PLATFORM_TEGRA3_CARDHU), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
+# default setting for Android 4.1, 4.2
+EXTRA_CFLAGS += -DRTW_ENABLE_WIFI_CONTROL_FUNC
+EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
+EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
+ARCH := arm
+CROSS_COMPILE := /home/android_sdk/nvidia/tegra-16r3-partner-android-4.1_20120723/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
+KSRC := /home/android_sdk/nvidia/tegra-16r3-partner-android-4.1_20120723/out/target/product/cardhu/obj/KERNEL
+MODULE_NAME := wlan
+endif
+
+ifeq ($(CONFIG_PLATFORM_TEGRA4_DALMORE), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
+# default setting for Android 4.1, 4.2
+EXTRA_CFLAGS += -DRTW_ENABLE_WIFI_CONTROL_FUNC
+EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
+EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
+ARCH := arm
+CROSS_COMPILE := /home/android_sdk/nvidia/tegra-17r9-partner-android-4.2-dalmore_20130131/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-
+KSRC := /home/android_sdk/nvidia/tegra-17r9-partner-android-4.2-dalmore_20130131/out/target/product/dalmore/obj/KERNEL
+MODULE_NAME := wlan
+endif
+
+ifeq ($(CONFIG_PLATFORM_ARM_TCC8900), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
+ARCH := arm
+CROSS_COMPILE := /home/android_sdk/Telechips/SDK_2304_20110613/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
+KSRC := /home/android_sdk/Telechips/SDK_2304_20110613/kernel
+MODULE_NAME := wlan
+endif
+
+ifeq ($(CONFIG_PLATFORM_ARM_TCC8920), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
+ARCH := arm
+CROSS_COMPILE := /home/android_sdk/Telechips/v12.06_r1-tcc-android-4.0.4/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
+KSRC := /home/android_sdk/Telechips/v12.06_r1-tcc-android-4.0.4/kernel
+MODULE_NAME := wlan
+endif
+
+ifeq ($(CONFIG_PLATFORM_ARM_TCC8920_JB42), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
+# default setting for Android 4.1, 4.2
+EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
+EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
+ARCH := arm
+CROSS_COMPILE := /home/android_sdk/Telechips/v13.03_r1-tcc-android-4.2.2_ds_patched/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-
+KSRC := /home/android_sdk/Telechips/v13.03_r1-tcc-android-4.2.2_ds_patched/kernel
+MODULE_NAME := wlan
+endif
+
+ifeq ($(CONFIG_PLATFORM_ARM_RK2818), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_ANDROID -DCONFIG_PLATFORM_ROCKCHIPS
+ARCH := arm
+CROSS_COMPILE := /usr/src/release_fae_version/toolchain/arm-eabi-4.4.0/bin/arm-eabi-
+KSRC := /usr/src/release_fae_version/kernel25_A7_281x
+MODULE_NAME := wlan
+endif
+
+ifeq ($(CONFIG_PLATFORM_ARM_RK3188), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_ANDROID -DCONFIG_PLATFORM_ROCKCHIPS
+# default setting for Android 4.1, 4.2, 4.3, 4.4
+EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
+EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
+# default setting for Power control
+EXTRA_CFLAGS += -DRTW_ENABLE_WIFI_CONTROL_FUNC
+EXTRA_CFLAGS += -DRTW_SUPPORT_PLATFORM_SHUTDOWN
+# default setting for Special function
+ARCH := arm
+CROSS_COMPILE := /home/android_sdk/Rockchip/Rk3188/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-
+KSRC := /home/android_sdk/Rockchip/Rk3188/kernel
+MODULE_NAME := 8723cs
+endif
+
+ifeq ($(CONFIG_PLATFORM_ARM_RK3066), y)
+EXTRA_CFLAGS += -DCONFIG_PLATFORM_ARM_RK3066
+EXTRA_CFLAGS += -DRTW_ENABLE_WIFI_CONTROL_FUNC
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
+EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
+EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211
+ifeq ($(CONFIG_SDIO_HCI), y)
+EXTRA_CFLAGS += -DRTW_SUPPORT_PLATFORM_SHUTDOWN
+endif
+EXTRA_CFLAGS += -fno-pic
+ARCH := arm
+CROSS_COMPILE := /home/android_sdk/Rockchip/rk3066_20130607/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-
+#CROSS_COMPILE := /home/android_sdk/Rockchip/Rk3066sdk/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-
+KSRC := /home/android_sdk/Rockchip/Rk3066sdk/kernel
+MODULE_NAME :=wlan
+endif
+
+ifeq ($(CONFIG_PLATFORM_ARM_URBETTER), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN #-DCONFIG_MINIMAL_MEMORY_USAGE
+ARCH := arm
+CROSS_COMPILE := /media/DATA-1/urbetter/arm-2009q3/bin/arm-none-linux-gnueabi-
+KSRC := /media/DATA-1/urbetter/ics-urbetter/kernel
+MODULE_NAME := wlan
+endif
+
+ifeq ($(CONFIG_PLATFORM_ARM_TI_PANDA), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN #-DCONFIG_MINIMAL_MEMORY_USAGE
+ARCH := arm
+#CROSS_COMPILE := /media/DATA-1/aosp/ics-aosp_20111227/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
+#KSRC := /media/DATA-1/aosp/android-omap-panda-3.0_20120104
+CROSS_COMPILE := /media/DATA-1/android-4.0/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
+KSRC := /media/DATA-1/android-4.0/panda_kernel/omap
+MODULE_NAME := wlan
+endif
+
+ifeq ($(CONFIG_PLATFORM_MIPS_JZ4760), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_MINIMAL_MEMORY_USAGE
+ARCH ?= mips
+CROSS_COMPILE ?= /mnt/sdb5/Ingenic/Umido/mips-4.3/bin/mips-linux-gnu-
+KSRC ?= /mnt/sdb5/Ingenic/Umido/kernel
+endif
+
+ifeq ($(CONFIG_PLATFORM_SZEBOOK), y)
+EXTRA_CFLAGS += -DCONFIG_BIG_ENDIAN
+ARCH:=arm
+CROSS_COMPILE:=/opt/crosstool2/bin/armeb-unknown-linux-gnueabi-
+KVER:= 2.6.31.6
+KSRC:= ../code/linux-2.6.31.6-2020/
+endif
+
+#Add setting for MN10300
+ifeq ($(CONFIG_PLATFORM_MN10300), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_MN10300
+ARCH := mn10300
+CROSS_COMPILE := mn10300-linux-
+KVER := 2.6.32.2
+KSRC := /home/winuser/work/Plat_sLD2T_V3010/usr/src/linux-2.6.32.2
+INSTALL_PREFIX :=
+endif
+
+
+ifeq ($(CONFIG_PLATFORM_ARM_SUNxI), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
+EXTRA_CFLAGS += -DCONFIG_PLATFORM_ARM_SUNxI
+# default setting for Android 4.1, 4.2
+EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
+EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
+
+EXTRA_CFLAGS += -DCONFIG_PLATFORM_OPS
+ifeq ($(CONFIG_USB_HCI), y)
+EXTRA_CFLAGS += -DCONFIG_USE_USB_BUFFER_ALLOC_TX
+_PLATFORM_FILES += platform/platform_ARM_SUNxI_usb.o
+endif
+ifeq ($(CONFIG_SDIO_HCI), y)
+# default setting for A10-EVB mmc0
+#EXTRA_CFLAGS += -DCONFIG_WITS_EVB_V13
+_PLATFORM_FILES += platform/platform_ARM_SUNxI_sdio.o
+endif
+
+ARCH := arm
+#CROSS_COMPILE := arm-none-linux-gnueabi-
+CROSS_COMPILE=/home/android_sdk/Allwinner/a10/android-jb42/lichee-jb42/buildroot/output/external-toolchain/bin/arm-none-linux-gnueabi-
+KVER  := 3.0.8
+#KSRC:= ../lichee/linux-3.0/
+KSRC=/home/android_sdk/Allwinner/a10/android-jb42/lichee-jb42/linux-3.0
+endif
+
+ifeq ($(CONFIG_PLATFORM_ARM_SUN6I), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
+EXTRA_CFLAGS += -DCONFIG_PLATFORM_ARM_SUN6I
+EXTRA_CFLAGS += -DCONFIG_TRAFFIC_PROTECT
+# default setting for Android 4.1, 4.2, 4.3, 4.4
+EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
+EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
+EXTRA_CFLAGS +=  -DCONFIG_QOS_OPTIMIZATION
+
+EXTRA_CFLAGS += -DCONFIG_PLATFORM_OPS
+ifeq ($(CONFIG_USB_HCI), y)
+EXTRA_CFLAGS += -DCONFIG_USE_USB_BUFFER_ALLOC_TX
+_PLATFORM_FILES += platform/platform_ARM_SUNxI_usb.o
+endif
+ifeq ($(CONFIG_SDIO_HCI), y)
+# default setting for A31-EVB mmc0
+EXTRA_CFLAGS += -DCONFIG_A31_EVB
+_PLATFORM_FILES += platform/platform_ARM_SUNnI_sdio.o
+endif
+
+ARCH := arm
+#Android-JB42
+#CROSS_COMPILE := /home/android_sdk/Allwinner/a31/android-jb42/lichee/buildroot/output/external-toolchain/bin/arm-linux-gnueabi-
+#KSRC :=/home/android_sdk/Allwinner/a31/android-jb42/lichee/linux-3.3
+#ifeq ($(CONFIG_USB_HCI), y)
+#MODULE_NAME := 8188eu_sw
+#endif
+# ==== Cross compile setting for kitkat-a3x_v4.5 =====
+CROSS_COMPILE := /home/android_sdk/Allwinner/a31/kitkat-a3x_v4.5/lichee/buildroot/output/external-toolchain/bin/arm-linux-gnueabi-
+KSRC :=/home/android_sdk/Allwinner/a31/kitkat-a3x_v4.5/lichee/linux-3.3
+endif
+
+ifeq ($(CONFIG_PLATFORM_ARM_SUN7I), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
+EXTRA_CFLAGS += -DCONFIG_PLATFORM_ARM_SUN7I
+EXTRA_CFLAGS += -DCONFIG_TRAFFIC_PROTECT
+# default setting for Android 4.1, 4.2, 4.3, 4.4
+EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
+EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
+EXTRA_CFLAGS +=  -DCONFIG_QOS_OPTIMIZATION
+
+EXTRA_CFLAGS += -DCONFIG_PLATFORM_OPS
+ifeq ($(CONFIG_USB_HCI), y)
+EXTRA_CFLAGS += -DCONFIG_USE_USB_BUFFER_ALLOC_TX
+_PLATFORM_FILES += platform/platform_ARM_SUNxI_usb.o
+endif
+ifeq ($(CONFIG_SDIO_HCI), y)
+_PLATFORM_FILES += platform/platform_ARM_SUNnI_sdio.o
+endif
+
+ARCH := arm
+# ===Cross compile setting for Android 4.2 SDK ===
+#CROSS_COMPILE := /home/android_sdk/Allwinner/a20_evb/lichee/out/android/common/buildroot/external-toolchain/bin/arm-linux-gnueabi-
+#KSRC := /home/android_sdk/Allwinner/a20_evb/lichee/linux-3.3
+# ==== Cross compile setting for Android 4.3 SDK =====
+#CROSS_COMPILE := /home/android_sdk/Allwinner/a20/android-jb43/lichee/out/android/common/buildroot/external-toolchain/bin/arm-linux-gnueabi-
+#KSRC := /home/android_sdk/Allwinner/a20/android-jb43/lichee/linux-3.4
+# ==== Cross compile setting for kitkat-a20_v4.4 =====
+CROSS_COMPILE := /home/android_sdk/Allwinner/a20/kitkat-a20_v4.4/lichee/out/android/common/buildroot/external-toolchain/bin/arm-linux-gnueabi-
+KSRC := /home/android_sdk/Allwinner/a20/kitkat-a20_v4.4/lichee/linux-3.4
+endif
+
+ifeq ($(CONFIG_PLATFORM_ARM_SUN8I_W3P1), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
+EXTRA_CFLAGS += -DCONFIG_PLATFORM_ARM_SUN8I
+EXTRA_CFLAGS += -DCONFIG_PLATFORM_ARM_SUN8I_W3P1
+EXTRA_CFLAGS += -DCONFIG_TRAFFIC_PROTECT
+# default setting for Android 4.1, 4.2
+EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
+EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
+
+EXTRA_CFLAGS += -DCONFIG_PLATFORM_OPS
+ifeq ($(CONFIG_USB_HCI), y)
+EXTRA_CFLAGS += -DCONFIG_USE_USB_BUFFER_ALLOC_TX
+_PLATFORM_FILES += platform/platform_ARM_SUNxI_usb.o
+endif
+ifeq ($(CONFIG_SDIO_HCI), y)
+_PLATFORM_FILES += platform/platform_ARM_SUNnI_sdio.o
+endif
+
+ARCH := arm
+# ===Cross compile setting for Android 4.2 SDK ===
+#CROSS_COMPILE := /home/android_sdk/Allwinner/a23/android-jb42/lichee/out/android/common/buildroot/external-toolchain/bin/arm-linux-gnueabi-
+#KSRC :=/home/android_sdk/Allwinner/a23/android-jb42/lichee/linux-3.4
+# ===Cross compile setting for Android 4.4 SDK ===
+CROSS_COMPILE := /home/android_sdk/Allwinner/a23/android-kk44/lichee/out/android/common/buildroot/external-toolchain/bin/arm-linux-gnueabi-
+KSRC :=/home/android_sdk/Allwinner/a23/android-kk44/lichee/linux-3.4
+endif
+
+ifeq ($(CONFIG_PLATFORM_ARM_SUN8I_W5P1), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
+EXTRA_CFLAGS += -DCONFIG_PLATFORM_ARM_SUN8I
+EXTRA_CFLAGS += -DCONFIG_PLATFORM_ARM_SUN8I_W5P1
+EXTRA_CFLAGS += -DCONFIG_TRAFFIC_PROTECT
+# default setting for Android 4.1, 4.2
+EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
+EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
+
+# Enable this for Android 5.0
+EXTRA_CFLAGS += -DCONFIG_RADIO_WORK
+
+EXTRA_CFLAGS += -DCONFIG_PLATFORM_OPS
+ifeq ($(CONFIG_USB_HCI), y)
+EXTRA_CFLAGS += -DCONFIG_USE_USB_BUFFER_ALLOC_TX
+_PLATFORM_FILES += platform/platform_ARM_SUNxI_usb.o
+endif
+ifeq ($(CONFIG_SDIO_HCI), y)
+_PLATFORM_FILES += platform/platform_ARM_SUNnI_sdio.o
+endif
+
+ARCH := arm
+# ===Cross compile setting for Android L SDK ===
+CROSS_COMPILE := /home/android_sdk/Allwinner/a33/android-L/lichee/out/sun8iw5p1/android/common/buildroot/external-toolchain/bin/arm-linux-gnueabi-
+KSRC :=/home/android_sdk/Allwinner/a33/android-L/lichee/linux-3.4
+endif
+
+ifeq ($(CONFIG_PLATFORM_ACTIONS_ATV5201), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_ACTIONS_ATV5201
+EXTRA_CFLAGS += -DCONFIG_SDIO_DISABLE_RXFIFO_POLLING_LOOP
+ARCH := mips
+CROSS_COMPILE := mipsel-linux-gnu-
+KVER  := $(KERNEL_VER)
+KSRC:= $(CFGDIR)/../../kernel/linux-$(KERNEL_VER)
+endif
+
+ifeq ($(CONFIG_PLATFORM_ARM_RTD299X), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
+EXTRA_CFLAGS += -DUSB_XMITBUF_ALIGN_SZ=1024 -DUSB_PACKET_OFFSET_SZ=0
+EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
+ifeq ($(CONFIG_ANDROID), y)
+EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
+# Enable this for Android 5.0
+EXTRA_CFLAGS += -DCONFIG_RADIO_WORK
+endif
+#ARCH, CROSS_COMPILE, KSRC,and  MODDESTDIR are provided by external makefile
+INSTALL_PREFIX :=
+endif
+
+ifeq ($(CONFIG_PLATFORM_HISILICON), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_HISILICON
+ifeq ($(SUPPORT_CONCURRENT),y)
+EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
+endif
+EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
+ARCH := arm
+ifeq ($(CROSS_COMPILE),)
+       CROSS_COMPILE = arm-hisiv200-linux-
+endif
+MODULE_NAME := rtl8192eu
+ifeq ($(KSRC),)
+       KSRC := ../../../../../../kernel/linux-3.4.y
+endif
+endif
+
+# Platform setting
+ifeq ($(CONFIG_PLATFORM_ARM_SPREADTRUM_6820), y)
+ifeq ($(CONFIG_ANDROID_2X), y)
+EXTRA_CFLAGS += -DANDROID_2X
+endif
+EXTRA_CFLAGS += -DCONFIG_PLATFORM_SPRD
+EXTRA_CFLAGS += -DPLATFORM_SPREADTRUM_6820
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
+ifeq ($(RTL871X), rtl8188e)
+EXTRA_CFLAGS += -DSOFTAP_PS_DURATION=50
+endif
+ifeq ($(CONFIG_SDIO_HCI), y)
+EXTRA_CFLAGS += -DCONFIG_PLATFORM_OPS
+_PLATFORM_FILES += platform/platform_sprd_sdio.o
+endif
+endif
+
+ifeq ($(CONFIG_PLATFORM_ARM_SPREADTRUM_8810), y)
+ifeq ($(CONFIG_ANDROID_2X), y)
+EXTRA_CFLAGS += -DANDROID_2X
+endif
+EXTRA_CFLAGS += -DCONFIG_PLATFORM_SPRD
+EXTRA_CFLAGS += -DPLATFORM_SPREADTRUM_8810
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
+ifeq ($(RTL871X), rtl8188e)
+EXTRA_CFLAGS += -DSOFTAP_PS_DURATION=50
+endif
+ifeq ($(CONFIG_SDIO_HCI), y)
+EXTRA_CFLAGS += -DCONFIG_PLATFORM_OPS
+_PLATFORM_FILES += platform/platform_sprd_sdio.o
+endif
+endif
+
+ifeq ($(CONFIG_PLATFORM_ARM_WMT), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
+EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
+EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
+EXTRA_CFLAGS += -DCONFIG_PLATFORM_OPS
+ifeq ($(CONFIG_SDIO_HCI), y)
+_PLATFORM_FILES += platform/platform_ARM_WMT_sdio.o
+endif
+ARCH := arm
+CROSS_COMPILE := /home/android_sdk/WonderMedia/wm8880-android4.4/toolchain/arm_201103_gcc4.5.2/mybin/arm_1103_le-
+KSRC := /home/android_sdk/WonderMedia/wm8880-android4.4/kernel4.4/
+MODULE_NAME :=8189es_kk
+endif
+
+ifeq ($(CONFIG_PLATFORM_RTK119X), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
+#EXTRA_CFLAGS += -DCONFIG_PLATFORM_ARM_SUN7I
+EXTRA_CFLAGS += -DCONFIG_TRAFFIC_PROTECT
+# default setting for Android 4.1, 4.2
+EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
+EXTRA_CFLAGS += -DCONFIG_IFACE_NUMBER=3
+EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
+#EXTRA_CFLAGS +=  -DCONFIG_QOS_OPTIMIZATION
+EXTRA_CFLAGS += -DCONFIG_QOS_OPTIMIZATION
+
+#EXTRA_CFLAGS += -DCONFIG_#PLATFORM_OPS
+ifeq ($(CONFIG_USB_HCI), y)
+EXTRA_CFLAGS += -DCONFIG_USE_USB_BUFFER_ALLOC_TX
+#_PLATFORM_FILES += platform/platform_ARM_SUNxI_usb.o
+endif
+ifeq ($(CONFIG_SDIO_HCI), y)
+_PLATFORM_FILES += platform/platform_ARM_SUNnI_sdio.o
+endif
+
+ARCH := arm
+
+# ==== Cross compile setting for Android 4.4 SDK =====
+#CROSS_COMPILE := arm-linux-gnueabihf-
+KVER  := 3.10.24
+#KSRC :=/home/android_sdk/Allwinner/a20/android-kitkat44/lichee/linux-3.4
+CROSS_COMPILE := /home/realtek/software_phoenix/phoenix/toolchain/usr/local/arm-2013.11/bin/arm-linux-gnueabihf-
+KSRC := /home/realtek/software_phoenix/linux-kernel
+MODULE_NAME := 8192eu
+
+endif
+
+ifeq ($(CONFIG_PLATFORM_RTK129X), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
+EXTRA_CFLAGS += -DRTK_129X_PLATFORM
+EXTRA_CFLAGS += -DCONFIG_TRAFFIC_PROTECT
+# default setting for Android 4.1, 4.2
+#EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
+EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
+#EXTRA_CFLAGS += -DCONFIG_P2P_IPS -DCONFIG_QOS_OPTIMIZATION
+EXTRA_CFLAGS += -DCONFIG_QOS_OPTIMIZATION
+EXTRA_CFLAGS += -Wno-error=date-time
+
+#EXTRA_CFLAGS += -DCONFIG_#PLATFORM_OPS
+ifeq ($(CONFIG_USB_HCI), y)
+EXTRA_CFLAGS += -DCONFIG_USE_USB_BUFFER_ALLOC_TX
+#_PLATFORM_FILES += platform/platform_ARM_SUNxI_usb.o
+endif
+ifeq ($(CONFIG_SDIO_HCI), y)
+_PLATFORM_FILES += platform/platform_ARM_SUNnI_sdio.o
+endif
+
+ARCH := arm64
+
+# ==== Cross compile setting for Android 4.4 SDK =====
+#CROSS_COMPILE := arm-linux-gnueabihf-
+KVER  := 4.1.10
+CROSS_COMPILE := $(CROSS)
+KSRC := $(LINUX_KERNEL_PATH)
+MODULE_NAME := 8822be
+endif
+
+ifeq ($(CONFIG_PLATFORM_NOVATEK_NT72668), y)
+EXTRA_CFLAGS += -DCONFIG_PLATFORM_NOVATEK_NT72668
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
+EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
+EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
+EXTRA_CFLAGS += -DCONFIG_USE_USB_BUFFER_ALLOC_RX
+EXTRA_CFLAGS += -DCONFIG_USE_USB_BUFFER_ALLOC_TX
+ARCH ?= arm
+CROSS_COMPILE := arm-linux-gnueabihf-
+KVER := 3.8.0
+KSRC := /Custom/Novatek/TCL/linux-3.8_header
+#KSRC := $(KERNELDIR)
+endif
+
+ifeq ($(CONFIG_PLATFORM_ARM_TCC8930_JB42), y)
+EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
+# default setting for Android 4.1, 4.2
+EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
+EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
+ARCH := arm
+CROSS_COMPILE := /home/android_sdk/Telechips/v13.05_r1-tcc-android-4.2.2_tcc893x-evm_build/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-
+KSRC := /home/android_sdk/Telechips/v13.05_r1-tcc-android-4.2.2_tcc893x-evm_build/kernel
+MODULE_NAME := wlan
+endif 
+
+ifeq ($(CONFIG_MULTIDRV), y)
+
+ifeq ($(CONFIG_SDIO_HCI), y)
+MODULE_NAME := rtw_sdio
+endif
+
+ifeq ($(CONFIG_USB_HCI), y)
+MODULE_NAME := rtw_usb
+endif
+
+ifeq ($(CONFIG_PCI_HCI), y)
+MODULE_NAME := rtw_pci
+endif
+
+
+endif
+
+USER_MODULE_NAME ?=
+ifneq ($(USER_MODULE_NAME),)
+MODULE_NAME := $(USER_MODULE_NAME)
+endif
+
+ifneq ($(KERNELRELEASE),)
+
+rtk_core :=    core/rtw_cmd.o \
+               core/rtw_security.o \
+               core/rtw_debug.o \
+               core/rtw_io.o \
+               core/rtw_ioctl_query.o \
+               core/rtw_ioctl_set.o \
+               core/rtw_ieee80211.o \
+               core/rtw_mlme.o \
+               core/rtw_mlme_ext.o \
+               core/rtw_mi.o \
+               core/rtw_wlan_util.o \
+               core/rtw_vht.o \
+               core/rtw_pwrctrl.o \
+               core/rtw_rf.o \
+               core/rtw_recv.o \
+               core/rtw_sta_mgt.o \
+               core/rtw_ap.o \
+               core/rtw_xmit.o \
+               core/rtw_p2p.o \
+               core/rtw_tdls.o \
+               core/rtw_br_ext.o \
+               core/rtw_iol.o \
+               core/rtw_sreset.o \
+               core/rtw_btcoex_wifionly.o \
+               core/rtw_btcoex.o \
+               core/rtw_beamforming.o \
+               core/rtw_odm.o \
+               core/efuse/rtw_efuse.o 
+
+ifeq ($(CONFIG_SDIO_HCI), y)
+rtk_core += core/rtw_sdio.o
+endif
+
+$(MODULE_NAME)-y += $(rtk_core)
+
+$(MODULE_NAME)-$(CONFIG_INTEL_WIDI) += core/rtw_intel_widi.o
+
+$(MODULE_NAME)-$(CONFIG_WAPI_SUPPORT) += core/rtw_wapi.o       \
+                                       core/rtw_wapi_sms4.o
+
+$(MODULE_NAME)-y += $(_OS_INTFS_FILES)
+$(MODULE_NAME)-y += $(_HAL_INTFS_FILES)
+$(MODULE_NAME)-y += $(_OUTSRC_FILES)
+$(MODULE_NAME)-y += $(_PLATFORM_FILES)
+
+$(MODULE_NAME)-$(CONFIG_MP_INCLUDED) += core/rtw_mp.o
+
+ifeq ($(CONFIG_RTL8723B), y)
+$(MODULE_NAME)-$(CONFIG_MP_INCLUDED)+= core/rtw_bt_mp.o
+endif
+
+obj-$(CONFIG_RTL8723CS) := $(MODULE_NAME).o
+
+else
+
+export CONFIG_RTL8723CS = m
+
+all: modules
+
+modules:
+       $(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KSRC) M=$(shell pwd)  modules
+
+strip:
+       $(CROSS_COMPILE)strip $(MODULE_NAME).ko --strip-unneeded
+
+install:
+       install -p -m 644 $(MODULE_NAME).ko  $(MODDESTDIR)
+       /sbin/depmod -a ${KVER}
+
+uninstall:
+       rm -f $(MODDESTDIR)/$(MODULE_NAME).ko
+       /sbin/depmod -a ${KVER}
+
+config_r:
+       @echo "make config"
+       /bin/bash script/Configure script/config.in
+
+
+.PHONY: modules clean
+
+clean:
+       #$(MAKE) -C $(KSRC) M=$(shell pwd) clean
+       cd hal ; rm -fr */*/*/*.mod.c */*/*/*.mod */*/*/*.o */*/*/.*.cmd */*/*/*.ko
+       cd hal ; rm -fr */*/*.mod.c */*/*.mod */*/*.o */*/.*.cmd */*/*.ko
+       cd hal ; rm -fr */*.mod.c */*.mod */*.o */.*.cmd */*.ko
+       cd hal ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko
+       cd core/efuse ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko
+       cd core ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko
+       cd os_dep/linux ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko
+       cd os_dep ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko
+       cd platform ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko
+       rm -fr Module.symvers ; rm -fr Module.markers ; rm -fr modules.order
+       rm -fr *.mod.c *.mod *.o .*.cmd *.ko *~
+       rm -fr .tmp_versions
+endif
+
diff --git a/drivers/net/wireless/rockchip_wlan/rtl8723cs/clean b/drivers/net/wireless/rockchip_wlan/rtl8723cs/clean
new file mode 100644 (file)
index 0000000..8766421
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/bash
+rmmod 8192cu
+rmmod 8192ce
+rmmod 8192du
+rmmod 8192de
diff --git a/drivers/net/wireless/rockchip_wlan/rtl8723cs/core/efuse/rtw_efuse.c b/drivers/net/wireless/rockchip_wlan/rtl8723cs/core/efuse/rtw_efuse.c
new file mode 100644 (file)
index 0000000..cef3fea
--- /dev/null
@@ -0,0 +1,2949 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * 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.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+#define _RTW_EFUSE_C_
+
+#include <drv_types.h>
+#include <hal_data.h>
+
+#include "../hal/efuse/efuse_mask.h"
+
+/*------------------------Define local variable------------------------------*/
+u8     fakeEfuseBank = {0};
+u32    fakeEfuseUsedBytes = {0};
+u8     fakeEfuseContent[EFUSE_MAX_HW_SIZE] = {0};
+u8     fakeEfuseInitMap[EFUSE_MAX_MAP_LEN] = {0};
+u8     fakeEfuseModifiedMap[EFUSE_MAX_MAP_LEN] = {0};
+
+u32    BTEfuseUsedBytes = {0};
+u8     BTEfuseContent[EFUSE_MAX_BT_BANK][EFUSE_MAX_HW_SIZE];
+u8     BTEfuseInitMap[EFUSE_BT_MAX_MAP_LEN] = {0};
+u8     BTEfuseModifiedMap[EFUSE_BT_MAX_MAP_LEN] = {0};
+
+u32    fakeBTEfuseUsedBytes = {0};
+u8     fakeBTEfuseContent[EFUSE_MAX_BT_BANK][EFUSE_MAX_HW_SIZE];
+u8     fakeBTEfuseInitMap[EFUSE_BT_MAX_MAP_LEN] = {0};
+u8     fakeBTEfuseModifiedMap[EFUSE_BT_MAX_MAP_LEN] = {0};
+
+u8     maskfileBuffer[64];
+/*------------------------Define local variable------------------------------*/
+BOOLEAN rtw_file_efuse_IsMasked(PADAPTER pAdapter, u16 Offset)
+{
+       int r = Offset / 16;
+       int c = (Offset % 16) / 2;
+       int result = 0;
+
+       if (pAdapter->registrypriv.boffefusemask)
+               return FALSE;
+
+       if (c < 4) /* Upper double word */
+               result = (maskfileBuffer[r] & (0x10 << c));
+       else
+               result = (maskfileBuffer[r] & (0x01 << (c - 4)));
+
+       return (result > 0) ? 0 : 1;
+}
+
+BOOLEAN efuse_IsMasked(PADAPTER pAdapter, u16 Offset)
+{
+       PHAL_DATA_TYPE pHalData = GET_HAL_DATA(pAdapter);
+
+       if (pAdapter->registrypriv.boffefusemask)
+               return FALSE;
+
+#if DEV_BUS_TYPE == RT_USB_INTERFACE
+#if defined(CONFIG_RTL8188E)
+       if (IS_HARDWARE_TYPE_8188E(pAdapter))
+               return (IS_MASKED(8188E, _MUSB, Offset)) ? TRUE : FALSE;
+#endif
+#if defined(CONFIG_RTL8812A)
+       if (IS_HARDWARE_TYPE_8812(pAdapter))
+               return (IS_MASKED(8812A, _MUSB, Offset)) ? TRUE : FALSE;
+#endif
+#if defined(CONFIG_RTL8821A)
+#if 0
+       if (IS_HARDWARE_TYPE_8811AU(pAdapter))
+               return (IS_MASKED(8811A, _MUSB, Offset)) ? TRUE : FALSE;
+#endif
+       if (IS_HARDWARE_TYPE_8821(pAdapter))
+               return (IS_MASKED(8821A, _MUSB, Offset)) ? TRUE : FALSE;
+#endif
+#if defined(CONFIG_RTL8192E)
+       if (IS_HARDWARE_TYPE_8192E(pAdapter))
+               return (IS_MASKED(8192E, _MUSB, Offset)) ? TRUE : FALSE;
+#endif
+#if defined(CONFIG_RTL8723B)
+       if (IS_HARDWARE_TYPE_8723B(pAdapter))
+               return (IS_MASKED(8723B, _MUSB, Offset)) ? TRUE : FALSE;
+#endif
+#if defined(CONFIG_RTL8703B)
+       if (IS_HARDWARE_TYPE_8703B(pAdapter))
+               return (IS_MASKED(8703B, _MUSB, Offset)) ? TRUE : FALSE;
+#endif
+#if defined(CONFIG_RTL8814A)
+       if (IS_HARDWARE_TYPE_8814A(pAdapter))
+               return (IS_MASKED(8814A, _MUSB, Offset)) ? TRUE : FALSE;
+#endif
+#if defined(CONFIG_RTL8188F)
+       if (IS_HARDWARE_TYPE_8188F(pAdapter))
+               return (IS_MASKED(8188F, _MUSB, Offset)) ? TRUE : FALSE;
+#endif
+#if defined(CONFIG_RTL8822B)
+       if (IS_HARDWARE_TYPE_8822B(pAdapter))
+               return (IS_MASKED(8822B, _MUSB, Offset)) ? TRUE : FALSE;
+#endif
+#if defined(CONFIG_RTL8723D)
+       if (IS_HARDWARE_TYPE_8723D(pAdapter))
+               return (IS_MASKED(8723D, _MUSB, Offset)) ? TRUE : FALSE;
+#endif
+
+       /*#if defined(CONFIG_RTL8821C)
+               if (IS_HARDWARE_TYPE_8821C(pAdapter))
+                       return (IS_MASKED(8821C,_MUSB,Offset)) ? TRUE : FALSE;
+       #endif*/
+
+#elif DEV_BUS_TYPE == RT_PCI_INTERFACE
+#if defined(CONFIG_RTL8188E)
+       if (IS_HARDWARE_TYPE_8188E(pAdapter))
+               return (IS_MASKED(8188E, _MPCIE, Offset)) ? TRUE : FALSE;
+#endif
+#if defined(CONFIG_RTL8192E)
+       if (IS_HARDWARE_TYPE_8192E(pAdapter))
+               return (IS_MASKED(8192E, _MPCIE, Offset)) ? TRUE : FALSE;
+#endif
+#if defined(CONFIG_RTL8812A)
+       if (IS_HARDWARE_TYPE_8812(pAdapter))
+               return (IS_MASKED(8812A, _MPCIE, Offset)) ? TRUE : FALSE;
+#endif
+#if defined(CONFIG_RTL8821A)
+       if (IS_HARDWARE_TYPE_8821(pAdapter))
+               return (IS_MASKED(8821A, _MPCIE, Offset)) ? TRUE : FALSE;
+#endif
+#if defined(CONFIG_RTL8723B)
+       if (IS_HARDWARE_TYPE_8723B(pAdapter))
+               return (IS_MASKED(8723B, _MPCIE, Offset)) ? TRUE : FALSE;
+#endif
+#if defined(CONFIG_RTL8814A)
+       if (IS_HARDWARE_TYPE_8814A(pAdapter))
+               return (IS_MASKED(8814A, _MPCIE, Offset)) ? TRUE : FALSE;
+#endif
+#if defined(CONFIG_RTL8822B)
+       if (IS_HARDWARE_TYPE_8822B(pAdapter))
+               return (IS_MASKED(8822B, _MPCIE, Offset)) ? TRUE : FALSE;
+#endif
+
+#elif DEV_BUS_TYPE == RT_SDIO_INTERFACE
+#ifdef CONFIG_RTL8188E_SDIO
+       if (IS_HARDWARE_TYPE_8188E(pAdapter))
+               return (IS_MASKED(8188E, _MSDIO, Offset)) ? TRUE : FALSE;
+#endif
+#ifdef CONFIG_RTL8188F_SDIO
+       if (IS_HARDWARE_TYPE_8188F(pAdapter))
+               return (IS_MASKED(8188F, _MSDIO, Offset)) ? TRUE : FALSE;
+#endif
+#if defined(CONFIG_RTL8821C)
+       if (IS_HARDWARE_TYPE_8821C(pAdapter))
+               return (IS_MASKED(8821C, _MSDIO, Offset)) ? TRUE : FALSE;
+#endif
+#if defined(CONFIG_RTL8822B)
+       if (IS_HARDWARE_TYPE_8822B(pAdapter))
+               return (IS_MASKED(8822B, _MSDIO, Offset)) ? TRUE : FALSE;
+#endif
+#endif
+
+       return FALSE;
+}
+
+void rtw_efuse_mask_array(PADAPTER pAdapter, u8 *pArray)
+{
+       PHAL_DATA_TYPE pHalData = GET_HAL_DATA(pAdapter);
+
+#if DEV_BUS_TYPE == RT_USB_INTERFACE
+#if defined(CONFIG_RTL8188E)
+       if (IS_HARDWARE_TYPE_8188E(pAdapter))
+               GET_MASK_ARRAY(8188E, _MUSB, pArray);
+#endif
+#if defined(CONFIG_RTL8812A)
+       if (IS_HARDWARE_TYPE_8812(pAdapter))
+               GET_MASK_ARRAY(8812A, _MUSB, pArray);
+#endif
+#if defined(CONFIG_RTL8821A)
+       if (IS_HARDWARE_TYPE_8821(pAdapter))
+               GET_MASK_ARRAY(8821A, _MUSB, pArray);
+#endif
+#if defined(CONFIG_RTL8192E)
+       if (IS_HARDWARE_TYPE_8192E(pAdapter))
+               GET_MASK_ARRAY(8192E, _MUSB, pArray);
+#endif
+#if defined(CONFIG_RTL8723B)
+       if (IS_HARDWARE_TYPE_8723B(pAdapter))
+               GET_MASK_ARRAY(8723B, _MUSB, pArray);
+#endif
+#if defined(CONFIG_RTL8703B)
+       if (IS_HARDWARE_TYPE_8703B(pAdapter))
+               GET_MASK_ARRAY(8703B, _MUSB, pArray);
+#endif
+#if defined(CONFIG_RTL8188F)
+       if (IS_HARDWARE_TYPE_8188F(pAdapter))
+               GET_MASK_ARRAY(8188F, _MUSB, pArray);
+#endif
+#if defined(CONFIG_RTL8814A)
+       if (IS_HARDWARE_TYPE_8814A(pAdapter))
+               GET_MASK_ARRAY(8814A, _MUSB, pArray);
+#endif
+#if defined(CONFIG_RTL8822B)
+       if (IS_HARDWARE_TYPE_8822B(pAdapter))
+               GET_MASK_ARRAY(8822B, _MUSB, pArray);
+#endif
+       /*#if defined(CONFIG_RTL8821C)
+               if (IS_HARDWARE_TYPE_8821C(pAdapter))
+                       GET_MASK_ARRAY(8821C,_MUSB,pArray);
+       #endif*/
+#elif DEV_BUS_TYPE == RT_PCI_INTERFACE
+#if defined(CONFIG_RTL8188E)
+       if (IS_HARDWARE_TYPE_8188E(pAdapter))
+               GET_MASK_ARRAY(8188E, _MPCIE, pArray);
+#endif
+#if defined(CONFIG_RTL8192E)
+       if (IS_HARDWARE_TYPE_8192E(pAdapter))
+               GET_MASK_ARRAY(8192E, _MPCIE, pArray);
+#endif
+#if defined(CONFIG_RTL8812A)
+       if (IS_HARDWARE_TYPE_8812(pAdapter))
+               GET_MASK_ARRAY(8812A, _MPCIE, pArray);
+#endif
+#if defined(CONFIG_RTL8821A)
+       if (IS_HARDWARE_TYPE_8821(pAdapter))
+               GET_MASK_ARRAY(8821A, _MPCIE, pArray);
+#endif
+#if defined(CONFIG_RTL8723B)
+       if (IS_HARDWARE_TYPE_8723B(pAdapter))
+               GET_MASK_ARRAY(8723B, _MPCIE, pArray);
+#endif
+#if defined(CONFIG_RTL8814A)
+       if (IS_HARDWARE_TYPE_8814A(pAdapter))
+               GET_MASK_ARRAY(8814A, _MPCIE, pArray);
+#endif
+#if defined(CONFIG_RTL8822B)
+       if (IS_HARDWARE_TYPE_8822B(pAdapter))
+               GET_MASK_ARRAY(8822B, _MPCIE, pArray);
+#endif
+#elif DEV_BUS_TYPE == RT_SDIO_INTERFACE
+#if defined(CONFIG_RTL8188E)
+       if (IS_HARDWARE_TYPE_8188E(pAdapter))
+               GET_MASK_ARRAY(8188E, _MSDIO, pArray);
+#endif
+#if defined(CONFIG_RTL8188F)
+       if (IS_HARDWARE_TYPE_8188F(pAdapter))
+               GET_MASK_ARRAY(8188F, _MSDIO, pArray);
+#endif
+#if defined(CONFIG_RTL8821C)
+       if (IS_HARDWARE_TYPE_8821C(pAdapter))
+               GET_MASK_ARRAY(8821C , _MSDIO, pArray);
+#endif
+#if defined(CONFIG_RTL8822B)
+       if (IS_HARDWARE_TYPE_8822B(pAdapter))
+               GET_MASK_ARRAY(8822B , _MSDIO, pArray);
+#endif
+#endif /*#elif DEV_BUS_TYPE == RT_SDIO_INTERFACE*/
+}
+
+u16 rtw_get_efuse_mask_arraylen(PADAPTER pAdapter)
+{
+       HAL_DATA_TYPE   *pHalData = GET_HAL_DATA(pAdapter);
+
+#if DEV_BUS_TYPE == RT_USB_INTERFACE
+#if defined(CONFIG_RTL8188E)
+       if (IS_HARDWARE_TYPE_8188E(pAdapter))
+               return GET_MASK_ARRAY_LEN(8188E, _MUSB);
+#endif
+#if defined(CONFIG_RTL8812A)
+       if (IS_HARDWARE_TYPE_8812(pAdapter))
+               return GET_MASK_ARRAY_LEN(8812A, _MUSB);
+#endif
+#if defined(CONFIG_RTL8821A)
+       if (IS_HARDWARE_TYPE_8821(pAdapter))
+               return GET_MASK_ARRAY_LEN(8821A, _MUSB);
+#endif
+#if defined(CONFIG_RTL8192E)
+       if (IS_HARDWARE_TYPE_8192E(pAdapter))
+               return GET_MASK_ARRAY_LEN(8192E, _MUSB);
+#endif
+#if defined(CONFIG_RTL8723B)
+       if (IS_HARDWARE_TYPE_8723B(pAdapter))
+               return GET_MASK_ARRAY_LEN(8723B, _MUSB);
+#endif
+#if defined(CONFIG_RTL8703B)
+       if (IS_HARDWARE_TYPE_8703B(pAdapter))
+               return GET_MASK_ARRAY_LEN(8703B, _MUSB);
+#endif
+#if defined(CONFIG_RTL8188F)
+       if (IS_HARDWARE_TYPE_8188F(pAdapter))
+               return GET_MASK_ARRAY_LEN(8188F, _MUSB);
+#endif
+#if defined(CONFIG_RTL8814A)
+       if (IS_HARDWARE_TYPE_8814A(pAdapter))
+               return GET_MASK_ARRAY_LEN(8814A, _MUSB);
+#endif
+#if defined(CONFIG_RTL8822B)
+       if (IS_HARDWARE_TYPE_8822B(pAdapter))
+               return GET_MASK_ARRAY_LEN(8822B, _MUSB);
+#endif
+       /*#if defined(CONFIG_RTL8821C)
+               if (IS_HARDWARE_TYPE_8821C(pAdapter))
+                       return GET_MASK_ARRAY_LEN(8821C,_MUSB);
+       #endif*/
+#elif DEV_BUS_TYPE == RT_PCI_INTERFACE
+#if defined(CONFIG_RTL8188E)
+       if (IS_HARDWARE_TYPE_8188E(pAdapter))
+               return GET_MASK_ARRAY_LEN(8188E, _MPCIE);
+#endif
+#if defined(CONFIG_RTL8192E)
+       if (IS_HARDWARE_TYPE_8192E(pAdapter))
+               return GET_MASK_ARRAY_LEN(8192E, _MPCIE);
+#endif
+#if defined(CONFIG_RTL8812A)
+       if (IS_HARDWARE_TYPE_8812(pAdapter))
+               return GET_MASK_ARRAY_LEN(8812A, _MPCIE);
+#endif
+#if defined(CONFIG_RTL8821A)
+       if (IS_HARDWARE_TYPE_8821(pAdapter))
+               return GET_MASK_ARRAY_LEN(8821A, _MPCIE);
+#endif
+#if defined(CONFIG_RTL8723B)
+       if (IS_HARDWARE_TYPE_8723B(pAdapter))
+               return GET_MASK_ARRAY_LEN(8723B, _MPCIE);
+#endif
+#if defined(CONFIG_RTL8814A)
+       if (IS_HARDWARE_TYPE_8814A(pAdapter))
+               return GET_MASK_ARRAY_LEN(8814A, _MPCIE);
+#endif
+#if defined(CONFIG_RTL8822B)
+       if (IS_HARDWARE_TYPE_8822B(pAdapter))
+               return GET_MASK_ARRAY_LEN(8822B, _MPCIE);
+#endif
+#elif DEV_BUS_TYPE == RT_SDIO_INTERFACE
+#if defined(CONFIG_RTL8188E)
+       if (IS_HARDWARE_TYPE_8188E(pAdapter))
+               return GET_MASK_ARRAY_LEN(8188E, _MSDIO);
+#endif
+#if defined(CONFIG_RTL8188F)
+       if (IS_HARDWARE_TYPE_8188F(pAdapter))
+               return GET_MASK_ARRAY_LEN(8188F, _MSDIO);
+#endif
+#if defined(CONFIG_RTL8821C)
+       if (IS_HARDWARE_TYPE_8821C(pAdapter))
+               return GET_MASK_ARRAY_LEN(8821C, _MSDIO);
+#endif
+#if defined(CONFIG_RTL8822B)
+       if (IS_HARDWARE_TYPE_8822B(pAdapter))
+               return GET_MASK_ARRAY_LEN(8822B, _MSDIO);
+#endif
+#endif
+       return 0;
+}
+
+u8 rtw_efuse_mask_map_read(PADAPTER padapter, u16 addr, u16 cnts, u8 *data)
+{
+       u8      ret = _SUCCESS;
+       u16     mapLen = 0, i = 0;
+
+       EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI, TYPE_EFUSE_MAP_LEN, (PVOID)&mapLen, _FALSE);
+
+       ret = rtw_efuse_map_read(padapter, addr, cnts , data);
+
+       if (padapter->registrypriv.boffefusemask == 0) {
+
+               for (i = 0; i < cnts; i++) {
+                       if (padapter->registrypriv.bFileMaskEfuse == _TRUE) {
+                               if (rtw_file_efuse_IsMasked(padapter, addr + i)) /*use file efuse mask.*/
+                                       data[i] = 0xff;
+                       } else {
+                               /*RTW_INFO(" %s , data[%d] = %x\n", __func__, i, data[i]);*/
+                               if (efuse_IsMasked(padapter, addr + i)) {
+                                       data[i] = 0xff;
+                                       /*RTW_INFO(" %s ,mask data[%d] = %x\n", __func__, i, data[i]);*/
+                               }
+                       }
+               }
+
+       }
+       return ret;
+
+}
+
+
+#ifdef RTW_HALMAC
+#include "../../hal/hal_halmac.h"
+
+void Efuse_PowerSwitch(PADAPTER adapter, u8 write, u8 pwrstate)
+{
+}
+
+void BTEfuse_PowerSwitch(PADAPTER adapter, u8 write, u8 pwrstate)
+{
+}
+
+u8 efuse_GetCurrentSize(PADAPTER adapter, u16 *size)
+{
+       *size = 0;
+
+       return _FAIL;
+}
+
+u16 efuse_GetMaxSize(PADAPTER adapter)
+{
+       struct dvobj_priv *d;
+       u32 size = 0;
+       int err;
+
+       d = adapter_to_dvobj(adapter);
+       err = rtw_halmac_get_physical_efuse_size(d, &size);
+       if (err)
+               return 0;
+
+       return size;
+}
+
+u16 efuse_GetavailableSize(PADAPTER adapter)
+{
+       struct dvobj_priv *d;
+       u32 size = 0;
+       int err;
+
+       d = adapter_to_dvobj(adapter);
+       err = rtw_halmac_get_available_efuse_size(d, &size);
+       if (err)
+               return 0;
+
+       return size;
+}
+
+
+u8 efuse_bt_GetCurrentSize(PADAPTER adapter, u16 *usesize)
+{
+       u8 *efuse_map;
+
+       *usesize = 0;
+       efuse_map = rtw_malloc(EFUSE_BT_MAP_LEN);
+       if (efuse_map == NULL) {
+               RTW_DBG("%s: malloc FAIL\n", __FUNCTION__);
+               return _FAIL;
+       }
+
+       /* for get bt phy efuse last use byte */
+       hal_ReadEFuse_BT_logic_map(adapter, 0x00, EFUSE_BT_MAP_LEN, efuse_map);
+       *usesize = fakeBTEfuseUsedBytes;
+
+       if (efuse_map)
+               rtw_mfree(efuse_map, EFUSE_BT_MAP_LEN);
+
+       return _SUCCESS;
+}
+
+u16 efuse_bt_GetMaxSize(PADAPTER adapter)
+{
+       return EFUSE_BT_REAL_CONTENT_LEN;
+}
+
+void EFUSE_GetEfuseDefinition(PADAPTER adapter, u8 efusetype, u8 type, void *out, BOOLEAN test)
+{
+       struct dvobj_priv *d;
+       u32 v32 = 0;
+
+
+       d = adapter_to_dvobj(adapter);
+
+       if (adapter->hal_func.EFUSEGetEfuseDefinition) {
+               adapter->hal_func.EFUSEGetEfuseDefinition(adapter, efusetype, type, out, test);
+               return;
+       }
+
+       if (EFUSE_WIFI == efusetype) {
+               switch (type) {
+               case TYPE_EFUSE_MAP_LEN:
+                       rtw_halmac_get_logical_efuse_size(d, &v32);
+                       *(u16 *)out = (u16)v32;
+                       return;
+
+               case TYPE_EFUSE_REAL_CONTENT_LEN:       
+                       rtw_halmac_get_physical_efuse_size(d, &v32);
+                       *(u16 *)out = (u16)v32;
+                       return;
+               }
+       } else if (EFUSE_BT == efusetype) {
+               switch (type) {
+               case TYPE_EFUSE_MAP_LEN:
+                       *(u16 *)out = EFUSE_BT_MAP_LEN;
+                       return;
+
+               case TYPE_EFUSE_REAL_CONTENT_LEN:
+                       *(u16 *)out = EFUSE_BT_REAL_CONTENT_LEN;
+                       return;
+               }
+       }
+}
+
+/*
+ * read/write raw efuse data
+ */
+u8 rtw_efuse_access(PADAPTER adapter, u8 write, u16 addr, u16 cnts, u8 *data)
+{
+       struct dvobj_priv *d;
+       u8 *efuse = NULL;
+       u32 size, i;
+       int err;
+
+
+       d = adapter_to_dvobj(adapter);
+       err = rtw_halmac_get_physical_efuse_size(d, &size);
+       if (err)
+               size = EFUSE_MAX_SIZE;
+
+       if ((addr + cnts) > size)
+               return _FAIL;
+
+       if (_TRUE == write) {
+               err = rtw_halmac_write_physical_efuse(d, addr, cnts, data);
+               if (err)
+                       return _FAIL;
+       } else {
+               if (cnts > 16)
+                       efuse = rtw_zmalloc(size);
+
+               if (efuse) {
+                       err = rtw_halmac_read_physical_efuse_map(d, efuse, size);
+                       if (err) {
+                               rtw_mfree(efuse, size);
+                               return _FAIL;
+                       }
+
+                       _rtw_memcpy(data, efuse + addr, cnts);
+                       rtw_mfree(efuse, size);
+               } else {
+                       err = rtw_halmac_read_physical_efuse(d, addr, cnts, data);
+                       if (err)
+                               return _FAIL;
+               }
+       }
+
+       return _SUCCESS;
+}
+
+static inline void dump_buf(u8 *buf, u32 len)
+{
+       u32 i;
+
+       RTW_INFO("-----------------Len %d----------------\n", len);
+       for (i = 0; i < len; i++)
+               printk("%2.2x-", *(buf + i));
+       printk("\n");
+}
+
+/*
+ * read/write raw efuse data
+ */
+u8 rtw_efuse_bt_access(PADAPTER adapter, u8 write, u16 addr, u16 cnts, u8 *data)
+{
+       struct dvobj_priv *d;
+       u8 *efuse = NULL;
+       u32 size, i;
+       int err = _FAIL;
+
+
+       d = adapter_to_dvobj(adapter);
+
+       size = EFUSE_BT_REAL_CONTENT_LEN;
+
+       if ((addr + cnts) > size)
+               return _FAIL;
+
+       if (_TRUE == write) {
+               err = rtw_halmac_write_bt_physical_efuse(d, addr, cnts, data);
+               if (err == -1) {
+                       RTW_ERR("%s: rtw_halmac_write_bt_physical_efuse fail!\n", __FUNCTION__);
+                       return _FAIL;
+               }
+               RTW_INFO("%s: rtw_halmac_write_bt_physical_efuse OK! data 0x%x\n", __FUNCTION__, *data);
+       } else {
+               efuse = rtw_zmalloc(size);
+
+               if (efuse) {
+                       err = rtw_halmac_read_bt_physical_efuse_map(d, efuse, size);
+                       
+                       if (err == -1) {
+                               RTW_ERR("%s: rtw_halmac_read_bt_physical_efuse_map fail!\n", __FUNCTION__);
+                               rtw_mfree(efuse, size);
+                               return _FAIL;
+                       }
+                       dump_buf(efuse + addr, cnts);
+
+                       _rtw_memcpy(data, efuse + addr, cnts);
+
+                       RTW_INFO("%s: rtw_halmac_read_bt_physical_efuse_map ok! data 0x%x\n", __FUNCTION__, *data);
+                       rtw_mfree(efuse, size);
+               }
+       }
+
+       return _SUCCESS;
+}
+
+u8 rtw_efuse_map_read(PADAPTER adapter, u16 addr, u16 cnts, u8 *data)
+{
+       struct dvobj_priv *d;
+       u8 *efuse = NULL;
+       u32 size, i;
+       int err;
+
+
+       d = adapter_to_dvobj(adapter);
+       err = rtw_halmac_get_logical_efuse_size(d, &size);
+       if (err)
+               return _FAIL;
+
+       /* size error handle */
+       if ((addr + cnts) > size) {
+               if (addr < size)
+                       cnts = size - addr;
+               else
+                       return _FAIL;
+       }
+
+       if (cnts > 16)
+               efuse = rtw_zmalloc(size);
+
+       if (efuse) {
+               err = rtw_halmac_read_logical_efuse_map(d, efuse, size);
+               if (err) {
+                       rtw_mfree(efuse, size);
+                       return _FAIL;
+               }
+
+               _rtw_memcpy(data, efuse + addr, cnts);
+               rtw_mfree(efuse, size);
+       } else {
+               err = rtw_halmac_read_logical_efuse(d, addr, cnts, data);
+               if (err)
+                       return _FAIL;
+       }
+
+       return _SUCCESS;
+}
+
+u8 rtw_efuse_map_write(PADAPTER adapter, u16 addr, u16 cnts, u8 *data)
+{
+       struct dvobj_priv *d;
+       u8 *efuse = NULL;
+       u32 size, i;
+       int err;
+       u8 mask_buf[64] = "";
+       u16 mask_len = sizeof(u8) * rtw_get_efuse_mask_arraylen(adapter);
+
+       d = adapter_to_dvobj(adapter);
+       err = rtw_halmac_get_logical_efuse_size(d, &size);
+       if (err)
+               return _FAIL;
+
+       if ((addr + cnts) > size)
+               return _FAIL;
+
+       efuse = rtw_zmalloc(size);
+       if (!efuse)
+               return _FAIL;
+
+       err = rtw_halmac_read_logical_efuse_map(d, efuse, size);
+       if (err) {
+               rtw_mfree(efuse, size);
+               return _FAIL;
+       }
+
+       _rtw_memcpy(efuse + addr, data, cnts);
+
+       if (adapter->registrypriv.boffefusemask == 0) {
+               RTW_INFO("Use mask Array Len: %d\n", mask_len);
+
+               if (mask_len != 0) {
+                       if (adapter->registrypriv.bFileMaskEfuse == _TRUE)
+                               _rtw_memcpy(mask_buf, maskfileBuffer, mask_len);
+                       else
+                               rtw_efuse_mask_array(adapter, mask_buf);
+
+                       err = rtw_halmac_write_logical_efuse_map(d, efuse, size, mask_buf, mask_len);
+               } else
+                       err = rtw_halmac_write_logical_efuse_map(d, efuse, size, NULL, 0);
+       } else {
+               _rtw_memset(mask_buf, 0xFF, sizeof(mask_buf));
+               RTW_INFO("Efuse mask off\n");
+               err = rtw_halmac_write_logical_efuse_map(d, efuse, size, mask_buf, size/16);
+       }
+
+       if (err) {
+               rtw_mfree(efuse, size);
+               return _FAIL;
+       }
+
+       rtw_mfree(efuse, size);
+
+       return _SUCCESS;
+}
+
+int Efuse_PgPacketRead(PADAPTER adapter, u8 offset, u8 *data, BOOLEAN test)
+{
+       return _FALSE;
+}
+
+int Efuse_PgPacketWrite(PADAPTER adapter, u8 offset, u8 word_en, u8 *data, BOOLEAN test)
+{
+       return _FALSE;
+}
+
+u8 rtw_BT_efuse_map_read(PADAPTER adapter, u16 addr, u16 cnts, u8 *data)
+{
+       hal_ReadEFuse_BT_logic_map(adapter,addr, cnts, data);
+
+       return _SUCCESS;
+}
+
+u8 rtw_BT_efuse_map_write(PADAPTER adapter, u16 addr, u16 cnts, u8 *data)
+{
+#define RT_ASSERT_RET(expr)                                                                    \
+       if (!(expr)) {                                                                          \
+               printk("Assertion failed! %s at ......\n", #expr);                              \
+               printk("          ......%s,%s, line=%d\n",__FILE__, __FUNCTION__, __LINE__);    \
+               return _FAIL;   \
+       }
+
+       u8      offset, word_en;
+       u8      *map;
+       u8      newdata[PGPKT_DATA_SIZE];
+       s32 i = 0, j = 0, idx;
+       u8      ret = _SUCCESS;
+       u16 mapLen = 1024;
+
+       if ((addr + cnts) > mapLen)
+               return _FAIL;
+
+       RT_ASSERT_RET(PGPKT_DATA_SIZE == 8); /* have to be 8 byte alignment */
+       RT_ASSERT_RET((mapLen & 0x7) == 0); /* have to be PGPKT_DATA_SIZE alignment for memcpy */
+
+       map = rtw_zmalloc(mapLen);
+       if (map == NULL)
+               return _FAIL;
+
+       ret = rtw_BT_efuse_map_read(adapter, 0, mapLen, map);
+       if (ret == _FAIL)
+               goto exit;
+       RTW_INFO("OFFSET\tVALUE(hex)\n");
+       for (i = 0; i < mapLen; i += 16) { /* set 512 because the iwpriv's extra size have limit 0x7FF */
+               RTW_INFO("0x%03x\t", i);
+               for (j = 0; j < 8; j++)
+                       RTW_INFO("%02X ", map[i + j]);
+               RTW_INFO("\t");
+               for (; j < 16; j++)
+                       RTW_INFO("%02X ", map[i + j]);
+               RTW_INFO("\n");
+       }
+       RTW_INFO("\n");
+
+       idx = 0;
+       offset = (addr >> 3);
+       while (idx < cnts) {
+               word_en = 0xF;
+               j = (addr + idx) & 0x7;
+               _rtw_memcpy(newdata, &map[offset << 3], PGPKT_DATA_SIZE);
+               for (i = j; i < PGPKT_DATA_SIZE && idx < cnts; i++, idx++) {
+                       if (data[idx] != map[addr + idx]) {
+                               word_en &= ~BIT(i >> 1);
+                               newdata[i] = data[idx];
+                       }
+               }
+
+               if (word_en != 0xF) {
+                       ret = EfusePgPacketWrite_BT(adapter, offset, word_en, newdata, _FALSE);
+                       RTW_INFO("offset=%x\n", offset);
+                       RTW_INFO("word_en=%x\n", word_en);
+                       RTW_INFO("%s: data=", __FUNCTION__);
+                       for (i = 0; i < PGPKT_DATA_SIZE; i++)
+                               RTW_INFO("0x%02X ", newdata[i]);
+                       RTW_INFO("\n");
+                       if (ret == _FAIL)
+                               break;
+               }
+               offset++;
+       }
+exit:
+       rtw_mfree(map, mapLen);
+       return _SUCCESS;
+}
+
+VOID hal_ReadEFuse_BT_logic_map(
+       PADAPTER        padapter,
+       u16                     _offset,
+       u16                     _size_byte,
+       u8                      *pbuf
+)
+{
+
+       PHAL_DATA_TYPE  pHalData = GET_HAL_DATA(padapter);
+       PEFUSE_HAL              pEfuseHal = &pHalData->EfuseHal;
+
+       u8      *efuseTbl, *phyefuse;
+       u8      bank;
+       u16     eFuse_Addr = 0;
+       u8      efuseHeader, efuseExtHdr, efuseData;
+       u8      offset, wden;
+       u16     i, total, used;
+       u8      efuse_usage;
+
+
+       /* */
+       /* Do NOT excess total size of EFuse table. Added by Roger, 2008.11.10. */
+       /* */
+       if ((_offset + _size_byte) > EFUSE_BT_MAP_LEN) {
+               RTW_INFO("%s: Invalid offset(%#x) with read bytes(%#x)!!\n", __FUNCTION__, _offset, _size_byte);
+               return;
+       }
+
+       efuseTbl = rtw_malloc(EFUSE_BT_MAP_LEN);
+       phyefuse = rtw_malloc(EFUSE_BT_REAL_CONTENT_LEN);
+       if (efuseTbl == NULL || phyefuse == NULL) {
+               RTW_INFO("%s: efuseTbl or phyefuse malloc fail!\n", __FUNCTION__);
+               goto exit;
+       }
+
+       /* 0xff will be efuse default value instead of 0x00. */
+       _rtw_memset(efuseTbl, 0xFF, EFUSE_BT_MAP_LEN);
+       _rtw_memset(phyefuse, 0xFF, EFUSE_BT_REAL_CONTENT_LEN);
+
+       if (rtw_efuse_bt_access(padapter, _FALSE, 0, EFUSE_BT_REAL_CONTENT_LEN, phyefuse))
+               dump_buf(phyefuse, EFUSE_BT_REAL_BANK_CONTENT_LEN);
+       
+       total = BANK_NUM;
+       for (bank = 1; bank <= total; bank++) { /* 8723d Max bake 0~2 */
+               eFuse_Addr = 0;
+
+               while (AVAILABLE_EFUSE_ADDR(eFuse_Addr)) {
+                       /* ReadEFuseByte(padapter, eFuse_Addr++, &efuseHeader, bPseudoTest); */
+                       efuseHeader = phyefuse[eFuse_Addr++];
+
+                       if (efuseHeader == 0xFF)
+                               break;
+                       RTW_INFO("%s: efuse[%#X]=0x%02x (header)\n", __FUNCTION__, (((bank - 1) * EFUSE_BT_REAL_CONTENT_LEN) + eFuse_Addr - 1), efuseHeader);
+
+                       /* Check PG header for section num. */
+                       if (EXT_HEADER(efuseHeader)) {  /* extended header */
+                               offset = GET_HDR_OFFSET_2_0(efuseHeader);
+                               RTW_INFO("%s: extended header offset_2_0=0x%X\n", __FUNCTION__, offset);
+
+                               /* ReadEFuseByte(padapter, eFuse_Addr++, &efuseExtHdr, bPseudoTest); */
+                               efuseExtHdr = phyefuse[eFuse_Addr++];
+
+                               RTW_INFO("%s: efuse[%#X]=0x%02x (ext header)\n", __FUNCTION__, (((bank - 1) * EFUSE_BT_REAL_CONTENT_LEN) + eFuse_Addr - 1), efuseExtHdr);
+                               if (ALL_WORDS_DISABLED(efuseExtHdr))
+                                       continue;
+
+                               offset |= ((efuseExtHdr & 0xF0) >> 1);
+                               wden = (efuseExtHdr & 0x0F);
+                       } else {
+                               offset = ((efuseHeader >> 4) & 0x0f);
+                               wden = (efuseHeader & 0x0f);
+                       }
+
+                       if (offset < EFUSE_BT_MAX_SECTION) {
+                               u16 addr;
+
+                               /* Get word enable value from PG header */
+                               RTW_INFO("%s: Offset=%d Worden=%#X\n", __FUNCTION__, offset, wden);
+
+                               addr = offset * PGPKT_DATA_SIZE;
+                               for (i = 0; i < EFUSE_MAX_WORD_UNIT; i++) {
+                                       /* Check word enable condition in the section */
+                                       if (!(wden & (0x01 << i))) {
+                                               efuseData = 0;
+                                               /* ReadEFuseByte(padapter, eFuse_Addr++, &efuseData, bPseudoTest); */
+                                               efuseData = phyefuse[eFuse_Addr++];
+
+                                               RTW_INFO("%s: efuse[%#X]=0x%02X\n", __FUNCTION__, eFuse_Addr - 1, efuseData);
+                                               efuseTbl[addr] = efuseData;
+
+                                               efuseData = 0;
+                                               /* ReadEFuseByte(padapter, eFuse_Addr++, &efuseData, bPseudoTest); */
+                                               efuseData = phyefuse[eFuse_Addr++];
+
+                                               RTW_INFO("%s: efuse[%#X]=0x%02X\n", __FUNCTION__, eFuse_Addr - 1, efuseData);
+                                               efuseTbl[addr + 1] = efuseData;
+                                       }
+                                       addr += 2;
+                               }
+                       } else {
+                               RTW_INFO("%s: offset(%d) is illegal!!\n", __FUNCTION__, offset);
+                               eFuse_Addr += Efuse_CalculateWordCnts(wden) * 2;
+                       }
+               }
+
+               if ((eFuse_Addr - 1) < total) {
+                       RTW_INFO("%s: bank(%d) data end at %#x\n", __FUNCTION__, bank, eFuse_Addr - 1);
+                       break;
+               }
+       }
+
+       /* switch bank back to bank 0 for later BT and wifi use. */
+       //hal_EfuseSwitchToBank(padapter, 0, bPseudoTest);
+
+       /* Copy from Efuse map to output pointer memory!!! */
+       for (i = 0; i < _size_byte; i++)
+               pbuf[i] = efuseTbl[_offset + i];
+       /* Calculate Efuse utilization */
+       total = EFUSE_BT_REAL_BANK_CONTENT_LEN;
+
+       used = eFuse_Addr - 1;
+
+       if (total)
+               efuse_usage = (u8)((used * 100) / total);
+       else
+               efuse_usage = 100;
+
+       fakeBTEfuseUsedBytes = used;
+       RTW_INFO("%s: BTEfuseUsed last Bytes = %#x\n", __FUNCTION__, fakeBTEfuseUsedBytes);
+
+exit:
+       if (efuseTbl)
+               rtw_mfree(efuseTbl, EFUSE_BT_MAP_LEN);
+       if (phyefuse)
+               rtw_mfree(phyefuse, EFUSE_BT_REAL_BANK_CONTENT_LEN);
+}
+
+
+static u8 hal_EfusePartialWriteCheck(
+       PADAPTER                padapter,
+       u8                              efuseType,
+       u16                             *pAddr,
+       PPGPKT_STRUCT   pTargetPkt,
+       u8                              bPseudoTest)
+{
+       PHAL_DATA_TYPE  pHalData = GET_HAL_DATA(padapter);
+       PEFUSE_HAL              pEfuseHal = &pHalData->EfuseHal;
+       u8      bRet = _FALSE;
+       u16     startAddr = 0, efuse_max_available_len = EFUSE_BT_REAL_BANK_CONTENT_LEN, efuse_max = EFUSE_BT_REAL_BANK_CONTENT_LEN;
+       u8      efuse_data = 0;
+
+       startAddr = (u16)fakeBTEfuseUsedBytes;
+
+       startAddr %= efuse_max;
+       RTW_INFO("%s: startAddr=%#X\n", __FUNCTION__, startAddr);
+
+       while (1) {
+               if (startAddr >= efuse_max_available_len) {
+                       bRet = _FALSE;
+                       RTW_INFO("%s: startAddr(%d) >= efuse_max_available_len(%d)\n",
+                               __FUNCTION__, startAddr, efuse_max_available_len);
+                       break;
+               }
+               if (rtw_efuse_bt_access(padapter, _FALSE, startAddr, 1, &efuse_data)&& (efuse_data != 0xFF)) {
+                       bRet = _FALSE;
+                       RTW_INFO("%s: Something Wrong! last bytes(%#X=0x%02X) is not 0xFF\n",
+                                __FUNCTION__, startAddr, efuse_data);
+                       break;
+               } else {
+                       /* not used header, 0xff */
+                       *pAddr = startAddr;
+                       /*                      RTW_INFO("%s: Started from unused header offset=%d\n", __FUNCTION__, startAddr)); */
+                       bRet = _TRUE;
+                       break;
+               }
+       }
+
+       return bRet;
+}
+
+
+static u8 hal_EfusePgPacketWrite2ByteHeader(
+       PADAPTER                padapter,
+       u8                              efuseType,
+       u16                             *pAddr,
+       PPGPKT_STRUCT   pTargetPkt,
+       u8                              bPseudoTest)
+{
+       u16     efuse_addr, efuse_max_available_len = EFUSE_BT_REAL_BANK_CONTENT_LEN;
+       u8      pg_header = 0, tmp_header = 0;
+       u8      repeatcnt = 0;
+
+       /*      RTW_INFO("%s\n", __FUNCTION__); */
+
+       efuse_addr = *pAddr;
+       if (efuse_addr >= efuse_max_available_len) {
+               RTW_INFO("%s: addr(%d) over avaliable(%d)!!\n", __FUNCTION__, efuse_addr, efuse_max_available_len);
+               return _FALSE;
+       }
+
+       pg_header = ((pTargetPkt->offset & 0x07) << 5) | 0x0F;
+       /*      RTW_INFO("%s: pg_header=0x%x\n", __FUNCTION__, pg_header); */
+
+       do {
+               
+               rtw_efuse_bt_access(padapter, _TRUE, efuse_addr, 1, &pg_header);
+               rtw_efuse_bt_access(padapter, _FALSE, efuse_addr, 1, &tmp_header);
+
+               if (tmp_header != 0xFF)
+                       break;
+               if (repeatcnt++ > EFUSE_REPEAT_THRESHOLD_) {
+                       RTW_INFO("%s: Repeat over limit for pg_header!!\n", __FUNCTION__);
+                       return _FALSE;
+               }
+       } while (1);
+
+       if (tmp_header != pg_header) {
+               RTW_ERR("%s: PG Header Fail!!(pg=0x%02X read=0x%02X)\n", __FUNCTION__, pg_header, tmp_header);
+               return _FALSE;
+       }
+
+       /* to write ext_header */
+       efuse_addr++;
+       pg_header = ((pTargetPkt->offset & 0x78) << 1) | pTargetPkt->word_en;
+
+       do {
+               rtw_efuse_bt_access(padapter, _TRUE, efuse_addr, 1, &pg_header);
+               rtw_efuse_bt_access(padapter, _FALSE, efuse_addr, 1, &tmp_header);
+
+               if (tmp_header != 0xFF)
+                       break;
+               if (repeatcnt++ > EFUSE_REPEAT_THRESHOLD_) {
+                       RTW_INFO("%s: Repeat over limit for ext_header!!\n", __FUNCTION__);
+                       return _FALSE;
+               }
+       } while (1);
+
+       if (tmp_header != pg_header) {  /* offset PG fail */
+               RTW_ERR("%s: PG EXT Header Fail!!(pg=0x%02X read=0x%02X)\n", __FUNCTION__, pg_header, tmp_header);
+               return _FALSE;
+       }
+
+       *pAddr = efuse_addr;
+
+       return _TRUE;
+}
+
+
+static u8 hal_EfusePgPacketWrite1ByteHeader(
+       PADAPTER                pAdapter,
+       u8                              efuseType,
+       u16                             *pAddr,
+       PPGPKT_STRUCT   pTargetPkt,
+       u8                              bPseudoTest)
+{
+       u8      bRet = _FALSE;
+       u8      pg_header = 0, tmp_header = 0;
+       u16     efuse_addr = *pAddr;
+       u8      repeatcnt = 0;
+
+
+       /*      RTW_INFO("%s\n", __FUNCTION__); */
+       pg_header = ((pTargetPkt->offset << 4) & 0xf0) | pTargetPkt->word_en;
+
+       do {
+               rtw_efuse_bt_access(pAdapter, _TRUE, efuse_addr, 1, &pg_header);
+               rtw_efuse_bt_access(pAdapter, _FALSE, efuse_addr, 1, &tmp_header);
+
+               if (tmp_header != 0xFF)
+                       break;
+               if (repeatcnt++ > EFUSE_REPEAT_THRESHOLD_) {
+                       RTW_INFO("%s: Repeat over limit for pg_header!!\n", __FUNCTION__);
+                       return _FALSE;
+               }
+       } while (1);
+
+       if (tmp_header != pg_header) {
+               RTW_ERR("%s: PG Header Fail!!(pg=0x%02X read=0x%02X)\n", __FUNCTION__, pg_header, tmp_header);
+               return _FALSE;
+       }
+
+       *pAddr = efuse_addr;
+
+       return _TRUE;
+}
+
+static u8 hal_EfusePgPacketWriteHeader(
+       PADAPTER                padapter,
+       u8                              efuseType,
+       u16                             *pAddr,
+       PPGPKT_STRUCT   pTargetPkt,
+       u8                              bPseudoTest)
+{
+       u8 bRet = _FALSE;
+
+       if (pTargetPkt->offset >= EFUSE_MAX_SECTION_BASE)
+               bRet = hal_EfusePgPacketWrite2ByteHeader(padapter, efuseType, pAddr, pTargetPkt, bPseudoTest);
+       else
+               bRet = hal_EfusePgPacketWrite1ByteHeader(padapter, efuseType, pAddr, pTargetPkt, bPseudoTest);
+
+       return bRet;
+}
+
+
+static u8
+Hal_EfuseWordEnableDataWrite(
+       PADAPTER        padapter,
+       u16                     efuse_addr,
+       u8                      word_en,
+       u8                      *data,
+       u8                      bPseudoTest)
+{
+       u16     tmpaddr = 0;
+       u16     start_addr = efuse_addr;
+       u8      badworden = 0x0F;
+       u8      tmpdata[PGPKT_DATA_SIZE];
+
+
+       /*      RTW_INFO("%s: efuse_addr=%#x word_en=%#x\n", __FUNCTION__, efuse_addr, word_en); */
+       _rtw_memset(tmpdata, 0xFF, PGPKT_DATA_SIZE);
+
+       if (!(word_en & BIT(0))) {
+               tmpaddr = start_addr;
+               rtw_efuse_bt_access(padapter, _TRUE, start_addr++, 1, &data[0]);
+               rtw_efuse_bt_access(padapter, _TRUE, start_addr++, 1, &data[1]);
+               rtw_efuse_bt_access(padapter, _FALSE, tmpaddr, 1, &tmpdata[0]);
+               rtw_efuse_bt_access(padapter, _FALSE, tmpaddr + 1, 1, &tmpdata[1]);
+               if ((data[0] != tmpdata[0]) || (data[1] != tmpdata[1]))
+                       badworden &= (~BIT(0));
+       }
+       if (!(word_en & BIT(1))) {
+               tmpaddr = start_addr;
+               rtw_efuse_bt_access(padapter, _TRUE, start_addr++, 1, &data[2]);
+               rtw_efuse_bt_access(padapter, _TRUE, start_addr++, 1, &data[3]);
+               rtw_efuse_bt_access(padapter, _FALSE, tmpaddr, 1, &tmpdata[2]);
+               rtw_efuse_bt_access(padapter, _FALSE, tmpaddr + 1, 1, &tmpdata[3]);
+               if ((data[2] != tmpdata[2]) || (data[3] != tmpdata[3]))
+                       badworden &= (~BIT(1));
+       }
+       if (!(word_en & BIT(2))) {
+               tmpaddr = start_addr;
+               rtw_efuse_bt_access(padapter, _TRUE, start_addr++, 1, &data[4]);
+               rtw_efuse_bt_access(padapter, _TRUE, start_addr++, 1, &data[5]);
+               rtw_efuse_bt_access(padapter, _FALSE, tmpaddr, 1, &tmpdata[4]);
+               rtw_efuse_bt_access(padapter, _FALSE, tmpaddr + 1, 1, &tmpdata[5]);
+               if ((data[4] != tmpdata[4]) || (data[5] != tmpdata[5]))
+                       badworden &= (~BIT(2));
+       }
+       if (!(word_en & BIT(3))) {
+               tmpaddr = start_addr;
+               rtw_efuse_bt_access(padapter, _TRUE, start_addr++, 1, &data[6]);
+               rtw_efuse_bt_access(padapter, _TRUE, start_addr++, 1, &data[7]);
+               rtw_efuse_bt_access(padapter, _FALSE, tmpaddr, 1, &tmpdata[6]);
+               rtw_efuse_bt_access(padapter, _FALSE, tmpaddr + 1, 1, &tmpdata[7]);
+
+               if ((data[6] != tmpdata[6]) || (data[7] != tmpdata[7]))
+                       badworden &= (~BIT(3));
+       }
+
+       return badworden;
+}
+
+static void
+hal_EfuseConstructPGPkt(
+       u8                              offset,
+       u8                              word_en,
+       u8                              *pData,
+       PPGPKT_STRUCT   pTargetPkt)
+{
+       _rtw_memset(pTargetPkt->data, 0xFF, PGPKT_DATA_SIZE);
+       pTargetPkt->offset = offset;
+       pTargetPkt->word_en = word_en;
+       efuse_WordEnableDataRead(word_en, pData, pTargetPkt->data);
+       pTargetPkt->word_cnts = Efuse_CalculateWordCnts(pTargetPkt->word_en);
+}
+
+static u8
+hal_EfusePgPacketWriteData(
+       PADAPTER                pAdapter,
+       u8                              efuseType,
+       u16                             *pAddr,
+       PPGPKT_STRUCT   pTargetPkt,
+       u8                              bPseudoTest)
+{
+       u16     efuse_addr;
+       u8      badworden;
+
+       efuse_addr = *pAddr;
+       badworden = Hal_EfuseWordEnableDataWrite(pAdapter, efuse_addr + 1, pTargetPkt->word_en, pTargetPkt->data, bPseudoTest);
+       if (badworden != 0x0F) {
+               RTW_INFO("%s: Fail!!\n", __FUNCTION__);
+               return _FALSE;
+       } else
+               RTW_INFO("%s: OK!!\n", __FUNCTION__);
+
+       return _TRUE;
+}
+
+/* ***********************************************************
+ *                             Efuse related code
+ * *********************************************************** */
+static u8
+hal_EfuseSwitchToBank(
+       PADAPTER        padapter,
+       u8                      bank,
+       u8                      bPseudoTest)
+{
+       u8 bRet = _FALSE;
+       u32 value32 = 0;
+#ifdef HAL_EFUSE_MEMORY
+       PHAL_DATA_TYPE pHalData = GET_HAL_DATA(padapter);
+       PEFUSE_HAL pEfuseHal = &pHalData->EfuseHal;
+#endif
+
+
+       RTW_INFO("%s: Efuse switch bank to %d\n", __FUNCTION__, bank);
+       if (bPseudoTest) {
+#ifdef HAL_EFUSE_MEMORY
+               pEfuseHal->fakeEfuseBank = bank;
+#else
+               fakeEfuseBank = bank;
+#endif
+               bRet = _TRUE;
+       } else {
+               value32 = rtw_read32(padapter, 0x34);
+               bRet = _TRUE;
+               switch (bank) {
+               case 0:
+                       value32 = (value32 & ~EFUSE_SEL_MASK) | EFUSE_SEL(EFUSE_WIFI_SEL_0);
+                       break;
+               case 1:
+                       value32 = (value32 & ~EFUSE_SEL_MASK) | EFUSE_SEL(EFUSE_BT_SEL_0);
+                       break;
+               case 2:
+                       value32 = (value32 & ~EFUSE_SEL_MASK) | EFUSE_SEL(EFUSE_BT_SEL_1);
+                       break;
+               case 3:
+                       value32 = (value32 & ~EFUSE_SEL_MASK) | EFUSE_SEL(EFUSE_BT_SEL_2);
+                       break;
+               default:
+                       value32 = (value32 & ~EFUSE_SEL_MASK) | EFUSE_SEL(EFUSE_WIFI_SEL_0);
+                       bRet = _FALSE;
+                       break;
+               }
+               rtw_write32(padapter, 0x34, value32);
+       }
+
+       return bRet;
+}
+
+
+#define EFUSE_CTRL                             0x30            /* E-Fuse Control. */
+
+/*  11/16/2008 MH Read one byte from real Efuse. */
+u8
+efuse_OneByteRead(
+       IN      PADAPTER        pAdapter,
+       IN      u16                     addr,
+       IN      u8                      *data,
+       IN      BOOLEAN         bPseudoTest)
+{
+       u32     tmpidx = 0;
+       u8      bResult;
+       u8      readbyte;
+       HAL_DATA_TYPE   *pHalData = GET_HAL_DATA(pAdapter);
+
+       if (IS_HARDWARE_TYPE_8723B(pAdapter) ||
+           (IS_HARDWARE_TYPE_8192E(pAdapter) && (!IS_A_CUT(pHalData->version_id))) ||
+           (IS_VENDOR_8188E_I_CUT_SERIES(pAdapter)) || (IS_CHIP_VENDOR_SMIC(pHalData->version_id))
+          ) {
+               /* <20130121, Kordan> For SMIC EFUSE specificatoin. */
+               /* 0x34[11]: SW force PGMEN input of efuse to high. (for the bank selected by 0x34[9:8])         */
+               /* phy_set_mac_reg(pAdapter, 0x34, BIT11, 0); */
+               rtw_write16(pAdapter, 0x34, rtw_read16(pAdapter, 0x34) & (~BIT11));
+       }
+
+       /* -----------------e-fuse reg ctrl --------------------------------- */
+       /* address                       */
+       rtw_write8(pAdapter, EFUSE_CTRL + 1, (u8)(addr & 0xff));
+       rtw_write8(pAdapter, EFUSE_CTRL + 2, ((u8)((addr >> 8) & 0x03)) |
+                  (rtw_read8(pAdapter, EFUSE_CTRL + 2) & 0xFC));
+
+       /* rtw_write8(pAdapter, EFUSE_CTRL+3,  0x72); */ /* read cmd     */
+       /* Write bit 32 0 */
+       readbyte = rtw_read8(pAdapter, EFUSE_CTRL + 3);
+       rtw_write8(pAdapter, EFUSE_CTRL + 3, (readbyte & 0x7f));
+
+       while (!(0x80 & rtw_read8(pAdapter, EFUSE_CTRL + 3)) && (tmpidx < 1000)) {
+               rtw_mdelay_os(1);
+               tmpidx++;
+       }
+       if (tmpidx < 100) {
+               *data = rtw_read8(pAdapter, EFUSE_CTRL);
+               bResult = _TRUE;
+       } else {
+               *data = 0xff;
+               bResult = _FALSE;
+               RTW_INFO("%s: [ERROR] addr=0x%x bResult=%d time out 1s !!!\n", __FUNCTION__, addr, bResult);
+               RTW_INFO("%s: [ERROR] EFUSE_CTRL =0x%08x !!!\n", __FUNCTION__, rtw_read32(pAdapter, EFUSE_CTRL));
+       }
+
+       return bResult;
+}
+
+
+static u16
+hal_EfuseGetCurrentSize_BT(
+       PADAPTER        padapter,
+       u8                      bPseudoTest)
+{
+#ifdef HAL_EFUSE_MEMORY
+       PHAL_DATA_TYPE  pHalData = GET_HAL_DATA(padapter);
+       PEFUSE_HAL              pEfuseHal = &pHalData->EfuseHal;
+#endif
+       u16 btusedbytes;
+       u16     efuse_addr;
+       u8      bank, startBank;
+       u8      hoffset = 0, hworden = 0;
+       u8      efuse_data, word_cnts = 0;
+       u16     retU2 = 0;
+       u8 bContinual = _TRUE;
+
+
+       btusedbytes = fakeBTEfuseUsedBytes;
+
+       efuse_addr = (u16)((btusedbytes % EFUSE_BT_REAL_BANK_CONTENT_LEN));
+       startBank = (u8)(1 + (btusedbytes / EFUSE_BT_REAL_BANK_CONTENT_LEN));
+
+       RTW_INFO("%s: start from bank=%d addr=0x%X\n", __FUNCTION__, startBank, efuse_addr);
+       retU2 = EFUSE_BT_REAL_CONTENT_LEN - EFUSE_PROTECT_BYTES_BANK;
+
+       for (bank = startBank; bank < 3; bank++) {
+               if (hal_EfuseSwitchToBank(padapter, bank, bPseudoTest) == _FALSE) {
+                       RTW_ERR("%s: switch bank(%d) Fail!!\n", __FUNCTION__, bank);
+                       /* bank = EFUSE_MAX_BANK; */
+                       break;
+               }
+
+               /* only when bank is switched we have to reset the efuse_addr. */
+               if (bank != startBank)
+                       efuse_addr = 0;
+
+
+               while (AVAILABLE_EFUSE_ADDR(efuse_addr)) {
+                       if (rtw_efuse_bt_access(padapter, _FALSE, efuse_addr, 1, &efuse_data) == _FALSE) {
+                               RTW_ERR("%s: efuse_OneByteRead Fail! addr=0x%X !!\n", __FUNCTION__, efuse_addr);
+                               /* bank = EFUSE_MAX_BANK; */
+                               break;
+                       }
+                       RTW_INFO("%s: efuse_OneByteRead ! addr=0x%X !efuse_data=0x%X! bank =%d\n", __FUNCTION__, efuse_addr, efuse_data, bank);
+
+                       if (efuse_data == 0xFF)
+                               break;
+
+                       if (EXT_HEADER(efuse_data)) {
+                               hoffset = GET_HDR_OFFSET_2_0(efuse_data);
+                               efuse_addr++;
+                               rtw_efuse_bt_access(padapter, _FALSE, efuse_addr, 1, &efuse_data);
+                               RTW_INFO("%s: efuse_OneByteRead EXT_HEADER ! addr=0x%X !efuse_data=0x%X! bank =%d\n", __FUNCTION__, efuse_addr, efuse_data, bank);
+
+                               if (ALL_WORDS_DISABLED(efuse_data)) {
+                                       efuse_addr++;
+                                       continue;
+                               }
+
+                               /*                              hoffset = ((hoffset & 0xE0) >> 5) | ((efuse_data & 0xF0) >> 1); */
+                               hoffset |= ((efuse_data & 0xF0) >> 1);
+                               hworden = efuse_data & 0x0F;
+                       } else {
+                               hoffset = (efuse_data >> 4) & 0x0F;
+                               hworden =  efuse_data & 0x0F;
+                       }
+
+                       RTW_INFO(FUNC_ADPT_FMT": Offset=%d Worden=%#X\n",
+                                FUNC_ADPT_ARG(padapter), hoffset, hworden);
+
+                       word_cnts = Efuse_CalculateWordCnts(hworden);
+                       /* read next header */
+                       efuse_addr += (word_cnts * 2) + 1;
+               }
+               /* Check if we need to check next bank efuse */
+               if (efuse_addr < retU2)
+                       break;/* don't need to check next bank. */
+       }
+       retU2 = ((bank - 1) * EFUSE_BT_REAL_BANK_CONTENT_LEN) + efuse_addr;
+
+       fakeBTEfuseUsedBytes = retU2;
+       RTW_INFO("%s: CurrentSize=%d\n", __FUNCTION__, retU2);
+       return retU2;
+}
+
+
+static u8
+hal_BT_EfusePgCheckAvailableAddr(
+       PADAPTER        pAdapter,
+       u8              bPseudoTest)
+{
+       u16     max_available = EFUSE_BT_REAL_CONTENT_LEN - EFUSE_PROTECT_BYTES_BANK;
+       u16     current_size = 0;
+
+        RTW_INFO("%s: max_available=%d\n", __FUNCTION__, max_available);
+       current_size = hal_EfuseGetCurrentSize_BT(pAdapter, bPseudoTest);
+       if (current_size >= max_available) {
+               RTW_INFO("%s: Error!! current_size(%d)>max_available(%d)\n", __FUNCTION__, current_size, max_available);
+               return _FALSE;
+       }
+       return _TRUE;
+}
+
+u8 EfusePgPacketWrite_BT(
+       PADAPTER        pAdapter,
+       u8                      offset,
+       u8                      word_en,
+       u8                      *pData,
+       u8                      bPseudoTest)
+{
+       PGPKT_STRUCT targetPkt;
+       u16 startAddr = 0;
+       u8 efuseType = EFUSE_BT;
+
+       if (!hal_BT_EfusePgCheckAvailableAddr(pAdapter, bPseudoTest))
+               return _FALSE;
+
+       hal_EfuseConstructPGPkt(offset, word_en, pData, &targetPkt);
+
+       if (!hal_EfusePartialWriteCheck(pAdapter, efuseType, &startAddr, &targetPkt, bPseudoTest))
+               return _FALSE;
+
+       if (!hal_EfusePgPacketWriteHeader(pAdapter, efuseType, &startAddr, &targetPkt, bPseudoTest))
+               return _FALSE;
+
+       if (!hal_EfusePgPacketWriteData(pAdapter, efuseType, &startAddr, &targetPkt, bPseudoTest))
+               return _FALSE;
+
+       return _TRUE;
+}
+
+
+#else /* !RTW_HALMAC */
+/* ------------------------------------------------------------------------------ */
+#define REG_EFUSE_CTRL         0x0030
+#define EFUSE_CTRL                     REG_EFUSE_CTRL          /* E-Fuse Control. */
+/* ------------------------------------------------------------------------------ */
+
+VOID efuse_PreUpdateAction(
+       PADAPTER        pAdapter,
+       pu4Byte BackupRegs)
+{
+#if defined(CONFIG_RTL8812A)
+       if (IS_HARDWARE_TYPE_8812AU(pAdapter)) {
+               /* <20131115, Kordan> Turn off Rx to prevent from being busy when writing the EFUSE. (Asked by Chunchu.)*/
+               BackupRegs[0] = phy_query_mac_reg(pAdapter, REG_RCR, bMaskDWord);
+               BackupRegs[1] = phy_query_mac_reg(pAdapter, REG_RXFLTMAP0, bMaskDWord);
+               BackupRegs[2] = phy_query_mac_reg(pAdapter, REG_RXFLTMAP0+4, bMaskDWord);
+               BackupRegs[3] = phy_query_mac_reg(pAdapter, REG_AFE_MISC, bMaskDWord);
+
+               PlatformEFIOWrite4Byte(pAdapter, REG_RCR, 0x1);
+               PlatformEFIOWrite1Byte(pAdapter, REG_RXFLTMAP0, 0);
+               PlatformEFIOWrite1Byte(pAdapter, REG_RXFLTMAP0+1, 0);
+               PlatformEFIOWrite1Byte(pAdapter, REG_RXFLTMAP0+2, 0);
+               PlatformEFIOWrite1Byte(pAdapter, REG_RXFLTMAP0+3, 0);
+               PlatformEFIOWrite1Byte(pAdapter, REG_RXFLTMAP0+4, 0);
+               PlatformEFIOWrite1Byte(pAdapter, REG_RXFLTMAP0+5, 0);
+
+               /* <20140410, Kordan> 0x11 = 0x4E, lower down LX_SPS0 voltage. (Asked by Chunchu)*/
+               phy_set_mac_reg(pAdapter, REG_AFE_MISC, bMaskByte1, 0x4E);
+               }
+#endif
+}
+
+VOID efuse_PostUpdateAction(
+       PADAPTER        pAdapter,
+       pu4Byte BackupRegs)
+{
+#if defined(CONFIG_RTL8812A)
+       if (IS_HARDWARE_TYPE_8812AU(pAdapter)) {
+               /* <20131115, Kordan> Turn on Rx and restore the registers. (Asked by Chunchu.)*/
+               phy_set_mac_reg(pAdapter, REG_RCR, bMaskDWord, BackupRegs[0]);
+               phy_set_mac_reg(pAdapter, REG_RXFLTMAP0, bMaskDWord, BackupRegs[1]);
+               phy_set_mac_reg(pAdapter, REG_RXFLTMAP0+4, bMaskDWord, BackupRegs[2]);
+               phy_set_mac_reg(pAdapter, REG_AFE_MISC, bMaskDWord, BackupRegs[3]);
+       }
+#endif
+}
+
+
+BOOLEAN
+Efuse_Read1ByteFromFakeContent(
+       IN              PADAPTER        pAdapter,
+       IN              u16             Offset,
+       IN OUT  u8              *Value);
+BOOLEAN
+Efuse_Read1ByteFromFakeContent(
+       IN              PADAPTER        pAdapter,
+       IN              u16             Offset,
+       IN OUT  u8              *Value)
+{
+       if (Offset >= EFUSE_MAX_HW_SIZE)
+               return _FALSE;
+       /* DbgPrint("Read fake content, offset = %d\n", Offset); */
+       if (fakeEfuseBank == 0)
+               *Value = fakeEfuseContent[Offset];
+       else
+               *Value = fakeBTEfuseContent[fakeEfuseBank - 1][Offset];
+       return _TRUE;
+}
+
+BOOLEAN
+Efuse_Write1ByteToFakeContent(
+       IN              PADAPTER        pAdapter,
+       IN              u16             Offset,
+       IN              u8              Value);
+BOOLEAN
+Efuse_Write1ByteToFakeContent(
+       IN              PADAPTER        pAdapter,
+       IN              u16             Offset,
+       IN              u8              Value)
+{
+       if (Offset >= EFUSE_MAX_HW_SIZE)
+               return _FALSE;
+       if (fakeEfuseBank == 0)
+               fakeEfuseContent[Offset] = Value;
+       else
+               fakeBTEfuseContent[fakeEfuseBank - 1][Offset] = Value;
+       return _TRUE;
+}
+
+/*-----------------------------------------------------------------------------
+ * Function:   Efuse_PowerSwitch
+ *
+ * Overview:   When we want to enable write operation, we should change to
+ *                             pwr on state. When we stop write, we should switch to 500k mode
+ *                             and disable LDO 2.5V.
+ *
+ * Input:       NONE
+ *
+ * Output:      NONE
+ *
+ * Return:      NONE
+ *
+ * Revised History:
+ * When                        Who             Remark
+ * 11/17/2008  MHC             Create Version 0.
+ *
+ *---------------------------------------------------------------------------*/
+VOID
+Efuse_PowerSwitch(
+       IN      PADAPTER        pAdapter,
+       IN      u8              bWrite,
+       IN      u8              PwrState)
+{
+       pAdapter->hal_func.EfusePowerSwitch(pAdapter, bWrite, PwrState);
+}
+
+VOID
+BTEfuse_PowerSwitch(
+       IN      PADAPTER        pAdapter,
+       IN      u8              bWrite,
+       IN      u8              PwrState)
+{
+       if (pAdapter->hal_func.BTEfusePowerSwitch)
+               pAdapter->hal_func.BTEfusePowerSwitch(pAdapter, bWrite, PwrState);
+}
+
+/*-----------------------------------------------------------------------------
+ * Function:   efuse_GetCurrentSize
+ *
+ * Overview:   Get current efuse size!!!
+ *
+ * Input:       NONE
+ *
+ * Output:      NONE
+ *
+ * Return:      NONE
+ *
+ * Revised History:
+ * When                        Who             Remark
+ * 11/16/2008  MHC             Create Version 0.
+ *
+ *---------------------------------------------------------------------------*/
+u16
+Efuse_GetCurrentSize(
+       IN PADAPTER             pAdapter,
+       IN u8                   efuseType,
+       IN BOOLEAN              bPseudoTest)
+{
+       u16 ret = 0;
+
+       ret = pAdapter->hal_func.EfuseGetCurrentSize(pAdapter, efuseType, bPseudoTest);
+
+       return ret;
+}
+
+/*
+ *     Description:
+ *             Execute E-Fuse read byte operation.
+ *             Refered from SD1 Richard.
+ *
+ *     Assumption:
+ *             1. Boot from E-Fuse and successfully auto-load.
+ *             2. PASSIVE_LEVEL (USB interface)
+ *
+ *     Created by Roger, 2008.10.21.
+ *   */
+VOID
+ReadEFuseByte(
+       PADAPTER        Adapter,
+       u16                     _offset,
+       u8                      *pbuf,
+       IN BOOLEAN      bPseudoTest)
+{
+       u32     value32;
+       u8      readbyte;
+       u16     retry;
+       /* u32 start=rtw_get_current_time(); */
+
+       if (bPseudoTest) {
+               Efuse_Read1ByteFromFakeContent(Adapter, _offset, pbuf);
+               return;
+       }
+       if (IS_HARDWARE_TYPE_8723B(Adapter)) {
+               /* <20130121, Kordan> For SMIC S55 EFUSE specificatoin. */
+               /* 0x34[11]: SW force PGMEN input of efuse to high. (for the bank selected by 0x34[9:8]) */
+               phy_set_mac_reg(Adapter, EFUSE_TEST, BIT11, 0);
+       }
+       /* Write Address */
+       rtw_write8(Adapter, EFUSE_CTRL + 1, (_offset & 0xff));
+       readbyte = rtw_read8(Adapter, EFUSE_CTRL + 2);
+       rtw_write8(Adapter, EFUSE_CTRL + 2, ((_offset >> 8) & 0x03) | (readbyte & 0xfc));
+
+       /* Write bit 32 0 */
+       readbyte = rtw_read8(Adapter, EFUSE_CTRL + 3);
+       rtw_write8(Adapter, EFUSE_CTRL + 3, (readbyte & 0x7f));
+
+       /* Check bit 32 read-ready */
+       retry = 0;
+       value32 = rtw_read32(Adapter, EFUSE_CTRL);
+       /* while(!(((value32 >> 24) & 0xff) & 0x80)  && (retry<10)) */
+       while (!(((value32 >> 24) & 0xff) & 0x80)  && (retry < 10000)) {
+               value32 = rtw_read32(Adapter, EFUSE_CTRL);
+               retry++;
+       }
+
+       /* 20100205 Joseph: Add delay suggested by SD1 Victor. */
+       /* This fix the problem that Efuse read error in high temperature condition. */
+       /* Designer says that there shall be some delay after ready bit is set, or the */
+       /* result will always stay on last data we read. */
+       rtw_udelay_os(50);
+       value32 = rtw_read32(Adapter, EFUSE_CTRL);
+
+       *pbuf = (u8)(value32 & 0xff);
+       /* RTW_INFO("ReadEFuseByte _offset:%08u, in %d ms\n",_offset ,rtw_get_passing_time_ms(start)); */
+
+}
+
+/*
+ *     Description:
+ *             1. Execute E-Fuse read byte operation according as map offset and
+ *                 save to E-Fuse table.
+ *             2. Refered from SD1 Richard.
+ *
+ *     Assumption:
+ *             1. Boot from E-Fuse and successfully auto-load.
+ *             2. PASSIVE_LEVEL (USB interface)
+ *
+ *     Created by Roger, 2008.10.21.
+ *
+ *     2008/12/12 MH   1. Reorganize code flow and reserve bytes. and add description.
+ *                                     2. Add efuse utilization collect.
+ *     2008/12/22 MH   Read Efuse must check if we write section 1 data again!!! Sec1
+ *                                     write addr must be after sec5.
+ *   */
+
+VOID
+efuse_ReadEFuse(
+       PADAPTER        Adapter,
+       u8              efuseType,
+       u16             _offset,
+       u16             _size_byte,
+       u8      *pbuf,
+       IN      BOOLEAN bPseudoTest
+);
+VOID
+efuse_ReadEFuse(
+       PADAPTER        Adapter,
+       u8              efuseType,
+       u16             _offset,
+       u16             _size_byte,
+       u8      *pbuf,
+       IN      BOOLEAN bPseudoTest
+)
+{
+       Adapter->hal_func.ReadEFuse(Adapter, efuseType, _offset, _size_byte, pbuf, bPseudoTest);
+}
+
+VOID
+EFUSE_GetEfuseDefinition(
+       IN              PADAPTER        pAdapter,
+       IN              u8              efuseType,
+       IN              u8              type,
+       OUT             void            *pOut,
+       IN              BOOLEAN         bPseudoTest
+)
+{
+       pAdapter->hal_func.EFUSEGetEfuseDefinition(pAdapter, efuseType, type, pOut, bPseudoTest);
+}
+
+
+/*  11/16/2008 MH Read one byte from real Efuse. */
+u8
+efuse_OneByteRead(
+       IN      PADAPTER        pAdapter,
+       IN      u16                     addr,
+       IN      u8                      *data,
+       IN      BOOLEAN         bPseudoTest)
+{
+       u32     tmpidx = 0;
+       u8      bResult;
+       u8      readbyte;
+       HAL_DATA_TYPE   *pHalData = GET_HAL_DATA(pAdapter);
+
+       /* RTW_INFO("===> EFUSE_OneByteRead(), addr = %x\n", addr); */
+       /* RTW_INFO("===> EFUSE_OneByteRead() start, 0x34 = 0x%X\n", rtw_read32(pAdapter, EFUSE_TEST)); */
+
+       if (bPseudoTest) {
+               bResult = Efuse_Read1ByteFromFakeContent(pAdapter, addr, data);
+               return bResult;
+       }
+
+       if (IS_HARDWARE_TYPE_8723B(pAdapter) ||
+           (IS_HARDWARE_TYPE_8192E(pAdapter) && (!IS_A_CUT(pHalData->version_id))) ||
+           (IS_VENDOR_8188E_I_CUT_SERIES(pAdapter)) || (IS_CHIP_VENDOR_SMIC(pHalData->version_id))
+          ) {
+               /* <20130121, Kordan> For SMIC EFUSE specificatoin. */
+               /* 0x34[11]: SW force PGMEN input of efuse to high. (for the bank selected by 0x34[9:8])         */
+               /* phy_set_mac_reg(pAdapter, 0x34, BIT11, 0); */
+               rtw_write16(pAdapter, 0x34, rtw_read16(pAdapter, 0x34) & (~BIT11));
+       }
+
+       /* -----------------e-fuse reg ctrl --------------------------------- */
+       /* address                       */
+       rtw_write8(pAdapter, EFUSE_CTRL + 1, (u8)(addr & 0xff));
+       rtw_write8(pAdapter, EFUSE_CTRL + 2, ((u8)((addr >> 8) & 0x03)) |
+                  (rtw_read8(pAdapter, EFUSE_CTRL + 2) & 0xFC));
+
+       /* rtw_write8(pAdapter, EFUSE_CTRL+3,  0x72); */ /* read cmd     */
+       /* Write bit 32 0 */
+       readbyte = rtw_read8(pAdapter, EFUSE_CTRL + 3);
+       rtw_write8(pAdapter, EFUSE_CTRL + 3, (readbyte & 0x7f));
+
+       while (!(0x80 & rtw_read8(pAdapter, EFUSE_CTRL + 3)) && (tmpidx < 1000)) {
+               rtw_mdelay_os(1);
+               tmpidx++;
+       }
+       if (tmpidx < 100) {
+               *data = rtw_read8(pAdapter, EFUSE_CTRL);
+               bResult = _TRUE;
+       } else {
+               *data = 0xff;
+               bResult = _FALSE;
+               RTW_INFO("%s: [ERROR] addr=0x%x bResult=%d time out 1s !!!\n", __FUNCTION__, addr, bResult);
+               RTW_INFO("%s: [ERROR] EFUSE_CTRL =0x%08x !!!\n", __FUNCTION__, rtw_read32(pAdapter, EFUSE_CTRL));
+       }
+
+       return bResult;
+}
+
+/*  11/16/2008 MH Write one byte to reald Efuse. */
+u8
+efuse_OneByteWrite(
+       IN      PADAPTER        pAdapter,
+       IN      u16                     addr,
+       IN      u8                      data,
+       IN      BOOLEAN         bPseudoTest)
+{
+       u8      tmpidx = 0;
+       u8      bResult = _FALSE;
+       u32 efuseValue = 0;
+       HAL_DATA_TYPE   *pHalData = GET_HAL_DATA(pAdapter);
+
+       /* RTW_INFO("===> EFUSE_OneByteWrite(), addr = %x data=%x\n", addr, data); */
+       /* RTW_INFO("===> EFUSE_OneByteWrite() start, 0x34 = 0x%X\n", rtw_read32(pAdapter, EFUSE_TEST)); */
+
+       if (bPseudoTest) {
+               bResult = Efuse_Write1ByteToFakeContent(pAdapter, addr, data);
+               return bResult;
+       }
+
+       Efuse_PowerSwitch(pAdapter, _TRUE, _TRUE);
+
+       /* -----------------e-fuse reg ctrl ---------------------------------    */
+       /* address                       */
+
+
+       efuseValue = rtw_read32(pAdapter, EFUSE_CTRL);
+       efuseValue |= (BIT21 | BIT31);
+       efuseValue &= ~(0x3FFFF);
+       efuseValue |= ((addr << 8 | data) & 0x3FFFF);
+
+       /* <20130227, Kordan> 8192E MP chip A-cut had better not set 0x34[11] until B-Cut. */
+       if (IS_HARDWARE_TYPE_8723B(pAdapter) ||
+           (IS_HARDWARE_TYPE_8192E(pAdapter) && (!IS_A_CUT(pHalData->version_id))) ||
+           (IS_VENDOR_8188E_I_CUT_SERIES(pAdapter)) || (IS_CHIP_VENDOR_SMIC(pHalData->version_id))
+          ) {
+               /* <20130121, Kordan> For SMIC EFUSE specificatoin. */
+               /* 0x34[11]: SW force PGMEN input of efuse to high. (for the bank selected by 0x34[9:8]) */
+               /* phy_set_mac_reg(pAdapter, 0x34, BIT11, 1); */
+               rtw_write16(pAdapter, 0x34, rtw_read16(pAdapter, 0x34) | (BIT11));
+               rtw_write32(pAdapter, EFUSE_CTRL, 0x90600000 | ((addr << 8 | data)));
+       } else
+               rtw_write32(pAdapter, EFUSE_CTRL, efuseValue);
+
+       rtw_mdelay_os(1);
+
+       while ((0x80 &  rtw_read8(pAdapter, EFUSE_CTRL + 3)) && (tmpidx < 100)) {
+               rtw_mdelay_os(1);
+               tmpidx++;
+       }
+
+       if (tmpidx < 100)
+               bResult = _TRUE;
+       else {
+               bResult = _FALSE;
+               RTW_INFO("%s: [ERROR] addr=0x%x ,efuseValue=0x%x ,bResult=%d time out 1s !!!\n",
+                        __FUNCTION__, addr, efuseValue, bResult);
+               RTW_INFO("%s: [ERROR] EFUSE_CTRL =0x%08x !!!\n", __FUNCTION__, rtw_read32(pAdapter, EFUSE_CTRL));
+       }
+
+       /* disable Efuse program enable */
+       if (IS_HARDWARE_TYPE_8723B(pAdapter) ||
+           (IS_HARDWARE_TYPE_8192E(pAdapter) && (!IS_A_CUT(pHalData->version_id))) ||
+           (IS_VENDOR_8188E_I_CUT_SERIES(pAdapter)) || (IS_CHIP_VENDOR_SMIC(pHalData->version_id))
+          )
+               phy_set_mac_reg(pAdapter, EFUSE_TEST, BIT(11), 0);
+
+       Efuse_PowerSwitch(pAdapter, _TRUE, _FALSE);
+
+       return bResult;
+}
+
+int
+Efuse_PgPacketRead(IN  PADAPTER        pAdapter,
+                  IN   u8                      offset,
+                  IN   u8                      *data,
+                  IN   BOOLEAN         bPseudoTest)
+{
+       int     ret = 0;
+
+       ret =  pAdapter->hal_func.Efuse_PgPacketRead(pAdapter, offset, data, bPseudoTest);
+
+       return ret;
+}
+
+int
+Efuse_PgPacketWrite(IN PADAPTER        pAdapter,
+                   IN  u8                      offset,
+                   IN  u8                      word_en,
+                   IN  u8                      *data,
+                   IN  BOOLEAN         bPseudoTest)
+{
+       int ret;
+
+       ret =  pAdapter->hal_func.Efuse_PgPacketWrite(pAdapter, offset, word_en, data, bPseudoTest);
+
+       return ret;
+}
+
+
+int
+Efuse_PgPacketWrite_BT(IN      PADAPTER        pAdapter,
+                      IN       u8                      offset,
+                      IN       u8                      word_en,
+                      IN       u8                      *data,
+                      IN       BOOLEAN         bPseudoTest)
+{
+       int ret;
+
+       ret =  pAdapter->hal_func.Efuse_PgPacketWrite_BT(pAdapter, offset, word_en, data, bPseudoTest);
+
+       return ret;
+}
+
+
+u8
+Efuse_WordEnableDataWrite(IN   PADAPTER        pAdapter,
+                         IN    u16             efuse_addr,
+                         IN    u8              word_en,
+                         IN    u8              *data,
+                         IN    BOOLEAN         bPseudoTest)
+{
+       u8      ret = 0;
+
+       ret =  pAdapter->hal_func.Efuse_WordEnableDataWrite(pAdapter, efuse_addr, word_en, data, bPseudoTest);
+
+       return ret;
+}
+
+static u8 efuse_read8(PADAPTER padapter, u16 address, u8 *value)
+{
+       return efuse_OneByteRead(padapter, address, value, _FALSE);
+}
+
+static u8 efuse_write8(PADAPTER padapter, u16 address, u8 *value)
+{
+       return efuse_OneByteWrite(padapter, address, *value, _FALSE);
+}
+
+/*
+ * read/wirte raw efuse data
+ */
+u8 rtw_efuse_access(PADAPTER padapter, u8 bWrite, u16 start_addr, u16 cnts, u8 *data)
+{
+       int i = 0;
+       u16     real_content_len = 0, max_available_size = 0;
+       u8 res = _FAIL ;
+       u8(*rw8)(PADAPTER, u16, u8 *);
+       u32     backupRegs[4] = {0};
+
+
+       EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI, TYPE_EFUSE_REAL_CONTENT_LEN, (PVOID)&real_content_len, _FALSE);
+       EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI, TYPE_AVAILABLE_EFUSE_BYTES_TOTAL, (PVOID)&max_available_size, _FALSE);
+
+       if (start_addr > real_content_len)
+               return _FAIL;
+
+       if (_TRUE == bWrite) {
+               if ((start_addr + cnts) > max_available_size)
+                       return _FAIL;
+               rw8 = &efuse_write8;
+       } else
+               rw8 = &efuse_read8;
+
+       efuse_PreUpdateAction(padapter, backupRegs);
+
+       Efuse_PowerSwitch(padapter, bWrite, _TRUE);
+
+       /* e-fuse one byte read / write */
+       for (i = 0; i < cnts; i++) {
+               if (start_addr >= real_content_len) {
+                       res = _FAIL;
+                       break;
+               }
+
+               res = rw8(padapter, start_addr++, data++);
+               if (_FAIL == res)
+                       break;
+       }
+
+       Efuse_PowerSwitch(padapter, bWrite, _FALSE);
+
+       efuse_PostUpdateAction(padapter, backupRegs);
+
+       return res;
+}
+/* ------------------------------------------------------------------------------ */
+u16 efuse_GetMaxSize(PADAPTER padapter)
+{
+       u16     max_size;
+
+       max_size = 0;
+       EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI , TYPE_AVAILABLE_EFUSE_BYTES_TOTAL, (PVOID)&max_size, _FALSE);
+       return max_size;
+}
+/* ------------------------------------------------------------------------------ */
+u8 efuse_GetCurrentSize(PADAPTER padapter, u16 *size)
+{
+       Efuse_PowerSwitch(padapter, _FALSE, _TRUE);
+       *size = Efuse_GetCurrentSize(padapter, EFUSE_WIFI, _FALSE);
+       Efuse_PowerSwitch(padapter, _FALSE, _FALSE);
+
+       return _SUCCESS;
+}
+/* ------------------------------------------------------------------------------ */
+u16 efuse_bt_GetMaxSize(PADAPTER padapter)
+{
+       u16     max_size;
+
+       max_size = 0;
+       EFUSE_GetEfuseDefinition(padapter, EFUSE_BT , TYPE_AVAILABLE_EFUSE_BYTES_TOTAL, (PVOID)&max_size, _FALSE);
+       return max_size;
+}
+
+u8 efuse_bt_GetCurrentSize(PADAPTER padapter, u16 *size)
+{
+       Efuse_PowerSwitch(padapter, _FALSE, _TRUE);
+       *size = Efuse_GetCurrentSize(padapter, EFUSE_BT, _FALSE);
+       Efuse_PowerSwitch(padapter, _FALSE, _FALSE);
+
+       return _SUCCESS;
+}
+
+u8 rtw_efuse_map_read(PADAPTER padapter, u16 addr, u16 cnts, u8 *data)
+{
+       u16     mapLen = 0;
+
+       EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI, TYPE_EFUSE_MAP_LEN, (PVOID)&mapLen, _FALSE);
+
+       if ((addr + cnts) > mapLen)
+               return _FAIL;
+
+       Efuse_PowerSwitch(padapter, _FALSE, _TRUE);
+
+       efuse_ReadEFuse(padapter, EFUSE_WIFI, addr, cnts, data, _FALSE);
+
+       Efuse_PowerSwitch(padapter, _FALSE, _FALSE);
+
+       return _SUCCESS;
+}
+
+u8 rtw_BT_efuse_map_read(PADAPTER padapter, u16 addr, u16 cnts, u8 *data)
+{
+       u16     mapLen = 0;
+
+       EFUSE_GetEfuseDefinition(padapter, EFUSE_BT, TYPE_EFUSE_MAP_LEN, (PVOID)&mapLen, _FALSE);
+
+       if ((addr + cnts) > mapLen)
+               return _FAIL;
+
+       Efuse_PowerSwitch(padapter, _FALSE, _TRUE);
+
+       efuse_ReadEFuse(padapter, EFUSE_BT, addr, cnts, data, _FALSE);
+
+       Efuse_PowerSwitch(padapter, _FALSE, _FALSE);
+
+       return _SUCCESS;
+}
+
+/* ------------------------------------------------------------------------------ */
+u8 rtw_efuse_map_write(PADAPTER padapter, u16 addr, u16 cnts, u8 *data)
+{
+#define RT_ASSERT_RET(expr)                                                                                            \
+       if (!(expr)) {                                                                                                                  \
+               printk("Assertion failed! %s at ......\n", #expr);                                                      \
+               printk("      ......%s,%s, line=%d\n",__FILE__, __FUNCTION__, __LINE__);        \
+               return _FAIL;   \
+       }
+
+       u8      offset, word_en;
+       u8      *map;
+       u8      newdata[PGPKT_DATA_SIZE];
+       s32     i, j, idx, chk_total_byte;
+       u8      ret = _SUCCESS;
+       u16     mapLen = 0, startAddr = 0, efuse_max_available_len = 0;
+       u32     backupRegs[4] = {0};
+       HAL_DATA_TYPE   *pHalData = GET_HAL_DATA(padapter);
+       PEFUSE_HAL      pEfuseHal = &pHalData->EfuseHal;
+
+
+       EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI, TYPE_EFUSE_MAP_LEN, (PVOID)&mapLen, _FALSE);
+       EFUSE_GetEfuseDefinition(padapter, EFUSE_WIFI, TYPE_AVAILABLE_EFUSE_BYTES_TOTAL, &efuse_max_available_len, _FALSE);
+
+       if ((addr + cnts) > mapLen)
+               return _FAIL;
+
+       RT_ASSERT_RET(PGPKT_DATA_SIZE == 8); /* have to be 8 byte alignment */
+       RT_ASSERT_RET((mapLen & 0x7) == 0); /* have to be PGPKT_DATA_SIZE alignment for memcpy */
+
+       map = rtw_zmalloc(mapLen);
+       if (map == NULL)
+               return _FAIL;
+
+       _rtw_memset(map, 0xFF, mapLen);
+
+       ret = rtw_efuse_map_read(padapter, 0, mapLen, map);
+       if (ret == _FAIL)
+               goto exit;
+
+       if (padapter->registrypriv.boffefusemask == 0) {
+               for (i = 0; i < cnts; i++) {
+                       if (padapter->registrypriv.bFileMaskEfuse == _TRUE) {
+                               if (rtw_file_efuse_IsMasked(padapter, addr + i))        /*use file efuse mask. */
+                                       data[i] = map[addr + i];
+                       } else {
+                               if (efuse_IsMasked(padapter, addr + i))
+                                       data[i] = map[addr + i];
+                       }
+                       RTW_INFO("%s , data[%d] = %x, map[addr+i]= %x\n", __func__, i, data[i], map[addr + i]);
+               }
+       }
+       /*Efuse_PowerSwitch(padapter, _TRUE, _TRUE);*/
+
+       chk_total_byte = 0;
+       idx = 0;
+       offset = (addr >> 3);
+
+       while (idx < cnts) {
+               word_en = 0xF;
+               j = (addr + idx) & 0x7;
+               for (i = j; i < PGPKT_DATA_SIZE && idx < cnts; i++, idx++) {
+                       if (data[idx] != map[addr + idx])
+                               word_en &= ~BIT(i >> 1);
+               }
+
+               if (word_en != 0xF) {
+                       chk_total_byte += Efuse_CalculateWordCnts(word_en) * 2;
+
+                       if (offset >= EFUSE_MAX_SECTION_BASE) /* Over EFUSE_MAX_SECTION 16 for 2 ByteHeader */
+                               chk_total_byte += 2;
+                       else
+                               chk_total_byte += 1;
+               }
+
+               offset++;
+       }
+
+       RTW_INFO("Total PG bytes Count = %d\n", chk_total_byte);
+       rtw_hal_get_hwreg(padapter, HW_VAR_EFUSE_BYTES, (u8 *)&startAddr);
+
+       if (startAddr == 0) {
+               startAddr = Efuse_GetCurrentSize(padapter, EFUSE_WIFI, _FALSE);
+               RTW_INFO("%s: Efuse_GetCurrentSize startAddr=%#X\n", __func__, startAddr);
+       }
+       RTW_DBG("%s: startAddr=%#X\n", __func__, startAddr);
+
+       if ((startAddr + chk_total_byte) >= efuse_max_available_len) {
+               RTW_INFO("%s: startAddr(0x%X) + PG data len %d >= efuse_max_available_len(0x%X)\n",
+                        __func__, startAddr, chk_total_byte, efuse_max_available_len);
+               ret = _FAIL;
+               goto exit;
+       }
+
+       efuse_PreUpdateAction(padapter, backupRegs);
+
+       idx = 0;
+       offset = (addr >> 3);
+       while (idx < cnts) {
+               word_en = 0xF;
+               j = (addr + idx) & 0x7;
+               _rtw_memcpy(newdata, &map[offset << 3], PGPKT_DATA_SIZE);
+               for (i = j; i < PGPKT_DATA_SIZE && idx < cnts; i++, idx++) {
+                       if (data[idx] != map[addr + idx]) {
+                               word_en &= ~BIT(i >> 1);
+                               newdata[i] = data[idx];
+#ifdef CONFIG_RTL8723B
+                               if (addr + idx == 0x8) {
+                                       if (IS_C_CUT(pHalData->version_id) || IS_B_CUT(pHalData->version_id)) {
+                                               if (pHalData->adjuseVoltageVal == 6) {
+                                                       newdata[i] = map[addr + idx];
+                                                       RTW_INFO(" %s ,\n adjuseVoltageVal = %d ,newdata[%d] = %x\n", __func__, pHalData->adjuseVoltageVal, i, newdata[i]);
+                                               }
+                                       }
+                               }
+#endif
+                       }
+               }
+
+               if (word_en != 0xF) {
+                       ret = Efuse_PgPacketWrite(padapter, offset, word_en, newdata, _FALSE);
+                       RTW_INFO("offset=%x\n", offset);
+                       RTW_INFO("word_en=%x\n", word_en);
+
+                       for (i = 0; i < PGPKT_DATA_SIZE; i++)
+                               RTW_INFO("data=%x \t", newdata[i]);
+                       if (ret == _FAIL)
+                               break;
+               }
+
+               offset++;
+       }
+
+       /*Efuse_PowerSwitch(padapter, _TRUE, _FALSE);*/
+
+       efuse_PostUpdateAction(padapter, backupRegs);
+
+exit:
+
+       rtw_mfree(map, mapLen);
+
+       return ret;
+}
+
+
+u8 rtw_BT_efuse_map_write(PADAPTER padapter, u16 addr, u16 cnts, u8 *data)
+{
+#define RT_ASSERT_RET(expr)                                                                                            \
+       if (!(expr)) {                                                                                                                  \
+               printk("Assertion failed! %s at ......\n", #expr);                                                      \
+               printk("      ......%s,%s, line=%d\n",__FILE__, __FUNCTION__, __LINE__);        \
+               return _FAIL;   \
+       }
+
+       u8      offset, word_en;
+       u8      *map;
+       u8      newdata[PGPKT_DATA_SIZE];
+       s32     i = 0, j = 0, idx;
+       u8      ret = _SUCCESS;
+       u16     mapLen = 0;
+
+       EFUSE_GetEfuseDefinition(padapter, EFUSE_BT, TYPE_EFUSE_MAP_LEN, (PVOID)&mapLen, _FALSE);
+
+       if ((addr + cnts) > mapLen)
+               return _FAIL;
+
+       RT_ASSERT_RET(PGPKT_DATA_SIZE == 8); /* have to be 8 byte alignment */
+       RT_ASSERT_RET((mapLen & 0x7) == 0); /* have to be PGPKT_DATA_SIZE alignment for memcpy */
+
+       map = rtw_zmalloc(mapLen);
+       if (map == NULL)
+               return _FAIL;
+
+       ret = rtw_BT_efuse_map_read(padapter, 0, mapLen, map);
+       if (ret == _FAIL)
+               goto exit;
+       RTW_INFO("OFFSET\tVALUE(hex)\n");
+       for (i = 0; i < 1024; i += 16) { /* set 512 because the iwpriv's extra size have limit 0x7FF */
+               RTW_INFO("0x%03x\t", i);
+               for (j = 0; j < 8; j++)
+                       RTW_INFO("%02X ", map[i + j]);
+               RTW_INFO("\t");
+               for (; j < 16; j++)
+                       RTW_INFO("%02X ", map[i + j]);
+               RTW_INFO("\n");
+       }
+       RTW_INFO("\n");
+       Efuse_PowerSwitch(padapter, _TRUE, _TRUE);
+
+       idx = 0;
+       offset = (addr >> 3);
+       while (idx < cnts) {
+               word_en = 0xF;
+               j = (addr + idx) & 0x7;
+               _rtw_memcpy(newdata, &map[offset << 3], PGPKT_DATA_SIZE);
+               for (i = j; i < PGPKT_DATA_SIZE && idx < cnts; i++, idx++) {
+                       if (data[idx] != map[addr + idx]) {
+                               word_en &= ~BIT(i >> 1);
+                               newdata[i] = data[idx];
+                       }
+               }
+
+               if (word_en != 0xF) {
+                       RTW_INFO("offset=%x\n", offset);
+                       RTW_INFO("word_en=%x\n", word_en);
+                       RTW_INFO("%s: data=", __FUNCTION__);
+                       for (i = 0; i < PGPKT_DATA_SIZE; i++)
+                               RTW_INFO("0x%02X ", newdata[i]);
+                       RTW_INFO("\n");
+                       ret = Efuse_PgPacketWrite_BT(padapter, offset, word_en, newdata, _FALSE);
+                       if (ret == _FAIL)
+                               break;
+               }
+
+               offset++;
+       }
+
+       Efuse_PowerSwitch(padapter, _TRUE, _FALSE);
+
+exit:
+
+       rtw_mfree(map, mapLen);
+
+       return ret;
+}
+
+/*-----------------------------------------------------------------------------
+ * Function:   Efuse_ReadAllMap
+ *
+ * Overview:   Read All Efuse content
+ *
+ * Input:       NONE
+ *
+ * Output:      NONE
+ *
+ * Return:      NONE
+ *
+ * Revised History:
+ * When                        Who             Remark
+ * 11/11/2008  MHC             Create Version 0.
+ *
+ *---------------------------------------------------------------------------*/
+VOID
+Efuse_ReadAllMap(
+       IN              PADAPTER        pAdapter,
+       IN              u8              efuseType,
+       IN OUT  u8              *Efuse,
+       IN              BOOLEAN         bPseudoTest);
+VOID
+Efuse_ReadAllMap(
+       IN              PADAPTER        pAdapter,
+       IN              u8              efuseType,
+       IN OUT  u8              *Efuse,
+       IN              BOOLEAN         bPseudoTest)
+{
+       u16     mapLen = 0;
+
+       Efuse_PowerSwitch(pAdapter, _FALSE, _TRUE);
+
+       EFUSE_GetEfuseDefinition(pAdapter, efuseType, TYPE_EFUSE_MAP_LEN, (PVOID)&mapLen, bPseudoTest);
+
+       efuse_ReadEFuse(pAdapter, efuseType, 0, mapLen, Efuse, bPseudoTest);
+
+       Efuse_PowerSwitch(pAdapter, _FALSE, _FALSE);
+}
+
+/*-----------------------------------------------------------------------------
+ * Function:   efuse_ShadowRead1Byte
+ *                     efuse_ShadowRead2Byte
+ *                     efuse_ShadowRead4Byte
+ *
+ * Overview:   Read from efuse init map by one/two/four bytes !!!!!
+ *
+ * Input:       NONE
+ *
+ * Output:      NONE
+ *
+ * Return:      NONE
+ *
+ * Revised History:
+ * When                        Who             Remark
+ * 11/12/2008  MHC             Create Version 0.
+ *
+ *---------------------------------------------------------------------------*/
+static VOID
+efuse_ShadowRead1Byte(
+       IN      PADAPTER        pAdapter,
+       IN      u16             Offset,
+       IN OUT  u8              *Value)
+{
+       PHAL_DATA_TYPE pHalData = GET_HAL_DATA(pAdapter);
+
+       *Value = pHalData->efuse_eeprom_data[Offset];
+
+}      /* EFUSE_ShadowRead1Byte */
+
+/* ---------------Read Two Bytes */
+static VOID
+efuse_ShadowRead2Byte(
+       IN      PADAPTER        pAdapter,
+       IN      u16             Offset,
+       IN OUT  u16             *Value)
+{
+       PHAL_DATA_TYPE pHalData = GET_HAL_DATA(pAdapter);
+
+       *Value = pHalData->efuse_eeprom_data[Offset];
+       *Value |= pHalData->efuse_eeprom_data[Offset + 1] << 8;
+
+}      /* EFUSE_ShadowRead2Byte */
+
+/* ---------------Read Four Bytes */
+static VOID
+efuse_ShadowRead4Byte(
+       IN      PADAPTER        pAdapter,
+       IN      u16             Offset,
+       IN OUT  u32             *Value)
+{
+       PHAL_DATA_TYPE pHalData = GET_HAL_DATA(pAdapter);
+
+       *Value = pHalData->efuse_eeprom_data[Offset];
+       *Value |= pHalData->efuse_eeprom_data[Offset + 1] << 8;
+       *Value |= pHalData->efuse_eeprom_data[Offset + 2] << 16;
+       *Value |= pHalData->efuse_eeprom_data[Offset + 3] << 24;
+
+}      /* efuse_ShadowRead4Byte */
+
+
+/*-----------------------------------------------------------------------------
+ * Function:   efuse_ShadowWrite1Byte
+ *                     efuse_ShadowWrite2Byte
+ *                     efuse_ShadowWrite4Byte
+ *
+ * Overview:   Write efuse modify map by one/two/four byte.
+ *
+ * Input:       NONE
+ *
+ * Output:      NONE
+ *
+ * Return:      NONE
+ *
+ * Revised History:
+ * When                        Who             Remark
+ * 11/12/2008  MHC             Create Version 0.
+ *
+ *---------------------------------------------------------------------------*/
+#ifdef PLATFORM
+static VOID
+efuse_ShadowWrite1Byte(
+       IN      PADAPTER        pAdapter,
+       IN      u16             Offset,
+       IN      u8              Value);
+#endif /* PLATFORM */
+static VOID
+efuse_ShadowWrite1Byte(
+       IN      PADAPTER        pAdapter,
+       IN      u16             Offset,
+       IN      u8              Value)
+{
+       PHAL_DATA_TYPE pHalData = GET_HAL_DATA(pAdapter);
+
+       pHalData->efuse_eeprom_data[Offset] = Value;
+
+}      /* efuse_ShadowWrite1Byte */
+
+/* ---------------Write Two Bytes */
+static VOID
+efuse_ShadowWrite2Byte(
+       IN      PADAPTER        pAdapter,
+       IN      u16             Offset,
+       IN      u16             Value)
+{
+
+       PHAL_DATA_TYPE pHalData = GET_HAL_DATA(pAdapter);
+
+
+       pHalData->efuse_eeprom_data[Offset] = Value & 0x00FF;
+       pHalData->efuse_eeprom_data[Offset + 1] = Value >> 8;
+
+}      /* efuse_ShadowWrite1Byte */
+
+/* ---------------Write Four Bytes */
+static VOID
+efuse_ShadowWrite4Byte(
+       IN      PADAPTER        pAdapter,
+       IN      u16             Offset,
+       IN      u32             Value)
+{
+       PHAL_DATA_TYPE pHalData = GET_HAL_DATA(pAdapter);
+
+       pHalData->efuse_eeprom_data[Offset] = (u8)(Value & 0x000000FF);
+       pHalData->efuse_eeprom_data[Offset + 1] = (u8)((Value >> 8) & 0x0000FF);
+       pHalData->efuse_eeprom_data[Offset + 2] = (u8)((Value >> 16) & 0x00FF);
+       pHalData->efuse_eeprom_data[Offset + 3] = (u8)((Value >> 24) & 0xFF);
+
+}      /* efuse_ShadowWrite1Byte */
+
+
+/*-----------------------------------------------------------------------------
+ * Function:   EFUSE_ShadowRead
+ *
+ * Overview:   Read from efuse init map !!!!!
+ *
+ * Input:       NONE
+ *
+ * Output:      NONE
+ *
+ * Return:      NONE
+ *
+ * Revised History:
+ * When                        Who             Remark
+ * 11/12/2008  MHC             Create Version 0.
+ *
+ *---------------------------------------------------------------------------*/
+void
+EFUSE_ShadowRead(
+       IN              PADAPTER        pAdapter,
+       IN              u8              Type,
+       IN              u16             Offset,
+       IN OUT  u32             *Value)
+{
+       if (Type == 1)
+               efuse_ShadowRead1Byte(pAdapter, Offset, (u8 *)Value);
+       else if (Type == 2)
+               efuse_ShadowRead2Byte(pAdapter, Offset, (u16 *)Value);
+       else if (Type == 4)
+               efuse_ShadowRead4Byte(pAdapter, Offset, (u32 *)Value);
+
+}      /* EFUSE_ShadowRead */
+
+/*-----------------------------------------------------------------------------
+ * Function:   EFUSE_ShadowWrite
+ *
+ * Overview:   Write efuse modify map for later update operation to use!!!!!
+ *
+ * Input:       NONE
+ *
+ * Output:      NONE
+ *
+ * Return:      NONE
+ *
+ * Revised History:
+ * When                        Who             Remark
+ * 11/12/2008  MHC             Create Version 0.
+ *
+ *---------------------------------------------------------------------------*/
+VOID
+EFUSE_ShadowWrite(
+       IN      PADAPTER        pAdapter,
+       IN      u8              Type,
+       IN      u16             Offset,
+       IN OUT  u32             Value);
+VOID
+EFUSE_ShadowWrite(
+       IN      PADAPTER        pAdapter,
+       IN      u8              Type,
+       IN      u16             Offset,
+       IN OUT  u32             Value)
+{
+#if (MP_DRIVER == 0)
+       return;
+#endif
+       if (pAdapter->registrypriv.mp_mode == 0)
+               return;
+
+
+       if (Type == 1)
+               efuse_ShadowWrite1Byte(pAdapter, Offset, (u8)Value);
+       else if (Type == 2)
+               efuse_ShadowWrite2Byte(pAdapter, Offset, (u16)Value);
+       else if (Type == 4)
+               efuse_ShadowWrite4Byte(pAdapter, Offset, (u32)Value);
+
+}      /* EFUSE_ShadowWrite */
+
+VOID
+Efuse_InitSomeVar(
+       IN              PADAPTER        pAdapter
+);
+VOID
+Efuse_InitSomeVar(
+       IN              PADAPTER        pAdapter
+)
+{
+       u8 i;
+
+       _rtw_memset((PVOID)&fakeEfuseContent[0], 0xff, EFUSE_MAX_HW_SIZE);
+       _rtw_memset((PVOID)&fakeEfuseInitMap[0], 0xff, EFUSE_MAX_MAP_LEN);
+       _rtw_memset((PVOID)&fakeEfuseModifiedMap[0], 0xff, EFUSE_MAX_MAP_LEN);
+
+       for (i = 0; i < EFUSE_MAX_BT_BANK; i++)
+               _rtw_memset((PVOID)&BTEfuseContent[i][0], EFUSE_MAX_HW_SIZE, 0xff);
+       _rtw_memset((PVOID)&BTEfuseInitMap[0], 0xff, EFUSE_BT_MAX_MAP_LEN);
+       _rtw_memset((PVOID)&BTEfuseModifiedMap[0], 0xff, EFUSE_BT_MAX_MAP_LEN);
+
+       for (i = 0; i < EFUSE_MAX_BT_BANK; i++)
+               _rtw_memset((PVOID)&fakeBTEfuseContent[i][0], 0xff, EFUSE_MAX_HW_SIZE);
+       _rtw_memset((PVOID)&fakeBTEfuseInitMap[0], 0xff, EFUSE_BT_MAX_MAP_LEN);
+       _rtw_memset((PVOID)&fakeBTEfuseModifiedMap[0], 0xff, EFUSE_BT_MAX_MAP_LEN);
+}
+#endif /* !RTW_HALMAC */
+/*  11/16/2008 MH Add description. Get current efuse area enabled word!!. */
+u8
+Efuse_CalculateWordCnts(IN u8  word_en)
+{
+       u8 word_cnts = 0;
+       if (!(word_en & BIT(0)))
+               word_cnts++; /* 0 : write enable */
+       if (!(word_en & BIT(1)))
+               word_cnts++;
+       if (!(word_en & BIT(2)))
+               word_cnts++;
+       if (!(word_en & BIT(3)))
+               word_cnts++;
+       return word_cnts;
+}
+
+/*-----------------------------------------------------------------------------
+ * Function:   efuse_WordEnableDataRead
+ *
+ * Overview:   Read allowed word in current efuse section data.
+ *
+ * Input:       NONE
+ *
+ * Output:      NONE
+ *
+ * Return:      NONE
+ *
+ * Revised History:
+ * When                        Who             Remark
+ * 11/16/2008  MHC             Create Version 0.
+ * 11/21/2008  MHC             Fix Write bug when we only enable late word.
+ *
+ *---------------------------------------------------------------------------*/
+void
+efuse_WordEnableDataRead(IN    u8      word_en,
+                        IN     u8      *sourdata,
+                        IN     u8      *targetdata)
+{
+       if (!(word_en & BIT(0))) {
+               targetdata[0] = sourdata[0];
+               targetdata[1] = sourdata[1];
+       }
+       if (!(word_en & BIT(1))) {
+               targetdata[2] = sourdata[2];
+               targetdata[3] = sourdata[3];
+       }
+       if (!(word_en & BIT(2))) {
+               targetdata[4] = sourdata[4];
+               targetdata[5] = sourdata[5];
+       }
+       if (!(word_en & BIT(3))) {
+               targetdata[6] = sourdata[6];
+               targetdata[7] = sourdata[7];
+       }
+}
+
+/*-----------------------------------------------------------------------------
+ * Function:   EFUSE_ShadowMapUpdate
+ *
+ * Overview:   Transfer current EFUSE content to shadow init and modify map.
+ *
+ * Input:       NONE
+ *
+ * Output:      NONE
+ *
+ * Return:      NONE
+ *
+ * Revised History:
+ * When                        Who             Remark
+ * 11/13/2008  MHC             Create Version 0.
+ *
+ *---------------------------------------------------------------------------*/
+void EFUSE_ShadowMapUpdate(
+       IN PADAPTER     pAdapter,
+       IN u8           efuseType,
+       IN BOOLEAN      bPseudoTest)
+{
+       PHAL_DATA_TYPE pHalData = GET_HAL_DATA(pAdapter);
+       u16     mapLen = 0;
+#ifdef RTW_HALMAC
+       u8 *efuse_map = NULL;
+       int err;
+
+
+       mapLen = EEPROM_MAX_SIZE;
+       efuse_map = pHalData->efuse_eeprom_data;
+       /* efuse default content is 0xFF */
+       _rtw_memset(efuse_map, 0xFF, EEPROM_MAX_SIZE);
+
+       EFUSE_GetEfuseDefinition(pAdapter, efuseType, TYPE_EFUSE_MAP_LEN, (PVOID)&mapLen, bPseudoTest);
+       if (!mapLen) {
+               RTW_WARN("%s: <ERROR> fail to get efuse size!\n", __FUNCTION__);
+               mapLen = EEPROM_MAX_SIZE;
+       }
+       if (mapLen > EEPROM_MAX_SIZE) {
+               RTW_WARN("%s: <ERROR> size of efuse data(%d) is large than expected(%d)!\n",
+                        __FUNCTION__, mapLen, EEPROM_MAX_SIZE);
+               mapLen = EEPROM_MAX_SIZE;
+       }
+
+       if (pHalData->bautoload_fail_flag == _FALSE) {
+               err = rtw_halmac_read_logical_efuse_map(adapter_to_dvobj(pAdapter), efuse_map, mapLen);
+               if (err)
+                       RTW_ERR("%s: <ERROR> fail to get efuse map!\n", __FUNCTION__);
+       }
+#else /* !RTW_HALMAC */
+       EFUSE_GetEfuseDefinition(pAdapter, efuseType, TYPE_EFUSE_MAP_LEN, (PVOID)&mapLen, bPseudoTest);
+
+       if (pHalData->bautoload_fail_flag == _TRUE)
+               _rtw_memset(pHalData->efuse_eeprom_data, 0xFF, mapLen);
+       else {
+#ifdef CONFIG_ADAPTOR_INFO_CACHING_FILE
+               if (_SUCCESS != retriveAdaptorInfoFile(pAdapter->registrypriv.adaptor_info_caching_file_path, pHalData->efuse_eeprom_data)) {
+#endif
+
+                       Efuse_ReadAllMap(pAdapter, efuseType, pHalData->efuse_eeprom_data, bPseudoTest);
+
+#ifdef CONFIG_ADAPTOR_INFO_CACHING_FILE
+                       storeAdaptorInfoFile(pAdapter->registrypriv.adaptor_info_caching_file_path, pHalData->efuse_eeprom_data);
+               }
+#endif
+       }
+
+       /* PlatformMoveMemory((PVOID)&pHalData->EfuseMap[EFUSE_MODIFY_MAP][0], */
+       /* (PVOID)&pHalData->EfuseMap[EFUSE_INIT_MAP][0], mapLen); */
+#endif /* !RTW_HALMAC */
+
+       rtw_dump_cur_efuse(pAdapter);
+} /* EFUSE_ShadowMapUpdate */
+
+const u8 _mac_hidden_max_bw_to_hal_bw_cap[MAC_HIDDEN_MAX_BW_NUM] = {
+       0,
+       0,
+       (BW_CAP_160M | BW_CAP_80M | BW_CAP_40M | BW_CAP_20M | BW_CAP_10M | BW_CAP_5M),
+       (BW_CAP_5M),
+       (BW_CAP_10M | BW_CAP_5M),
+       (BW_CAP_20M | BW_CAP_10M | BW_CAP_5M),
+       (BW_CAP_40M | BW_CAP_20M | BW_CAP_10M | BW_CAP_5M),
+       (BW_CAP_80M | BW_CAP_40M | BW_CAP_20M | BW_CAP_10M | BW_CAP_5M),
+};
+
+const u8 _mac_hidden_proto_to_hal_proto_cap[MAC_HIDDEN_PROTOCOL_NUM] = {
+       0,
+       0,
+       (PROTO_CAP_11N | PROTO_CAP_11G | PROTO_CAP_11B),
+       (PROTO_CAP_11AC | PROTO_CAP_11N | PROTO_CAP_11G | PROTO_CAP_11B),
+};
+
+u8 mac_hidden_wl_func_to_hal_wl_func(u8 func)
+{
+       u8 wl_func = 0;
+
+       if (func & BIT0)
+               wl_func |= WL_FUNC_MIRACAST;
+       if (func & BIT1)
+               wl_func |= WL_FUNC_P2P;
+       if (func & BIT2)
+               wl_func |= WL_FUNC_TDLS;
+       if (func & BIT3)
+               wl_func |= WL_FUNC_FTM;
+
+       return wl_func;
+}
+
+#ifdef PLATFORM_LINUX
+#ifdef CONFIG_ADAPTOR_INFO_CACHING_FILE
+/* #include <rtw_eeprom.h> */
+
+int isAdaptorInfoFileValid(void)
+{
+       return _TRUE;
+}
+
+int storeAdaptorInfoFile(char *path, u8 *efuse_data)
+{
+       int ret = _SUCCESS;
+
+       if (path && efuse_data) {
+               ret = rtw_store_to_file(path, efuse_data, EEPROM_MAX_SIZE_512);
+               if (ret == EEPROM_MAX_SIZE)
+                       ret = _SUCCESS;
+               else
+                       ret = _FAIL;
+       } else {
+               RTW_INFO("%s NULL pointer\n", __FUNCTION__);
+               ret =  _FAIL;
+       }
+       return ret;
+}
+
+int retriveAdaptorInfoFile(char *path, u8 *efuse_data)
+{
+       int ret = _SUCCESS;
+       mm_segment_t oldfs;
+       struct file *fp;
+
+       if (path && efuse_data) {
+
+               ret = rtw_retrieve_from_file(path, efuse_data, EEPROM_MAX_SIZE);
+
+               if (ret == EEPROM_MAX_SIZE)
+                       ret = _SUCCESS;
+               else
+                       ret = _FAIL;
+
+#if 0
+               if (isAdaptorInfoFileValid())
+                       return 0;
+               else
+                       return _FAIL;
+#endif
+
+       } else {
+               RTW_INFO("%s NULL pointer\n", __FUNCTION__);
+               ret = _FAIL;
+       }
+       return ret;
+}
+#endif /* CONFIG_ADAPTOR_INFO_CACHING_FILE */
+
+u8 rtw_efuse_file_read(PADAPTER padapter, u8 *filepatch, u8 *buf, u32 len)
+{
+       char *ptmpbuf = NULL, *ptr;
+       u8 val8;
+       u32 count, i, j;
+       int err;
+       u32 bufsize = 4096;
+
+       ptmpbuf = rtw_zmalloc(bufsize);
+       if (ptmpbuf == NULL)
+               return _FALSE;
+
+       count = rtw_retrieve_from_file(filepatch, ptmpbuf, bufsize);
+       if (count <= 100) {
+               rtw_mfree(ptmpbuf, bufsize);
+               RTW_ERR("%s, filepatch %s, size=%d, FAIL!!\n", __FUNCTION__, filepatch, count);
+               return _FALSE;
+       }
+
+       i = 0;
+       j = 0;
+       ptr = ptmpbuf;
+       while ((j < len) && (i < count)) {
+               if (ptmpbuf[i] == '\0')
+                       break;
+       
+               ptr = strpbrk(&ptmpbuf[i], " \t\n\r");
+               if (ptr) {
+                       if (ptr == &ptmpbuf[i]) {
+                               i++;
+                               continue;
+                       }
+
+                       /* Add string terminating null */
+                       *ptr = 0;
+               } else {
+                       ptr = &ptmpbuf[count-1];
+               }
+
+               err = sscanf(&ptmpbuf[i], "%hhx", &val8);
+               if (err != 1) {
+                       RTW_WARN("Something wrong to parse efuse file, string=%s\n", &ptmpbuf[i]);
+               } else {
+                       buf[j] = val8;
+                       RTW_DBG("i=%d, j=%d, 0x%02x\n", i, j, buf[j]);
+                       j++;
+               }
+
+               i = ptr - ptmpbuf + 1;
+       }
+
+       rtw_mfree(ptmpbuf, bufsize);
+       RTW_INFO("%s, filepatch %s, size=%d, done\n", __FUNCTION__, filepatch, count);
+       return _TRUE;
+}
+
+#ifdef CONFIG_EFUSE_CONFIG_FILE
+u32 rtw_read_efuse_from_file(const char *path, u8 *buf, int map_size)
+{
+       u32 i;
+       u8 c;
+       u8 temp[3];
+       u8 temp_i;
+       u8 end = _FALSE;
+       u32 ret = _FAIL;
+
+       u8 *file_data = NULL;
+       u32 file_size, read_size, pos = 0;
+       u8 *map = NULL;
+
+       if (rtw_is_file_readable_with_size(path, &file_size) != _TRUE) {
+               RTW_PRINT("%s %s is not readable\n", __func__, path);
+               goto exit;
+       }
+
+       file_data = rtw_vmalloc(file_size);
+       if (!file_data) {
+               RTW_ERR("%s rtw_vmalloc(%d) fail\n", __func__, file_size);
+               goto exit;
+       }
+
+       read_size = rtw_retrieve_from_file(path, file_data, file_size);
+       if (read_size == 0) {
+               RTW_ERR("%s read from %s fail\n", __func__, path);
+               goto exit;
+       }
+
+       map = rtw_vmalloc(map_size);
+       if (!map) {
+               RTW_ERR("%s rtw_vmalloc(%d) fail\n", __func__, map_size);
+               goto exit;
+       }
+       _rtw_memset(map, 0xff, map_size);
+
+       temp[2] = 0; /* end of string '\0' */
+
+       for (i = 0 ; i < map_size ; i++) {
+               temp_i = 0;
+
+               while (1) {
+                       if (pos >= read_size) {
+                               end = _TRUE;
+                               break;
+                       }
+                       c = file_data[pos++];
+
+                       /* bypass spece or eol or null before first hex digit */
+                       if (temp_i == 0 && (is_eol(c) == _TRUE || is_space(c) == _TRUE || is_null(c) == _TRUE))
+                               continue;
+
+                       if (IsHexDigit(c) == _FALSE) {
+                               RTW_ERR("%s invalid 8-bit hex format for offset:0x%03x\n", __func__, i);
+                               goto exit;
+                       }
+
+                       temp[temp_i++] = c;
+
+                       if (temp_i == 2) {
+                               /* parse value */
+                               if (sscanf(temp, "%hhx", &map[i]) != 1) {
+                                       RTW_ERR("%s sscanf fail for offset:0x%03x\n", __func__, i);
+                                       goto exit;
+                               }
+                               break;
+                       }
+               }
+
+               if (end == _TRUE) {
+                       if (temp_i != 0) {
+                               RTW_ERR("%s incomplete 8-bit hex format for offset:0x%03x\n", __func__, i);
+                               goto exit;
+                       }
+                       break;
+               }
+       }
+
+       RTW_PRINT("efuse file:%s, 0x%03x byte content read\n", path, i);
+
+       _rtw_memcpy(buf, map, map_size);
+
+       ret = _SUCCESS;
+
+exit:
+       if (file_data)
+               rtw_vmfree(file_data, file_size);
+       if (map)
+               rtw_vmfree(map, map_size);
+
+       return ret;
+}
+
+u32 rtw_read_macaddr_from_file(const char *path, u8 *buf)
+{
+       u32 i;
+       u8 temp[3];
+       u32 ret = _FAIL;
+
+       u8 file_data[17];
+       u32 read_size, pos = 0;
+       u8 addr[ETH_ALEN];
+
+       if (rtw_is_file_readable(path) != _TRUE) {
+               RTW_PRINT("%s %s is not readable\n", __func__, path);
+               goto exit;
+       }
+
+       read_size = rtw_retrieve_from_file(path, file_data, 17);
+       if (read_size != 17) {
+               RTW_ERR("%s read from %s fail\n", __func__, path);
+               goto exit;
+       }
+
+       temp[2] = 0; /* end of string '\0' */
+
+       for (i = 0 ; i < ETH_ALEN ; i++) {
+               if (IsHexDigit(file_data[i * 3]) == _FALSE || IsHexDigit(file_data[i * 3 + 1]) == _FALSE) {
+                       RTW_ERR("%s invalid 8-bit hex format for address offset:%u\n", __func__, i);
+                       goto exit;
+               }
+
+               if (i < ETH_ALEN - 1 && file_data[i * 3 + 2] != ':') {
+                       RTW_ERR("%s invalid separator after address offset:%u\n", __func__, i);
+                       goto exit;
+               }
+
+               temp[0] = file_data[i * 3];
+               temp[1] = file_data[i * 3 + 1];
+               if (sscanf(temp, "%hhx", &addr[i]) != 1) {
+                       RTW_ERR("%s sscanf fail for address offset:0x%03x\n", __func__, i);
+                       goto exit;
+               }
+       }
+
+       _rtw_memcpy(buf, addr, ETH_ALEN);
+
+       RTW_PRINT("wifi_mac file: %s\n", path);
+#ifdef CONFIG_RTW_DEBUG
+       RTW_INFO(MAC_FMT"\n", MAC_ARG(buf));
+#endif
+
+       ret = _SUCCESS;
+
+exit:
+       return ret;
+}
+#endif /* CONFIG_EFUSE_CONFIG_FILE */
+
+#endif /* PLATFORM_LINUX */
diff --git a/drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_ap.c b/drivers/net/wireless/rockchip_wlan/rtl8723cs/core/rtw_ap.c
new file mode 100644 (file)
index 0000000..6e4ca39
--- /dev/null
@@ -0,0 +1,4168 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * 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.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ *
+ ******************************************************************************/
+#define _RTW_AP_C_
+
+#include <drv_types.h>
+#include <hal_data.h>
+
+#ifdef CONFIG_AP_MODE
+
+extern unsigned char   RTW_WPA_OUI[];
+extern unsigned char   WMM_OUI[];
+extern unsigned char   WPS_OUI[];
+extern unsigned char   P2P_OUI[];
+extern unsigned char   WFD_OUI[];
+
+void init_mlme_ap_info(_adapter *padapter)
+{
+       struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+       struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+
+       _rtw_spinlock_init(&pmlmepriv->bcn_update_lock);
+
+       /* pmlmeext->bstart_bss = _FALSE; */
+
+}
+
+void free_mlme_ap_info(_adapter *padapter)
+{
+       struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+
+       stop_ap_mode(padapter);
+       _rtw_spinlock_free(&pmlmepriv->bcn_update_lock);
+
+}
+
+static void update_BCNTIM(_adapter *padapter)
+{
+       struct sta_priv *pstapriv = &padapter->stapriv;
+       struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
+       struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
+       WLAN_BSSID_EX *pnetwork_mlmeext = &(pmlmeinfo->network);
+       unsigned char *pie = pnetwork_mlmeext->IEs;
+
+#if 0
+
+
+       /* update TIM IE */
+       /* if(pstapriv->tim_bitmap) */
+#endif
+       if (_TRUE) {
+               u8 *p, *dst_ie, *premainder_ie = NULL, *pbackup_remainder_ie = NULL;
+               u16 tim_bitmap_le;
+               uint offset, tmp_len, tim_ielen, tim_ie_offset, remainder_ielen;
+
+               tim_bitmap_le = cpu_to_le16(pstapriv->tim_bitmap);
+
+               p = rtw_get_ie(pie + _FIXED_IE_LENGTH_, _TIM_IE_, &tim_ielen, pnetwork_mlmeext->IELength - _FIXED_IE_LENGTH_);
+               if (p != NULL && tim_ielen > 0) {
+                       tim_ielen += 2;
+
+                       premainder_ie = p + tim_ielen;
+
+                       tim_ie_offset = (sint)(p - pie);
+
+                       remainder_ielen = pnetwork_mlmeext->IELength - tim_ie_offset - tim_ielen;
+
+                       /*append TIM IE from dst_ie offset*/
+                       dst_ie = p;
+               } else {
+                       tim_ielen = 0;
+
+                       /*calculate head_len*/
+                       offset = _FIXED_IE_LENGTH_;
+
+                       /* get ssid_ie len */
+                       p = rtw_get_ie(pie + _BEACON_IE_OFFSET_, _SSID_IE_, &tmp_len, (pnetwork_mlmeext->IELength - _BEACON_IE_OFFSET_));
+                       if (p != NULL)
+                               offset += tmp_len + 2;
+
+                       /*get supported rates len*/
+                       p = rtw_get_ie(pie + _BEACON_IE_OFFSET_, _SUPPORTEDRATES_IE_, &tmp_len, (pnetwork_mlmeext->IELength - _BEACON_IE_OFFSET_));
+                       if (p !=  NULL)
+                               offset += tmp_len + 2;
+
+                       /*DS Parameter Set IE, len=3*/
+                       offset += 3;
+
+                       premainder_ie = pie + offset;
+
+                       remainder_ielen = pnetwork_mlmeext->IELength - offset - tim_ielen;
+
+                       /*append TIM IE from offset*/
+                       dst_ie = pie + offset;
+
+               }
+
+               if (remainder_ielen > 0) {
+                       pbackup_remainder_ie = rtw_malloc(remainder_ielen);
+                       if (pbackup_remainder_ie && premainder_ie)
+                               _rtw_memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen);
+               }
+
+               *dst_ie++ = _TIM_IE_;
+
+               if ((pstapriv->tim_bitmap & 0xff00) && (pstapriv->tim_bitmap & 0x00fe))
+                       tim_ielen = 5;
+               else
+                       tim_ielen = 4;
+
+               *dst_ie++ = tim_ielen;
+
+               *dst_ie++ = 0;/*DTIM count*/
+               *dst_ie++ = 1;/*DTIM period*/
+
+               if (pstapriv->tim_bitmap & BIT(0))/*for bc/mc frames*/
+                       *dst_ie++ = BIT(0);/*bitmap ctrl */
+               else
+                       *dst_ie++ = 0;
+
+               if (tim_ielen == 4) {
+                       u8 pvb = 0;
+
+                       if (pstapriv->tim_bitmap & 0x00fe)
+                               pvb = (u8)tim_bitmap_le;
+                       else if (pstapriv->tim_bitmap & 0xff00)
+                               pvb = (u8)(tim_bitmap_le >> 8);
+                       else
+                               pvb = (u8)tim_bitmap_le;
+
+                       *dst_ie++ = pvb;
+
+               } else if (tim_ielen == 5) {
+                       _rtw_memcpy(dst_ie, &tim_bitmap_le, 2);
+                       dst_ie += 2;
+               }
+
+               /*copy remainder IE*/
+               if (pbackup_remainder_ie) {
+                       _rtw_memcpy(dst_ie, pbackup_remainder_ie, remainder_ielen);
+
+                       rtw_mfree(pbackup_remainder_ie, remainder_ielen);
+               }
+
+               offset = (uint)(dst_ie - pie);
+               pnetwork_mlmeext->IELength = offset + remainder_ielen;
+
+       }
+}
+
+void rtw_add_bcn_ie(_adapter *padapter, WLAN_BSSID_EX *pnetwork, u8 index, u8 *data, u8 len)
+{
+       PNDIS_802_11_VARIABLE_IEs       pIE;
+       u8      bmatch = _FALSE;
+       u8      *pie = pnetwork->IEs;
+       u8      *p = NULL, *dst_ie = NULL, *premainder_ie = NULL, *pbackup_remainder_ie = NULL;
+       u32     i, offset, ielen, ie_offset, remainder_ielen = 0;
+
+       for (i = sizeof(NDIS_802_11_FIXED_IEs); i < pnetwork->IELength;) {
+               pIE = (PNDIS_802_11_VARIABLE_IEs)(pnetwork->IEs + i);
+
+               if (pIE->ElementID > index)
+                       break;
+               else if (pIE->ElementID == index) { /* already exist the same IE */
+                       p = (u8 *)pIE;
+                       ielen = pIE->Length;
+                       bmatch = _TRUE;
+                       break;
+               }
+
+               p = (u8 *)pIE;
+               ielen = pIE->Length;
+               i += (pIE->Length + 2);
+       }
+
+       if (p != NULL && ielen > 0) {
+               ielen += 2;
+
+               premainder_ie = p + ielen;
+
+               ie_offset = (sint)(p - pie);
+
+               remainder_ielen = pnetwork->IELength - ie_offset - ielen;
+
+               if (bmatch)
+                       dst_ie = p;
+               else
+                       dst_ie = (p + ielen);
+       }
+
+       if (dst_ie == NULL)
+               return;
+
+       if (remainder_ielen > 0) {
+               pbackup_remainder_ie = rtw_malloc(remainder_ielen);
+               if (pbackup_remainder_ie && premainder_ie)
+                       _rtw_memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen);
+       }
+
+       *dst_ie++ = index;
+       *dst_ie++ = len;
+
+       _rtw_memcpy(dst_ie, data, len);
+       dst_ie += len;
+
+       /* copy remainder IE */
+       if (pbackup_remainder_ie) {
+               _rtw_memcpy(dst_ie, pbackup_remainder_ie, remainder_ielen);
+
+               rtw_mfree(pbackup_remainder_ie, remainder_ielen);
+       }
+
+       offset = (uint)(dst_ie - pie);
+       pnetwork->IELength = offset + remainder_ielen;
+}
+
+void rtw_remove_bcn_ie(_adapter *padapter, WLAN_BSSID_EX *pnetwork, u8 index)
+{
+       u8 *p, *dst_ie = NULL, *premainder_ie = NULL, *pbackup_remainder_ie = NULL;
+       uint offset, ielen, ie_offset, remainder_ielen = 0;
+       u8      *pie = pnetwork->IEs;
+
+       p = rtw_get_ie(pie + _FIXED_IE_LENGTH_, index, &ielen, pnetwork->IELength - _FIXED_IE_LENGTH_);
+       if (p != NULL && ielen > 0) {
+               ielen += 2;
+
+               premainder_ie = p + ielen;
+
+               ie_offset = (sint)(p - pie);
+
+               remainder_ielen = pnetwork->IELength - ie_offset - ielen;
+
+               dst_ie = p;
+       } else
+               return;
+
+       if (remainder_ielen > 0) {
+               pbackup_remainder_ie = rtw_malloc(remainder_ielen);
+               if (pbackup_remainder_ie && premainder_ie)
+                       _rtw_memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen);
+       }
+
+       /* copy remainder IE */
+       if (pbackup_remainder_ie) {
+               _rtw_memcpy(dst_ie, pbackup_remainder_ie, remainder_ielen);
+
+               rtw_mfree(pbackup_remainder_ie, remainder_ielen);
+       }
+
+       offset = (uint)(dst_ie - pie);
+       pnetwork->IELength = offset + remainder_ielen;
+}
+
+
+u8 chk_sta_is_alive(struct sta_info *psta);
+u8 chk_sta_is_alive(struct sta_info *psta)
+{
+       u8 ret = _FALSE;
+#ifdef DBG_EXPIRATION_CHK
+       RTW_INFO("sta:"MAC_FMT", rssi:%d, rx:"STA_PKTS_FMT", expire_to:%u, %s%ssq_len:%u\n"
+                , MAC_ARG(psta->hwaddr)
+                , psta->rssi_stat.undecorated_smoothed_pwdb
+                /* , STA_RX_PKTS_ARG(psta) */
+                , STA_RX_PKTS_DIFF_ARG(psta)
+                , psta->expire_to
+                , psta->state & WIFI_SLEEP_STATE ? "PS, " : ""
+                , psta->state & WIFI_STA_ALIVE_CHK_STATE ? "SAC, " : ""
+                , psta->sleepq_len
+               );
+#endif
+
+       /* if(sta_last_rx_pkts(psta) == sta_rx_pkts(psta)) */
+       if ((psta->sta_stats.last_rx_data_pkts + psta->sta_stats.last_rx_ctrl_pkts) == (psta->sta_stats.rx_data_pkts + psta->sta_stats.rx_ctrl_pkts)) {
+#if 0
+               if (psta->state & WIFI_SLEEP_STATE)
+                       ret = _TRUE;
+#endif
+       } else
+               ret = _TRUE;
+
+       sta_update_last_rx_pkts(psta);
+
+       return ret;
+}
+
+void   expire_timeout_chk(_adapter *padapter)
+{
+       _irqL irqL;
+       _list   *phead, *plist;
+       u8 updated = _FALSE;
+       struct sta_info *psta = NULL;
+       struct sta_priv *pstapriv = &padapter->stapriv;
+       u8 chk_alive_num = 0;
+       char chk_alive_list[NUM_STA];
+       int i;
+
+
+#ifdef CONFIG_MCC_MODE
+       /*      then driver may check fail due to not recv client's frame under sitesurvey,
+        *      don't expire timeout chk under MCC under sitesurvey */
+
+       if (rtw_hal_mcc_link_status_chk(padapter, __func__) == _FALSE)
+               return;
+#endif
+
+       _enter_critical_bh(&pstapriv->auth_list_lock, &irqL);
+
+       phead = &pstapriv->auth_list;
+       plist = get_next(phead);
+
+       /* check auth_queue */
+#ifdef DBG_EXPIRATION_CHK
+       if (rtw_end_of_queue_search(phead, plist) == _FALSE) {
+               RTW_INFO(FUNC_NDEV_FMT" auth_list, cnt:%u\n"
+                       , FUNC_NDEV_ARG(padapter->pnetdev), pstapriv->auth_list_cnt);
+       }
+#endif
+       while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) {
+               psta = LIST_CONTAINOR(plist, struct sta_info, auth_list);
+
+               plist = get_next(plist);
+
+
+#ifdef CONFIG_ATMEL_RC_PATCH
+               if (_TRUE == _rtw_memcmp((void *)(pstapriv->atmel_rc_pattern), (void *)(psta->hwaddr), ETH_ALEN))
+                       continue;
+               if (psta->flag_atmel_rc)
+                       continue;
+#endif
+               if (psta->expire_to > 0) {
+                       psta->expire_to--;
+                       if (psta->expire_to == 0) {
+                               rtw_list_delete(&psta->auth_list);
+                               pstapriv->auth_list_cnt--;
+
+                               RTW_INFO("auth expire %02X%02X%02X%02X%02X%02X\n",
+                                       psta->hwaddr[0], psta->hwaddr[1], psta->hwaddr[2], psta->hwaddr[3], psta->hwaddr[4], psta->hwaddr[5]);
+
+                               _exit_critical_bh(&pstapriv->auth_list_lock, &irqL);
+
+                               /* _enter_critical_bh(&(pstapriv->sta_hash_lock), &irqL);        */
+                               rtw_free_stainfo(padapter, psta);
+                               /* _exit_critical_bh(&(pstapriv->sta_hash_lock), &irqL);         */
+
+                               _enter_critical_bh(&pstapriv->auth_list_lock, &irqL);
+                       }
+               }
+
+       }
+
+       _exit_critical_bh(&pstapriv->auth_list_lock, &irqL);
+       psta = NULL;
+
+
+       _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL);
+
+       phead = &pstapriv->asoc_list;
+       plist = get_next(phead);
+
+       /* check asoc_queue */
+#ifdef DBG_EXPIRATION_CHK
+       if (rtw_end_of_queue_search(phead, plist) == _FALSE) {
+               RTW_INFO(FUNC_NDEV_FMT" asoc_list, cnt:%u\n"
+                       , FUNC_NDEV_ARG(padapter->pnetdev), pstapriv->asoc_list_cnt);
+       }
+#endif
+       while ((rtw_end_of_queue_search(phead, plist)) == _FALSE) {
+               psta = LIST_CONTAINOR(plist, struct sta_info, asoc_list);
+               plist = get_next(plist);
+#ifdef CONFIG_ATMEL_RC_PATCH
+               RTW_INFO("%s:%d  psta=%p, %02x,%02x||%02x,%02x  \n\n", __func__,  __LINE__,
+                       psta, pstapriv->atmel_rc_pattern[0], pstapriv->atmel_rc_pattern[5], psta->hwaddr[0], psta->hwaddr[5]);
+               if (_TRUE == _rtw_memcmp((void *)pstapriv->atmel_rc_pattern, (void *)(psta->hwaddr), ETH_ALEN))
+                       continue;
+               if (psta->flag_atmel_rc)
+                       continue;
+               RTW_INFO("%s: debug line:%d\n", __func__, __LINE__);
+#endif
+#ifdef CONFIG_AUTO_AP_MODE
+               if (psta->isrc)
+                       continue;
+#endif
+               if (chk_sta_is_alive(psta) || !psta->expire_to) {
+                       psta->expire_to = pstapriv->expire_to;
+                       psta->keep_alive_trycnt = 0;
+#ifdef CONFIG_TX_MCAST2UNI
+                       psta->under_exist_checking = 0;
+#endif /* CONFIG_TX_MCAST2UNI */
+               } else
+                       psta->expire_to--;
+
+#ifndef CONFIG_ACTIVE_KEEP_ALIVE_CHECK
+#ifdef CONFIG_80211N_HT
+#ifdef CONFIG_TX_MCAST2UNI
+               if ((psta->flags & WLAN_STA_HT) && (psta->htpriv.agg_enable_bitmap || psta->under_exist_checking)) {
+                       /* check sta by delba(addba) for 11n STA */
+                       /* ToDo: use CCX report to check for all STAs */
+                       /* RTW_INFO("asoc check by DELBA/ADDBA! (pstapriv->expire_to=%d s)(psta->expire_to=%d s), [%02x, %d]\n", pstapriv->expire_to*2, psta->expire_to*2, psta->htpriv.agg_enable_bitmap, psta->under_exist_checking); */
+
+                       if (psta->expire_to <= (pstapriv->expire_to - 50)) {
+                               RTW_INFO("asoc expire by DELBA/ADDBA! (%d s)\n", (pstapriv->expire_to - psta->expire_to) * 2);
+                               psta->under_exist_checking = 0;
+                               psta->expire_to = 0;
+                       } else if (psta->expire_to <= (pstapriv->expire_to - 3) && (psta->under_exist_checking == 0)) {
+                               RTW_INFO("asoc check by DELBA/ADDBA! (%d s)\n", (pstapriv->expire_to - psta->expire_to) * 2);
+                               psta->under_exist_checking = 1;
+                               /* tear down TX AMPDU */
+                               send_delba(padapter, 1, psta->hwaddr);/*  */ /* originator */
+                               psta->htpriv.agg_enable_bitmap = 0x0;/* reset */
+                               psta->htpriv.candidate_tid_bitmap = 0x0;/* reset */
+                       }
+               }
+#endif /* CONFIG_TX_MCAST2UNI */
+#endif /* CONFIG_80211N_HT */
+#endif /* CONFIG_ACTIVE_KEEP_ALIVE_CHECK */
+
+               if (psta->expire_to <= 0) {
+                       struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+
+                       if (padapter->registrypriv.wifi_spec == 1) {
+                               psta->expire_to = pstapriv->expire_to;
+                               continue;
+                       }
+
+#ifndef CONFIG_ACTIVE_KEEP_ALIVE_CHECK
+#ifdef CONFIG_80211N_HT
+
+#define KEEP_ALIVE_TRYCNT (3)
+
+                       if (psta->keep_alive_trycnt > 0 && psta->keep_alive_trycnt <= KEEP_ALIVE_TRYCNT) {
+                               if (psta->state & WIFI_STA_ALIVE_CHK_STATE)
+                                       psta->state ^= WIFI_STA_ALIVE_CHK_STATE;
+                               else
+                                       psta->keep_alive_trycnt = 0;
+
+                       } else if ((psta->keep_alive_trycnt > KEEP_ALIVE_TRYCNT) && !(psta->state & WIFI_STA_ALIVE_CHK_STATE))
+                               psta->keep_alive_trycnt = 0;
+                       if ((psta->htpriv.ht_option == _TRUE) && (psta->htpriv.ampdu_enable == _TRUE)) {
+                               uint priority = 1; /* test using BK */
+                               u8 issued = 0;
+
+                               /* issued = (psta->htpriv.agg_enable_bitmap>>priority)&0x1; */
+                               issued |= (psta->htpriv.candidate_tid_bitmap >> priority) & 0x1;
+
+                               if (0 == issued) {
+                                       if (!(psta->state & WIFI_STA_ALIVE_CHK_STATE)) {
+                                               psta->htpriv.candidate_tid_bitmap |= BIT((u8)priority);
+
+                                               if (psta->state & WIFI_SLEEP_STATE)
+                                                       psta->expire_to = 2; /* 2x2=4 sec */
+                                               else
+                                                       psta->expire_to = 1; /* 2 sec */
+
+                                               psta->state |= WIFI_STA_ALIVE_CHK_STATE;
+
+                                               /* add_ba_hdl(padapter, (u8*)paddbareq_parm); */
+
+                                               RTW_INFO("issue addba_req to check if sta alive, keep_alive_trycnt=%d\n", psta->keep_alive_trycnt);
+
+                                               issue_addba_req(padapter, psta->hwaddr, (u8)priority);
+
+                                               _set_timer(&psta->addba_retry_timer, ADDBA_TO);
+
+                                               psta->keep_alive_trycnt++;
+
+                                               continue;
+                                       }
+                               }
+                       }
+                       if (psta->keep_alive_trycnt > 0 && psta->state & WIFI_STA_ALIVE_CHK_STATE) {
+                               psta->keep_alive_trycnt = 0;
+                               psta->state ^= WIFI_STA_ALIVE_CHK_STATE;
+                               RTW_INFO("change to another methods to check alive if staion is at ps mode\n");
+                       }
+
+#endif /* CONFIG_80211N_HT */
+#endif /* CONFIG_ACTIVE_KEEP_ALIVE_CHECK        */
+                       if (psta->state & WIFI_SLEEP_STATE) {
+                               if (!(psta->state & WIFI_STA_ALIVE_CHK_STATE)) {
+                                       /* to check if alive by another methods if staion is at ps mode.                                         */
+                                       psta->expire_to = pstapriv->expire_to;
+                                       psta->state |= WIFI_STA_ALIVE_CHK_STATE;
+
+                                       /* RTW_INFO("alive chk, sta:" MAC_FMT " is at ps mode!\n", MAC_ARG(psta->hwaddr)); */
+
+                                       /* to update bcn with tim_bitmap for this station */
+                                       pstapriv->tim_bitmap |= BIT(psta->aid);
+                                       update_beacon(padapter, _TIM_IE_, NULL, _TRUE);
+
+                                       if (!pmlmeext->active_keep_alive_check)
+                                               continue;
+                               }
+                       }
+#ifdef CONFIG_ACTIVE_KEEP_ALIVE_CHECK
+                       if (pmlmeext->active_keep_alive_check) {
+                               int stainfo_offset;
+
+                               stainfo_offset = rtw_stainfo_offset(pstapriv, psta);
+                               if (stainfo_offset_valid(stainfo_offset))
+                                       chk_alive_list[chk_alive_num++] = stainfo_offset;
+
+                               continue;
+                       }
+#endif /* CONFIG_ACTIVE_KEEP_ALIVE_CHECK */
+                       rtw_list_delete(&psta->asoc_list);
+                       pstapriv->asoc_list_cnt--;
+                       RTW_INFO("asoc expire "MAC_FMT", state=0x%x\n", MAC_ARG(psta->hwaddr), psta->state);
+                       updated = ap_free_sta(padapter, psta, _FALSE, WLAN_REASON_DEAUTH_LEAVING, _TRUE);
+               } else {
+                       /* TODO: Aging mechanism to digest frames in sleep_q to avoid running out of xmitframe */
+                       if (psta->sleepq_len > (NR_XMITFRAME / pstapriv->asoc_list_cnt)
+                           && padapter->xmitpriv.free_xmitframe_cnt < ((NR_XMITFRAME / pstapriv->asoc_list_cnt) / 2)
+                          ) {
+                               RTW_INFO("%s sta:"MAC_FMT", sleepq_len:%u, free_xmitframe_cnt:%u, asoc_list_cnt:%u, clear sleep_q\n", __func__
+                                        , MAC_ARG(psta->hwaddr)
+                                       , psta->sleepq_len, padapter->xmitpriv.free_xmitframe_cnt, pstapriv->asoc_list_cnt);
+                               wakeup_sta_to_xmit(padapter, psta);
+                       }
+               }
+       }
+
+       _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
+
+#ifdef CONFIG_ACTIVE_KEEP_ALIVE_CHECK
+       if (chk_alive_num) {
+
+               u8 backup_ch = 0, backup_bw, backup_offset;
+               u8 union_ch = 0, union_bw, union_offset;
+               u8 switch_channel = _TRUE;
+               struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+
+               if (!rtw_mi_get_ch_setting_union(padapter, &union_ch, &union_bw, &union_offset)
+                       || pmlmeext->cur_channel != union_ch)
+                       goto bypass_active_keep_alive;
+
+#ifdef CONFIG_MCC_MODE
+               if (MCC_EN(padapter)) {
+                       /* driver doesn't switch channel under MCC */
+                       if (rtw_hal_check_mcc_status(padapter, MCC_STATUS_DOING_MCC))
+                               switch_channel = _FALSE;
+               }
+#endif
+               /* switch to correct channel of current network  before issue keep-alive frames */
+               if (switch_channel == _TRUE && rtw_get_oper_ch(padapter) != pmlmeext->cur_channel) {
+                       backup_ch = rtw_get_oper_ch(padapter);
+                       backup_bw = rtw_get_oper_bw(padapter);
+                       backup_offset = rtw_get_oper_choffset(padapter);
+                       set_channel_bwmode(padapter, union_ch, union_offset, union_bw);
+               }
+
+               /* issue null data to check sta alive*/
+               for (i = 0; i < chk_alive_num; i++) {
+                       int ret = _FAIL;
+
+                       psta = rtw_get_stainfo_by_offset(pstapriv, chk_alive_list[i]);
+#ifdef CONFIG_ATMEL_RC_PATCH
+                       if (_TRUE == _rtw_memcmp(pstapriv->atmel_rc_pattern, psta->hwaddr, ETH_ALEN))
+                               continue;
+                       if (psta->flag_atmel_rc)
+                               continue;
+#endif
+                       if (!(psta->state & _FW_LINKED))
+                               continue;
+
+                       if (psta->state & WIFI_SLEEP_STATE)
+                               ret = issue_nulldata(padapter, psta->hwaddr, 0, 1, 50);
+                       else
+                               ret = issue_nulldata(padapter, psta->hwaddr, 0, 3, 50);
+
+                       psta->keep_alive_trycnt++;
+                       if (ret == _SUCCESS) {
+                               RTW_INFO("asoc check, sta(" MAC_FMT ") is alive\n", MAC_ARG(psta->hwaddr));
+                               psta->expire_to = pstapriv->expire_to;
+                               psta->keep_alive_trycnt = 0;
+                               continue;
+                       } else if (psta->keep_alive_trycnt <= 3) {
+                               RTW_INFO("ack check for asoc expire, keep_alive_trycnt=%d\n", psta->keep_alive_trycnt);
+                               psta->expire_to = 1;
+                               continue;
+                       }
+
+                       psta->keep_alive_trycnt = 0;
+                       RTW_INFO("asoc expire "MAC_FMT", state=0x%x\n", MAC_ARG(psta->hwaddr), psta->state);
+                       _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL);
+                       if (rtw_is_list_empty(&psta->asoc_list) == _FALSE) {
+                               rtw_list_delete(&psta->asoc_list);
+                               pstapriv->asoc_list_cnt--;
+                               updated = ap_free_sta(padapter, psta, _FALSE, WLAN_REASON_DEAUTH_LEAVING, _TRUE);
+                       }
+                       _exit_critical_bh(&pstapriv->asoc_list_lock, &irqL);
+
+               }
+
+               /* back to the original operation channel */
+               if (switch_channel && backup_ch > 0)
+                       set_channel_bwmode(padapter, backup_ch, backup_offset, backup_bw);
+
+bypass_active_keep_alive:
+               ;
+       }
+#endif /* CONFIG_ACTIVE_KEEP_ALIVE_CHECK */
+
+       associated_clients_update(padapter, updated, STA_INFO_UPDATE_ALL);
+}
+
+void add_RATid(_adapter *padapter, struct sta_info *psta, u8 rssi_level, u8 is_update_bw)
+{
+       int i;
+       u8 rf_type;
+       unsigned char sta_band = 0;
+       u64 tx_ra_bitmap = 0;
+       struct ht_priv  *psta_ht = NULL;
+       struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+       WLAN_BSSID_EX *pcur_network = (WLAN_BSSID_EX *)&pmlmepriv->cur_network.network;
+
+#ifdef CONFIG_80211N_HT
+       if (psta)
+               psta_ht = &psta->htpriv;
+       else
+               return;
+#endif /* CONFIG_80211N_HT */
+
+       if (!(psta->state & _FW_LINKED))
+               return;
+
+       rtw_hal_update_sta_rate_mask(padapter, psta);
+       tx_ra_bitmap = psta->ra_mask;
+
+       if (pcur_network->Configuration.DSConfig > 14) {
+
+               if (tx_ra_bitmap & 0xffff000)
+                       sta_band |= WIRELESS_11_5N ;
+
+               if (tx_ra_bitmap & 0xff0)
+                       sta_band |= WIRELESS_11A;
+
+               /* 5G band */
+#ifdef CONFIG_80211AC_VHT
+               if (psta->vhtpriv.vht_option)
+                       sta_band = WIRELESS_11_5AC;
+#endif
+
+       } else {
+               if (tx_ra_bitmap & 0xffff000)
+                       sta_band |= WIRELESS_11_24N;
+
+               if (tx_ra_bitmap & 0xff0)
+                       sta_band |= WIRELESS_11G;
+
+               if (tx_ra_bitmap & 0x0f)
+                       sta_band |= WIRELESS_11B;
+       }
+
+       psta->wireless_mode = sta_band;
+       psta->raid = rtw_hal_networktype_to_raid(padapter, psta);
+
+       if (psta->aid < NUM_STA) {
+               RTW_INFO("%s=> mac_id:%d , raid:%d, tx_ra_bitmap:0x%016llx, networkType:0x%02x\n",
+                       __FUNCTION__, psta->mac_id, psta->raid, tx_ra_bitmap, psta->wireless_mode);
+
+               rtw_update_ramask(padapter, psta, psta->mac_id, rssi_level, is_update_bw);
+       } else
+               RTW_INFO("station aid %d exceed the max number\n", psta->aid);
+
+}
+
+void update_bmc_sta(_adapter *padapter)
+{
+       _irqL   irqL;
+       unsigned char   network_type;
+       int supportRateNum = 0;
+       struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+       WLAN_BSSID_EX *pcur_network = (WLAN_BSSID_EX *)&pmlmepriv->cur_network.network;
+       struct sta_info *psta = rtw_get_bcmc_stainfo(padapter);
+
+       if (psta) {
+               psta->aid = 0;/* default set to 0 */
+               psta->qos_option = 0;
+#ifdef CONFIG_80211N_HT
+               psta->htpriv.ht_option = _FALSE;
+#endif /* CONFIG_80211N_HT */
+
+               psta->ieee8021x_blocked = 0;
+
+               _rtw_memset((void *)&psta->sta_stats, 0, sizeof(struct stainfo_stats));
+
+               /* psta->dot118021XPrivacy = _NO_PRIVACY_; */ /* !!! remove it, because it has been set before this. */
+
+               /* prepare for add_RATid                 */
+               supportRateNum = rtw_get_rateset_len((u8 *)&pcur_network->SupportedRates);
+               network_type = rtw_check_network_type((u8 *)&pcur_network->SupportedRates, supportRateNum, pcur_network->Configuration.DSConfig);
+               if (IsSupportedTxCCK(network_type))
+                       network_type = WIRELESS_11B;
+               else if (network_type == WIRELESS_INVALID) { /* error handling */
+                       if (pcur_network->Configuration.DSConfig > 14)
+                               network_type = WIRELESS_11A;
+                       else
+                               network_type = WIRELESS_11B;
+               }
+               update_sta_basic_rate(psta, network_type);
+               psta->wireless_mode = network_type;
+
+               rtw_hal_update_sta_rate_mask(padapter, psta);
+
+               psta->raid = rtw_hal_networktype_to_raid(padapter, psta);
+
+               _enter_critical_bh(&psta->lock, &irqL);
+               psta->state = _FW_LINKED;
+               _exit_critical_bh(&psta->lock, &irqL);
+
+               rtw_sta_media_status_rpt(padapter, psta, 1);
+               rtw_hal_update_ra_mask(psta, psta->rssi_level, _TRUE);
+       } else
+               RTW_INFO("add_RATid_bmc_sta error!\n");
+
+}
+
+/* notes:
+ * AID: 1~MAX for sta and 0 for bc/mc in ap/adhoc mode  */
+void update_sta_info_apmode(_adapter *padapter, struct sta_info *psta)
+{
+       _irqL   irqL;
+       struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+       struct security_priv *psecuritypriv = &padapter->securitypriv;
+       struct mlme_ext_priv    *pmlmeext = &(padapter->mlmeextpriv);
+#ifdef CONFIG_80211N_HT
+       struct ht_priv  *phtpriv_ap = &pmlmepriv->htpriv;
+       struct ht_priv  *phtpriv_sta = &psta->htpriv;
+#endif /* CONFIG_80211N_HT */
+       u8      cur_ldpc_cap = 0, cur_stbc_cap = 0, cur_beamform_cap = 0;
+       /* set intf_tag to if1 */
+       /* psta->intf_tag = 0; */
+
+       RTW_INFO("%s\n", __FUNCTION__);
+
+       /*alloc macid when call rtw_alloc_stainfo(),release macid when call rtw_free_stainfo()*/
+
+       /* ap mode */
+       rtw_hal_set_odm_var(padapter, HAL_ODM_STA_INFO, psta, _TRUE);
+
+       if (psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_8021X)
+               psta->ieee8021x_blocked = _TRUE;
+       else
+               psta->ieee8021x_blocked = _FALSE;
+
+
+       /* update sta's cap */
+
+       /* ERP */
+       VCS_update(padapter, psta);
+#ifdef CONFIG_80211N_HT
+       /* HT related cap */
+       if (phtpriv_sta->ht_option) {
+               /* check if sta supports rx ampdu */
+               phtpriv_sta->ampdu_enable = phtpriv_ap->ampdu_enable;
+
+               phtpriv_sta->rx_ampdu_min_spacing = (phtpriv_sta->ht_cap.ampdu_params_info & IEEE80211_HT_CAP_AMPDU_DENSITY) >> 2;
+
+               /* bwmode */
+               if ((phtpriv_sta->ht_cap.cap_info & phtpriv_ap->ht_cap.cap_info) & cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH))
+                       psta->bw_mode = CHANNEL_WIDTH_40;
+               else
+                       psta->bw_mode = CHANNEL_WIDTH_20;
+
+               if (psta->ht_40mhz_intolerant)
+                       psta->bw_mode = CHANNEL_WIDTH_20;
+
+               if (pmlmeext->cur_bwmode < psta->bw_mode)
+                       psta->bw_mode = pmlmeext->cur_bwmode;
+
+               phtpriv_sta->ch_offset = pmlmeext->cur_ch_offset;
+
+
+               /* check if sta support s Short GI 20M */
+               if ((phtpriv_sta->ht_cap.cap_info & phtpriv_ap->ht_cap.cap_info) & cpu_to_le16(IEEE80211_HT_CAP_SGI_20))
+                       phtpriv_sta->sgi_20m = _TRUE;
+
+               /* check if sta support s Short GI 40M */
+               if ((phtpriv_sta->ht_cap.cap_info & phtpriv_ap->ht_cap.cap_info) & cpu_to_le16(IEEE80211_HT_CAP_SGI_40)) {
+                       if (psta->bw_mode == CHANNEL_WIDTH_40) /* according to psta->bw_mode */
+                               phtpriv_sta->sgi_40m = _TRUE;
+                       else
+                               phtpriv_sta->sgi_40m = _FALSE;
+               }
+
+               psta->qos_option = _TRUE;
+
+               /* B0 Config LDPC Coding Capability */
+               if (TEST_FLAG(phtpriv_ap->ldpc_cap, LDPC_HT_ENABLE_TX) &&
+                   GET_HT_CAP_ELE_LDPC_CAP((u8 *)(&phtpriv_sta->ht_cap))) {
+                       SET_FLAG(cur_ldpc_cap, (LDPC_HT_ENABLE_TX | LDPC_HT_CAP_TX));
+                       RTW_INFO("Enable HT Tx LDPC for STA(%d)\n", psta->aid);
+               }
+
+               /* B7 B8 B9 Config STBC setting */
+               if (TEST_FLAG(phtpriv_ap->stbc_cap, STBC_HT_ENABLE_TX) &&
+                   GET_HT_CAP_ELE_RX_STBC((u8 *)(&phtpriv_sta->ht_cap))) {
+                       SET_FLAG(cur_stbc_cap, (STBC_HT_ENABLE_TX | STBC_HT_CAP_TX));
+                       RTW_INFO("Enable HT Tx STBC for STA(%d)\n", psta->aid);
+               }
+
+#ifdef CONFIG_BEAMFORMING
+               /*Config Tx beamforming setting*/
+               if (TEST_FLAG(phtpriv_ap->beamform_cap, BEAMFORMING_HT_BEAMFORMEE_ENABLE) &&
+                   GET_HT_CAP_TXBF_EXPLICIT_COMP_STEERING_CAP((u8 *)(&phtpriv_sta->ht_cap))) {
+                       SET_FLAG(cur_beamform_cap, BEAMFORMING_HT_BEAMFORMER_ENABLE);
+                       /*Shift to BEAMFORMING_HT_BEAMFORMEE_CHNL_EST_CAP*/
+                       SET_FLAG(cur_beamform_cap, GET_HT_CAP_TXBF_CHNL_ESTIMATION_NUM_ANTENNAS((u8 *)(&phtpriv_sta->ht_cap)) << 6);
+               }
+
+               if (TEST_FLAG(phtpriv_ap->beamform_cap, BEAMFORMING_HT_BEAMFORMER_ENABLE) &&
+                   GET_HT_CAP_TXBF_EXPLICIT_COMP_FEEDBACK_CAP((u8 *)(&phtpriv_sta->ht_cap))) {
+                       SET_FLAG(cur_beamform_cap, BEAMFORMING_HT_BEAMFORMEE_ENABLE);
+                       /*Shift to BEAMFORMING_HT_BEAMFORMER_STEER_NUM*/
+                       SET_FLAG(cur_beamform_cap, GET_HT_CAP_TXBF_COMP_STEERING_NUM_ANTENNAS((u8 *)(&phtpriv_sta->ht_cap)) << 4);
+               }
+               if (cur_beamform_cap)
+                       RTW_INFO("Client STA(%d) HT Beamforming Cap = 0x%02X\n", psta->aid, cur_beamform_cap);
+#endif /*CONFIG_BEAMFORMING*/
+       } else {
+               phtpriv_sta->ampdu_enable = _FALSE;
+
+               phtpriv_sta->sgi_20m = _FALSE;
+               phtpriv_sta->sgi_40m = _FALSE;
+               psta->bw_mode = CHANNEL_WIDTH_20;
+               phtpriv_sta->ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
+       }
+
+       phtpriv_sta->ldpc_cap = cur_ldpc_cap;
+       phtpriv_sta->stbc_cap = cur_stbc_cap;
+       phtpriv_sta->beamform_cap = cur_beamform_cap;
+
+       /* Rx AMPDU */
+       send_delba(padapter, 0, psta->hwaddr);/* recipient */
+
+       /* TX AMPDU */
+       send_delba(padapter, 1, psta->hwaddr);/*  */ /* originator */
+       phtpriv_sta->agg_enable_bitmap = 0x0;/* reset */
+       phtpriv_sta->candidate_tid_bitmap = 0x0;/* reset */
+#endif /* CONFIG_80211N_HT */
+
+#ifdef CONFIG_80211AC_VHT
+       update_sta_vht_info_apmode(padapter, psta);
+#endif
+
+       update_ldpc_stbc_cap(psta);
+
+       /* todo: init other variables */
+
+       _rtw_memset((void *)&psta->sta_stats, 0, sizeof(struct stainfo_stats));
+
+
+       /* add ratid */
+       /* add_RATid(padapter, psta); */ /* move to ap_sta_info_defer_update() */
+
+
+       _enter_critical_bh(&psta->lock, &irqL);
+       psta->state |= _FW_LINKED;
+       _exit_critical_bh(&psta->lock, &irqL);
+
+
+}
+
+static void update_ap_info(_adapter *padapter, struct sta_info *psta)
+{
+       struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+       WLAN_BSSID_EX *pnetwork = (WLAN_BSSID_EX *)&pmlmepriv->cur_network.network;
+       struct security_priv *psecuritypriv = &padapter->securitypriv;
+&n